Page 1 of 2

Text Logout link Joomla 1.6

Posted: Thu Jan 27, 2011 7:07 pm
by spent85
Ladies and gentlemen,

I am currently doing an alternative layout for mod_login. When the user is logged in I would prefer the log out link to be in text rather than a button. In Joomla 1.5 this was as easy as template overriding mod_login and changing the logout input button to something like this:

Code: Select all

        <p>
		<a href="index.php?option=com_user&task=logout&return=Lw">Log Out</a>
	</p>
(This was discovered through the excellent help here and here.)

In Joomla 1.6 this seems to no longer work. Anyone have a new solution? Any help would be much appreciated.

-Zach

Re: Text Logout link Joomla 1.6

Posted: Sun Jan 30, 2011 7:08 pm
by Per Yngve Berg
It's just the matter of styling the button in your template's css.

Use Firebug or Opera Dragonfly to find the right css

http://docs.joomla.org/Using_Firebug_Wi ... la_Website

Re: Text Logout link Joomla 1.6

Posted: Fri Feb 11, 2011 4:22 pm
by storm22
Hey!

Include the following in your link:
../index.php?option=com_users&task=user.logout

'../' is for absolute path

I found this link in '/components/com_users/views/login/tmpl/default_logout.php' - as form action.

For me, it works just fine!

Re: Text Logout link Joomla 1.6

Posted: Fri Feb 11, 2011 4:32 pm
by OOmNezar

Re: Text Logout link Joomla 1.6

Posted: Fri Feb 11, 2011 5:49 pm
by Per Yngve Berg
The logout button is styled by this in personal.css:

Code: Select all

input.button, button.button, button.validate { 
background-attachment: scroll;
background-clip: border-box;
background-color: #ffffff;
background-image: url("http://localhost/joomla/1.6/templates/beez_20/images/nature/arrow1.gif");
background-origin: padding-box;
background-position: 0% 0%;
background-repeat: no-repeat;
background-size: auto;
border-bottom-color: #dddddd;
border-bottom-style: solid;
border-bottom-width: 1px;
border-left-color: #dddddd;
border-left-style: solid;
border-left-width: 1px;
border-right-color: #dddddd;
border-right-style: solid;
border-right-width: 1px;
border-top-color: #dddddd;
border-top-style: solid;
border-top-width: 1px;
color: #444444;
}

Re: Text Logout link Joomla 1.6

Posted: Fri Feb 11, 2011 6:25 pm
by mcsmom
In 1.6 it is com_users with an s at the end.

Re: Text Logout link Joomla 1.6

Posted: Tue Mar 29, 2011 3:53 pm
by Gistapulous
Man I've been struggling with this for two days - hope this solution helps someone else:

Code: Select all

  <a href="<?php echo JRoute::_('/index.php?option=com_users&task=user.logout&'. JUtility::getToken() .'=1'); ?>">Log Out</a>

Re: Text Logout link Joomla 1.6

Posted: Mon Jun 06, 2011 6:50 pm
by Dondini
Thank you Gistapulous! exactly what I was looking for!

Re: Text Logout link Joomla 1.6

Posted: Mon Jun 13, 2011 8:29 pm
by red2678
Gistapulous wrote:Man I've been struggling with this for two days - hope this solution helps someone else:

Code: Select all

  <a href="<?php echo JRoute::_('/index.php?option=com_users&task=user.logout&'. JUtility::getToken() .'=1'); ?>">Log Out</a>
Is there any way to get that into a menu item? :-[

Re: Text Logout link Joomla 1.6

Posted: Thu Jun 16, 2011 12:39 pm
by darlintonp
Here people, i found a solution to override the joomla token in get method:

If you are trying to write a link to logout in your template, just copy and past the following code:


<a href="index.php?option=com_users&task=user.logout&<?php echo JUtility::getToken(); ?>=1&return=<?php echo base64_encode($this->baseurl); ?>">LOGOUT</a>

Works like a charm.

Re: Text Logout link Joomla 1.6

Posted: Thu Jun 16, 2011 1:54 pm
by red2678
red2678 wrote: Is there any way to get that into a menu item? :-[

Re: Text Logout link Joomla 1.6

Posted: Thu Jun 16, 2011 2:10 pm
by darlintonp
No, its use the php code to get the current token, there is no way to do this in a menu item.

BUT, id did it aniway with javascript:

I create a url menu item with the class "logoutclass"
then i put that code in my template, and put a class "tpllogoutclass" in the <a> element.

then, with jquery, i did this:
$(".logoutclass").attr("href", $(".tpllogoutclass").attr("href"));

and it works, the menu item now has the link to logout.

Re: Text Logout link Joomla 1.6

Posted: Thu Jun 16, 2011 2:17 pm
by red2678
That is very cool! However, it is not what I am looking for (but still cool).

I want to make a text link that says "login" and when the user is logged in, it says "logout."

I can do this, in a module/article, with PHP very easily. I just cannot do it in a menu item.

Anyone know how? Or if it is possible? (J 1.5)

Re: Text Logout link Joomla 1.6

Posted: Fri Jun 17, 2011 3:33 pm
by carsten888
to make a menu-item logout in Joomla 1.6 you can use the free version of Redirect-on-Login.

In Joomla 1.5 make a menu-item type 'url' to

Code: Select all

index.php?option=com_user&task=logout
and if you want it to redirect to a specific url, base 64 encode the url and send it along like:

Code: Select all

index.php?option=com_user&task=logout&return=aW5kZXgucGh
To redirect to a specific url in Joomla 1.6 you can do something like:

Code: Select all

index.php?option=com_redirectonlogin&view=logout&return=aW5kZXgucGh
but then you got to create a 'url' menu-item instead of a 'redirect-on-login' > 'logout' menu-item.

Re: Text Logout link Joomla 1.6

Posted: Thu Jul 28, 2011 1:12 pm
by wwr
Hi everyone!

This problem caused a headache for me too, but i found a pretty good solution. The posts here were really useful.

This is the way i created a logout link in the main menu:
1) Install the Flexi Custom Code module.
2) Create a menu item called "Logout" with a type of "Login form". It should be visible to logged in users only. (access: registered)
3) Set the Flexi Custom Code module to any visible position. At the Menu Assignment tab select only "Logout"
4) Use the following code in the module:

<?php
$loloc = "Location: index.php?option=com_users&task=user.logout&";
$loloc .= JUtility::getToken();
$loloc .= "=1&return=";
$loloc .= base64_encode(JURI::root() . "\n");
header( $loloc );
?>

If you want a login button as well you should simply add another menu item which is only visible to not logged in visitors. This will make it look like the login button changes to logout when you are logged in.

Re: Text Logout link Joomla 1.6

Posted: Wed Aug 03, 2011 3:55 pm
by kathkeating
Crazy that something so easy as having a logout link on a menu has to be so hard. These basic things have to be better handled in the core. Thanks for the pointer for how to rig this up to work from a menu. Requiring a two-step logout is not good.

Re: Text Logout link Joomla 1.6

Posted: Tue Sep 27, 2011 4:55 pm
by canreo
Thanks for posting this wwr. That works great! I hope they add this to the core, I understand the need for tokens, but in the case of logging a user out, it shouldn't be an issue.

Re: Text Logout link Joomla 1.6

Posted: Fri Sep 30, 2011 3:55 pm
by plantpotphil
Thanks wwr, that works. This is one hell of a workaround for something which should sure be CORE though!

This used to be a quick fix in 1.5 with the url "index.php?option=com_user&task=logout&return=Lw"

Re: Text Logout link Joomla 1.6

Posted: Thu Oct 20, 2011 2:57 pm
by wildazzjw
Now there's an app for that. Seems to work fine.

Quick Logout:
http://extensions.joomla.org/extensions ... trol/17971

Re: Text Logout link Joomla 1.6

Posted: Tue Jan 17, 2012 11:06 pm
by oOTTOo
I created a Javascript function witch I added at the top of the component template:

<?php

$salir = JURI::base().'/index.php?option=com_users&task=user.logout&'. JUtility::getToken() .'=1';
//$salir = JRoute::_($this->baseurl.'/index.php?option=com_users&task=user.logout&'. JUtility::getToken() .'=1');

echo "<script language=\"JavaScript\">
function salir(){
location.href=\"$salir\";
self.focus();
}</script>";

?>

Then call with a external URL from the MENU:

javascript:salir();

;)

Re: Text Logout link Joomla 1.6

Posted: Wed Feb 01, 2012 6:23 pm
by iTD
wildazzjw wrote:Now there's an app for that. Seems to work fine.

Quick Logout:
http://extensions.joomla.org/extensions ... trol/17971
AHH! The final solution. Took less than one minute from reading this post to having it downloaded, installed and WORKING! Done - on with my life.

Re: Text Logout link Joomla 1.6

Posted: Thu Feb 02, 2012 2:49 am
by oOTTOo
iTD wrote:
wildazzjw wrote:Now there's an app for that. Seems to work fine.

Quick Logout:
http://extensions.joomla.org/extensions ... trol/17971
AHH! The final solution. Took less than one minute from reading this post to having it downloaded, installed and WORKING! Done - on with my life.
NICE :)

Re: Text Logout link Joomla 1.6

Posted: Thu Feb 02, 2012 3:03 pm
by lausianne
Did anyone get this to work on >= 1.7.3?

All that Quick Logout gives me is this error message:

Code: Select all

Fatal error: Cannot redeclare BannersParseRoute() (previously declared in [site]\components\com_quicklogout\router.php:40) in [site]\components\com_banners\router.php on line 70
Strangely, this refers to banners, which I don't use at all.

EDIT: Now I tried turning off the Banner module and all banners (none of which were displayed). Quick logout works. Good first step, but I will soon need banners, so I can't leave it like that ...

Re: Text Logout link Joomla 1.6

Posted: Thu Feb 02, 2012 3:07 pm
by jmuehleisen
Thanks for posting your error message.

I am the author of Quick Logout and will be glad to help you figure out what is happening here.

And, as you note, there is actually no code in quick logout that touches "BannersParseRoute" ... so that is a new one to me.

Send me a private message and we can work on this and try to sort it out. I'll be glad to help you fix this.

Re: Text Logout link Joomla 1.6

Posted: Fri Feb 03, 2012 3:31 pm
by oOTTOo
lausianne wrote:Did anyone get this to work on >= 1.7.3?
...
It's working OK for me. I have version 1.7.3...

Re: Text Logout link Joomla 1.6

Posted: Fri Feb 03, 2012 4:26 pm
by mzeedza
thank

Re: Text Logout link Joomla 1.6

Posted: Sat Mar 03, 2012 7:44 pm
by aburkenazio319
jmuehleisen wrote:Thanks for posting your error message.

I am the author of Quick Logout and will be glad to help you figure out what is happening here.

And, as you note, there is actually no code in quick logout that touches "BannersParseRoute" ... so that is a new one to me.

Send me a private message and we can work on this and try to sort it out. I'll be glad to help you fix this.
Hi jmuehleisen - were you able to resolve this issue? I am having the same problem - i.e. getting an error message similar to lausianne's when using Quick Logout with Joomla 1.7.3.

Re: Text Logout link Joomla 1.6

Posted: Sun Mar 04, 2012 5:16 pm
by jmuehleisen
were you able to resolve this issue?
I think so.

Try the attached version of the Quick Logout ... it has what (I hope) is the fix to this particular bug.

Actually, lausianne gave me the clue I needed, and I think this version should work better when banners are in use.

Give it a try and let me know how it goes. You should be able to install it right on top of the previous version.
com_quicklogout-1.7.1.zip

Re: Text Logout link Joomla 1.6

Posted: Fri Mar 16, 2012 1:44 am
by kinneyet
I'm using this link for Joomla 2.5:

href="index.php?option=com_users&task=user.logout&<?php echo JUtility::getToken(); ?>=1&return=<?php echo urlencode(base64_encode('REDIRECT PAGE HERE')); ?>"

Just replace the "REDIRECT PAGE HERE" with the page you want to redirect too. I use '/' to have it redirect to the home page.

Hope this helps someone.

Re: Text Logout link Joomla 1.6

Posted: Mon Feb 04, 2013 4:28 pm
by lee-da
kinneyet wrote:I'm using this link for Joomla 2.5:

href="index.php?option=com_users&task=user.logout&<?php echo JUtility::getToken(); ?>=1&return=<?php echo urlencode(base64_encode('REDIRECT PAGE HERE')); ?>"

Just replace the "REDIRECT PAGE HERE" with the page you want to redirect too. I use '/' to have it redirect to the home page.

Hope this helps someone.
Hey, thanks! This works like a charm. :D