Help on plugin for action post login

17 views
Skip to first unread message

Nick Weavers

unread,
Oct 23, 2011, 8:17:17 AM10/23/11
to Joomla! General Development
Hi, I would like to take some action after a user logs in successfully
based on the group they are in. Basically it would involve switching
the template and homepage. I guess it might be called context
switching.

Can anyone help with pointers or examples? Is a plugin the best way to
do this?

Thanks,
Nick

Nicholas K. Dionysopoulos

unread,
Oct 23, 2011, 8:40:24 AM10/23/11
to joomla-de...@googlegroups.com
Hello Nick,

You can create a user plugin which hooks on the onUserLogin event. This is called when the user logs in and before the redirection takes place. You can do everything you seem to want in there :) I have recently created such a plugin which adds the user's IP address to a Shoutcast server's white-list on login and removes it on logout. It's very easy, really!

Cheers,

-- 
Nicholas K. Dionysopoulos
Lead Developer, AkeebaBackup.com
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Mark Dexter

unread,
Oct 23, 2011, 6:38:49 PM10/23/11
to joomla-de...@googlegroups.com
Hi. Here is the link to the docs for this: http://docs.joomla.org/Plugin/Events/User. I guess you could use the JFactory::getUser()->groups to get a list of groups for the user. Then you would take whatever action you need. Good luck. Mark

Nick Weavers

unread,
Oct 24, 2011, 6:01:56 PM10/24/11
to Joomla! General Development
Thanks Nick and Mark.

Couldn't have hoped for more. Just the tips and references I was
after :)

Nick Weavers



Reply all
Reply to author
Forward
0 new messages