Legacy plugin $my->gid incorrect

This forum is for general questions about extensions for Joomla! version 1.5.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Legacy plugin $my->gid incorrect

Post by toivo » Sun Oct 19, 2008 10:49 pm

Hi,

I was testing a legacy mambot in J 1.5.7 and got it to work by fixing a typo in line 157 of plugins/system/legacy.php:

Code: Select all

// $GLOBALS['my']->gid	= $user->get('aid', 0);
   $GLOBALS['my']->gid	= $user->get('gid', 0);
A bug about the problem with $my->gid was submitted but subsequently closed over a year ago at http://joomlacode.org/gf/project/joomla ... em_id=6009

Regards,
Toivo Talikka, Global Moderator

 
User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Legacy plugin $my->gid incorrect

Post by toivo » Sat Nov 15, 2008 5:03 am

The suggested fix has already found some support:

http://www.joomlapolis.com/component/op ... /catid,40/

Bug report submitted:
http://forum.joomla.org/viewtopic.php?f=199&t=344160
Toivo Talikka, Global Moderator

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Legacy plugin $my->gid incorrect

Post by toivo » Thu Jan 15, 2009 1:12 am

I checked system/plugins/legacy.php in version 1.5.9 and noticed that it has a new function onAfterInitialise(). Line 269 of the legacy plugin seems to set $my-gid again incorrectly.

The details have been posted to the topic in bug reports: http://forum.joomla.org/viewtopic.php?f=199&t=344160.

Regards,
Toivo Talikka, Global Moderator

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Legacy plugin $my->gid incorrect

Post by toivo » Thu Jan 15, 2009 1:47 am

Looking at the code from line 156 in system/plugins/legacy.php in Joomla 1.5.7 - 1.5.9, is it possible that it is rather trying to set the value of $my->aid like this:

Code: Select all

		$GLOBALS['my']      = (object)$user->getProperties();
//		$GLOBALS['my']->gid	= $user->get('aid', 0);
                $GLOBALS['my']->aid	= $user->get('aid', 0);
Regards,
Toivo Talikka, Global Moderator

slabbi
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Sep 08, 2006 7:35 am

Re: Legacy plugin $my->gid incorrect

Post by slabbi » Tue Feb 24, 2009 10:57 am

Found this thread today:

Its not a bug:

$my->gid is
0 - not logged in
1 - regged user
2 - special user
in Joomla 1.0.x

So the behaviour of the legacy plugin is 100% ok.

$my->gid does NOT contain the group id like 18,...,25.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Legacy plugin $my->gid incorrect

Post by toivo » Tue Feb 24, 2009 12:36 pm

You describe the values for $my->aid. That is where the confusion is.

The Group ID is stored in the jos_users table as 'gid'. In Joomla 1.0 it is available from $my->gid and it should therefore be also available in Legacy mode as $my->gid.

Regards,
Toivo Talikka, Global Moderator

slabbi
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Sep 08, 2006 7:35 am

Re: Legacy plugin $my->gid incorrect

Post by slabbi » Tue Feb 24, 2009 12:43 pm

I am sorry but I have tested it again today with Joomla 1.0.15:

Joomla 1.0.15 returns 2 for "$my->gid" when you are logged in as Author+.

I am using a DB call to get the group id (18-25) from jos_users in uddeIM.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Legacy plugin $my->gid incorrect

Post by toivo » Wed Feb 25, 2009 9:30 am

Sorry, you are absolutely right, that is the way how gid is fudged in Joomla 1.0.x. When I say 'fudged', I am only quoting a comment from the routine in the source code of joomla.php which sets those values.

This oddity of naming and/or design is likely to disappear with the Legacy mode. In Joomla 1.5, the following code produces the group id:

Code: Select all

$user    =& JFactory::getUser();
$gid      = $user->gid;
Regards,
Toivo Talikka, Global Moderator

slabbi
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Sep 08, 2006 7:35 am

Re: Legacy plugin $my->gid incorrect

Post by slabbi » Wed Feb 25, 2009 9:59 am

So everything is fine as it is...

gid values for Superadmin:

Code: Select all

                      
                           $my->gid  $gid  $aid
Joomla 1.0                     2     n/a   n/a
Joomla 1.5 legacy              2     25    2
Joomla 1.5 native              n/a   25    2


$user =& JFactory::getUser();
$aid = $user->get('aid', 0);
$gid = $user->get('gid', 0);

indra2004_id
Joomla! Explorer
Joomla! Explorer
Posts: 372
Joined: Tue Aug 01, 2006 5:57 am
Location: Indonesia
Contact:

Re: Legacy plugin $my->gid incorrect

Post by indra2004_id » Sat Mar 21, 2009 5:33 pm

Hi Toivo,

So, what is the conclusion?
Should I apply both modifications, which you mentioned above?

Thanks in advance
I am in UTC +7

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Legacy plugin $my->gid incorrect

Post by toivo » Sun Mar 22, 2009 8:21 pm

I do not think that is necessary, unless you use an extension like JACLPLus which adds new usergroups, combined with a custom extension - in legacy mode - which relies on those new usergroups.
Toivo Talikka, Global Moderator

indra2004_id
Joomla! Explorer
Joomla! Explorer
Posts: 372
Joined: Tue Aug 01, 2006 5:57 am
Location: Indonesia
Contact:

Re: Legacy plugin $my->gid incorrect

Post by indra2004_id » Sun Mar 22, 2009 10:46 pm

toivo wrote:I do not think that is necessary, unless you use an extension like JACLPLus which adds new usergroups, combined with a custom extension - in legacy mode - which relies on those new usergroups.
Sorry, I forgot to explain that I turn on the legacy mode because I use CB notifier plugin, which is still in legacy.
So, yes, the legacy plugin is activated and my website has problem with retaining user log in status with "Remember Me" clicked.
Please let me know, which modification should I make.

I use J1.5.9, CB 1.2, CB Profile Notifier 1.7, PHP 5 & MySQL 5.
I prefer to use CB login module instead of Joomla login module.
I am in UTC +7

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Legacy plugin $my->gid incorrect

Post by toivo » Sun Mar 22, 2009 11:10 pm

IF CB does not use extra usergroups, you should just use Joomla as it is.

Regarding the login status of users, could the problem simply be caused by the maximum length of a user session? You can increase it in the Global Configuration in Joomla. I do not know CB which may also have a timeout in its configuration.
Toivo Talikka, Global Moderator

indra2004_id
Joomla! Explorer
Joomla! Explorer
Posts: 372
Joined: Tue Aug 01, 2006 5:57 am
Location: Indonesia
Contact:

Re: Legacy plugin $my->gid incorrect

Post by indra2004_id » Sun Mar 22, 2009 11:54 pm

toivo wrote:IF CB does not use extra usergroups, you should just use Joomla as it is.

Regarding the login status of users, could the problem simply be caused by the maximum length of a user session? You can increase it in the Global Configuration in Joomla. I do not know CB which may also have a timeout in its configuration.
I need CB because I need the extra user field in his/her profile, which a person must fill whenever he/she registers.
Hence CB login module is needed because Joomla login module will not show the additional field whenever a user click the registration.

I know about the length of a user session. I use 15 minutes (Joomla default)
In J.1.0.15, I can simply click on "Remember Me" and login, then I can close my browser, turn off my computer, turn the computer back on tomorrow, open the browser again and go to my website; And I am still logged in.
In J1.5, I cannot do that.
I am in UTC +7

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11927
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Legacy plugin $my->gid incorrect

Post by toivo » Mon Mar 23, 2009 3:32 am

IF CB does not use extra usergroups, you should just use Joomla as it is.
I meant you should use CB and Joomla but the original code for Legacy Mode, not the mod suggested in the beginning of this thread.
Toivo Talikka, Global Moderator

indra2004_id
Joomla! Explorer
Joomla! Explorer
Posts: 372
Joined: Tue Aug 01, 2006 5:57 am
Location: Indonesia
Contact:

Re: Legacy plugin $my->gid incorrect

Post by indra2004_id » Mon Mar 23, 2009 5:59 am

Nah, now I am totally lost :eek:

I need to turn on the legacy mode because so far I have a CB plugin (CB Profile Notifier), which needs the legacy mode.
Based on your posting in this thread, you mention that there is bug in the legacy plugin, but I don't know which modification should be applied.

Please help
I am in UTC +7

slabbi
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Sep 08, 2006 7:35 am

Re: Legacy plugin $my->gid incorrect

Post by slabbi » Mon Mar 23, 2009 7:35 am

Do not apply any change. That's all.

indra2004_id
Joomla! Explorer
Joomla! Explorer
Posts: 372
Joined: Tue Aug 01, 2006 5:57 am
Location: Indonesia
Contact:

Re: Legacy plugin $my->gid incorrect

Post by indra2004_id » Mon Mar 23, 2009 11:58 am

slabbi wrote:Do not apply any change. That's all.
If I don't apply any change, then the problem with "Remember Me" (I use CB login module because I have to) will arise.
I don't know where the problem lies. In Joomla legacy plugin? Refresh page of index.php? CB login module?
I am in UTC +7

indra2004_id
Joomla! Explorer
Joomla! Explorer
Posts: 372
Joined: Tue Aug 01, 2006 5:57 am
Location: Indonesia
Contact:

Re: Legacy plugin $my->gid incorrect

Post by indra2004_id » Tue Mar 24, 2009 7:29 am

Now I have got the conclusion :laugh: Finally

I ticked the Remember Me and login in the frontend using a user name, let's say it is "abc"
abc is actually member of the backend (administrator)
Somehow, I login at the backend as abc.
After I log out from the backend and go to front end, I find that abc has logged out.

If I don't use abc to login in the backend, everything is fine, Remember Me works as it has to be.
I am in UTC +7

 

Locked

Return to “Extensions for Joomla! 1.5”