Dear All,
I try to check if the user is logged in or not for this I use
if($my->id>0){
echo "Login";
}else
{
echo "Not login";
}
The same code work in joomla 1.5.3 it is ok in 1.5.3
but in 1.5.6 it does not work,
It only print Not Login in both case.
Thanks
Mamun
if($my->id) does not work in joomla 1.5.6
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
-
- Joomla! Apprentice
- Posts: 38
- Joined: Thu Sep 18, 2008 7:02 am
- Location: Dhaka,Bangladesh.
- Contact:
if($my->id) does not work in joomla 1.5.6
Best Regards,
RadiusTheme
https://www.radiustheme.com/joomla/joomla-templates/
Free & Premium Joomla Components & Templates.
RadiusTheme
https://www.radiustheme.com/joomla/joomla-templates/
Free & Premium Joomla Components & Templates.
-
- Joomla! Guru
- Posts: 725
- Joined: Sun Aug 24, 2008 4:35 pm
Re: if($my->id) does not work in joomla 1.5.6
Why not...
Site > Control Panel
On the right column there are five items:
Welcome to Joomla!
Logged in Users
Popular
Recent Added Articles
Menu Stats
Click on Logged in Users
Site > Control Panel
On the right column there are five items:
Welcome to Joomla!
Logged in Users
Popular
Recent Added Articles
Menu Stats
Click on Logged in Users
-
- Joomla! Apprentice
- Posts: 38
- Joined: Thu Sep 18, 2008 7:02 am
- Location: Dhaka,Bangladesh.
- Contact:
Re: if($my->id) does not work in joomla 1.5.6
Thanks for your reply.
But this is not the right solution.
I want this if user is login then give message "Welcome to User Name"
otherwise "Welcome to Guest"
For this I need to this
if($my->id>0){
echo "Login";
}else
{
echo "Not login";
}
This code does not work.
please help me.
Thanks
Mamun
But this is not the right solution.
I want this if user is login then give message "Welcome to User Name"
otherwise "Welcome to Guest"
For this I need to this
if($my->id>0){
echo "Login";
}else
{
echo "Not login";
}
This code does not work.
please help me.
Thanks
Mamun
Best Regards,
RadiusTheme
https://www.radiustheme.com/joomla/joomla-templates/
Free & Premium Joomla Components & Templates.
RadiusTheme
https://www.radiustheme.com/joomla/joomla-templates/
Free & Premium Joomla Components & Templates.
-
- Joomla! Guru
- Posts: 725
- Joined: Sun Aug 24, 2008 4:35 pm
Re: if($my->id) does not work in joomla 1.5.6
Ah yes... You'll find more on this here...mamunnu wrote:Thanks for your reply.
But this is not the right solution.
I want this if user is login then give message "Welcome to User Name"
otherwise "Welcome to Guest"
For this I need to this
if($my->id>0){
echo "Login";
}else
{
echo "Not login";
}
This code does not work.
please help me.
Thanks
Mamun
http://docs.joomla.org/Accessing_the_cu ... ser_object
Try that...
- coolparth
- Joomla! Explorer
- Posts: 264
- Joined: Mon Oct 10, 2005 12:26 pm
- Location: Pune, India
Re: if($my->id) does not work in joomla 1.5.6
Code: Select all
$uid =& JFactory::getUser();
$uid= $uid->id;
Parth Lawate Director
Tekdi Web Solutions. http://www.tekdi.net
Techjoomla. http://www.techjoomla.com
Tekdi Web Solutions. http://www.tekdi.net
Techjoomla. http://www.techjoomla.com
-
- Joomla! Enthusiast
- Posts: 190
- Joined: Sat Jan 14, 2006 1:59 pm
- Location: Sunderland UK
- Contact:
Re: if($my->id) does not work in joomla 1.5.6
Hi Did, you ever find a solution for this, as i have just found a similar problem, i have upgraded one of my sites and now it doesnt work properly.
That should be showing the message logged out if your not logged in, and logged in if you are logged in, but it doesn, it just shows logged out constantly.
Any idea?
Thanks
Ian
PS i usually use this to put in module positions such as
Code: Select all
<?php
if ($my->id ) {
echo "logged in";
} else {
echo "logged out";
}
?>
Any idea?
Thanks
Ian
PS i usually use this to put in module positions such as
Code: Select all
<?php
if ($my->id ) {
echo "<jdoc:include type=\"modules\" name=\"user1\" headerLevel=\"3\" />";
} else {
echo "<jdoc:include type=\"modules\" name=\"user2\" headerLevel=\"3\" />";
}
?>
- coolparth
- Joomla! Explorer
- Posts: 264
- Joined: Mon Oct 10, 2005 12:26 pm
- Location: Pune, India
Re: if($my->id) does not work in joomla 1.5.6
IN Joomla 1.5 $my is not declared like in 1.0. You need to define it like i said earlier..
So your code would be :
$my =& JFactory::getUser();
//Followed by your code..
if($my->id>0){
echo "Login";
}else
{
echo "Not login";
}
So your code would be :
$my =& JFactory::getUser();
//Followed by your code..
if($my->id>0){
echo "Login";
}else
{
echo "Not login";
}
Parth Lawate Director
Tekdi Web Solutions. http://www.tekdi.net
Techjoomla. http://www.techjoomla.com
Tekdi Web Solutions. http://www.tekdi.net
Techjoomla. http://www.techjoomla.com