Page 2 of 2

Re: using a logout URL instead of button -- setting the result p

Posted: Sat Jun 13, 2009 7:30 pm
by ooffick
You can use the mod_login module for that though.

Olaf

Re: using a logout URL instead of button -- setting the result p

Posted: Sat Jun 13, 2009 7:39 pm
by MAD King
OK. Thank you

Re: using a logout URL instead of button -- setting the result p

Posted: Sat Jun 13, 2009 8:02 pm
by ooffick
Actually sorry, you can do logout without a token:

Did you try this one as normal external address:
index.php?option=com_user&return=Lw&task=logout

Olaf

Re: using a logout URL instead of button -- setting the result p

Posted: Sat Jun 13, 2009 9:03 pm
by MAD King
ooffick wrote:Actually sorry, you can do logout without a token:

Did you try this one as normal external address:
index.php?option=com_user&return=Lw&task=logout

Olaf
Perfect. Works like a charm. Thnx

Re: using a logout URL instead of button -- setting the result p

Posted: Sat Jun 13, 2009 9:04 pm
by MAD King
One more. Do you know how I can hide the virtuemart login box, after the user is logged in?

Re: using a logout URL instead of button -- setting the result p

Posted: Sat Jun 13, 2009 9:13 pm
by ooffick
You could use the Extension MetaMod to do that.

Olaf

Re: using a logout URL instead of button -- setting the result p

Posted: Sat Jun 13, 2009 9:26 pm
by MAD King
I use rockaccess, dont know if I can use MetaMod too or do I get a conflict? But how do I use it then?

Re: using a logout URL instead of button -- setting the result p

Posted: Sat Jun 13, 2009 10:42 pm
by ooffick
Well, as far as I know rokaccess is a content plugin.

If you want to hide a module (when you logged in) you would need to use e.g. MetaMod. Add it instead of the module you want to hide and then add into the parameters of that module:

Code: Select all

if ( MM_NOT_LOGGED_IN ) return 44; else return 45;
44 = Module ID of the Module which you want to display when the user is logged in
45 = Module ID of the Module which you want to display when the user is logged out

Olaf

Re: using a logout URL instead of button -- setting the result p

Posted: Sun Jun 14, 2009 12:30 am
by MAD King
Awesome. It works. Can't believe it. It works.

Thank you.

Re: using a logout URL instead of button -- setting the result p

Posted: Tue Jun 16, 2009 1:03 pm
by tusker
use module instead of menu link... you can achieve it that way..

Re: using a logout URL instead of button -- setting the result p

Posted: Tue Jun 16, 2009 1:52 pm
by MAD King
I did. Thnx

Re: using a logout URL instead of button -- setting the result p

Posted: Fri Oct 09, 2009 8:12 am
by darasso1
Hello,
Guys this solution is exactly the thing I was looking for.
It saves one click for the user by not showing the logout link as a part of module in the content but by logging out directly.
It is in my opinion smoother way of logout. More user firendly.

Thanks for sharing your knowledge...
:)
Regards,
Dariusz

Re: using a logout URL instead of button -- setting the result p

Posted: Tue Mar 23, 2010 4:46 pm
by gscott_24
Sorry to dig up such an old post, but Olaf is my hero. Exactly what I was looking for. Thanks much!
ooffick wrote:Can you try this one:

Code: Select all

index.php?option=com_user&task=logout&return=aW5kZXgucGhw
Do you have access to your error log file? to see if there are any errors? Do you have PHP4 or PHP5?

Olaf

Re: using a logout URL instead of button -- setting the result p

Posted: Tue Apr 27, 2010 6:57 pm
by mike_fowler
Just a quick snippet for anybody who runs across this post. This link will redirect the user to whichever page they are currently on after they are logged out.

Code: Select all

<?php 

// get the user object
$user = &JFactory::getUser();

// get the current Joomla base url
$base = JURI::current();

// encode the current base url for use in redirection
$redirect = base64_encode($base);

/* is the user logged in? if user is logged in, 
display Log Out link with redirection to 
current page */

if ($user->get('gid')) { ?>

<a href="index.php?option=com_user&task=logout&return=<?php echo $redirect; ?>">Log Out</a>

<?php } ?>