Text Logout link Joomla 1.6

General questions relating to Joomla! 2.5. Note: All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5. There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
spent85
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Thu Jan 27, 2011 6:51 pm

Text Logout link Joomla 1.6

Postby spent85 » Thu Jan 27, 2011 7:07 pm

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

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 21569
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Text Logout link Joomla 1.6

Postby Per Yngve Berg » Sun Jan 30, 2011 7:08 pm

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_With_Your_Joomla_Website

storm22
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Feb 11, 2011 4:10 pm

Re: Text Logout link Joomla 1.6

Postby storm22 » Fri Feb 11, 2011 4:22 pm

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!

User avatar
OOmNezar
Joomla! Ace
Joomla! Ace
Posts: 1870
Joined: Mon Sep 07, 2009 3:18 am

Re: Text Logout link Joomla 1.6

Postby OOmNezar » Fri Feb 11, 2011 4:32 pm

coffee & smoke just fine

OOm Nezar

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 21569
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Text Logout link Joomla 1.6

Postby Per Yngve Berg » Fri Feb 11, 2011 5:49 pm

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;
}

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7985
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: Text Logout link Joomla 1.6

Postby mcsmom » Fri Feb 11, 2011 6:25 pm

In 1.6 it is com_users with an s at the end.
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

Gistapulous
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Tue Mar 29, 2011 3:49 pm

Re: Text Logout link Joomla 1.6

Postby Gistapulous » Tue Mar 29, 2011 3:53 pm

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>

User avatar
Dondini
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Jan 29, 2009 9:39 pm

Re: Text Logout link Joomla 1.6

Postby Dondini » Mon Jun 06, 2011 6:50 pm

Thank you Gistapulous! exactly what I was looking for!

User avatar
red2678
Joomla! Explorer
Joomla! Explorer
Posts: 281
Joined: Tue Apr 15, 2008 5:18 pm
Location: Los Angeles, CA

Re: Text Logout link Joomla 1.6

Postby red2678 » Mon Jun 13, 2011 8:29 pm

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? :-[

darlintonp
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Mar 05, 2010 6:46 pm

Re: Text Logout link Joomla 1.6

Postby darlintonp » Thu Jun 16, 2011 12:39 pm

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.

User avatar
red2678
Joomla! Explorer
Joomla! Explorer
Posts: 281
Joined: Tue Apr 15, 2008 5:18 pm
Location: Los Angeles, CA

Re: Text Logout link Joomla 1.6

Postby red2678 » Thu Jun 16, 2011 1:54 pm

red2678 wrote:Is there any way to get that into a menu item? :-[

darlintonp
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Mar 05, 2010 6:46 pm

Re: Text Logout link Joomla 1.6

Postby darlintonp » Thu Jun 16, 2011 2:10 pm

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.

User avatar
red2678
Joomla! Explorer
Joomla! Explorer
Posts: 281
Joined: Tue Apr 15, 2008 5:18 pm
Location: Los Angeles, CA

Re: Text Logout link Joomla 1.6

Postby red2678 » Thu Jun 16, 2011 2:17 pm

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)

User avatar
carsten888
Joomla! Ace
Joomla! Ace
Posts: 1195
Joined: Sat Feb 11, 2006 8:32 am
Location: Tilburg, Holland
Contact:

Re: Text Logout link Joomla 1.6

Postby carsten888 » Fri Jun 17, 2011 3:33 pm

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.
http://www.pages-and-items.com
Admin-Help-Pages, Dynamic-Menu-Links, Admin-Menu-Manager, Access-Manager, Redirect-on-Login, Pages-and-Items, module Admin-Messages, module Logged-in-Users, plugin load module in article, plugin pure css tooltip and more...

wwr
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jul 28, 2011 12:46 pm

Re: Text Logout link Joomla 1.6

Postby wwr » Thu Jul 28, 2011 1:12 pm

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.

kathkeating
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Wed Feb 11, 2009 12:17 am
Location: Colorado
Contact:

Re: Text Logout link Joomla 1.6

Postby kathkeating » Wed Aug 03, 2011 3:55 pm

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.
Kathy Keating
CTO, www.tricalyx.com

canreo
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Thu Sep 15, 2005 3:20 pm

Re: Text Logout link Joomla 1.6

Postby canreo » Tue Sep 27, 2011 4:55 pm

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.

plantpotphil
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Fri Aug 19, 2011 12:05 pm
Contact:

Re: Text Logout link Joomla 1.6

Postby plantpotphil » Fri Sep 30, 2011 3:55 pm

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"
---
Clothier Jones - fine furniture handmade in England.

wildazzjw
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Oct 12, 2006 4:07 am

Re: Text Logout link Joomla 1.6

Postby wildazzjw » Thu Oct 20, 2011 2:57 pm

Now there's an app for that. Seems to work fine.

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

oOTTOo
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Wed Sep 30, 2009 10:17 pm

Re: Text Logout link Joomla 1.6

Postby oOTTOo » Tue Jan 17, 2012 11:06 pm

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();

;)
DB 5.5.8 utf8_general_ci
PHP 5.3.5
WEB SERVER Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
Joomla! Joomla! 1.7.3 Stable [ Ember ] 14-Nov-2011

User avatar
iTD
Joomla! Intern
Joomla! Intern
Posts: 73
Joined: Mon Aug 24, 2009 10:11 pm

Re: Text Logout link Joomla 1.6

Postby iTD » Wed Feb 01, 2012 6:23 pm

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.

oOTTOo
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Wed Sep 30, 2009 10:17 pm

Re: Text Logout link Joomla 1.6

Postby oOTTOo » Thu Feb 02, 2012 2:49 am

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 :)
DB 5.5.8 utf8_general_ci
PHP 5.3.5
WEB SERVER Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
Joomla! Joomla! 1.7.3 Stable [ Ember ] 14-Nov-2011

User avatar
lausianne
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 139
Joined: Thu Apr 06, 2006 3:15 pm

Re: Text Logout link Joomla 1.6

Postby lausianne » Thu Feb 02, 2012 3:03 pm

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 ...
Last edited by lausianne on Thu Feb 02, 2012 3:31 pm, edited 1 time in total.

User avatar
jmuehleisen
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4874
Joined: Thu Nov 09, 2006 2:46 pm
Location: Kampala, Uganda
Contact:

Re: Text Logout link Joomla 1.6

Postby jmuehleisen » Thu Feb 02, 2012 3:07 pm

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.
John Muehleisen
Visit my "Getting Started with Joomla" site, now with videos, tips, and new user tutorials:  http://welcometojoomla.com

oOTTOo
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Wed Sep 30, 2009 10:17 pm

Re: Text Logout link Joomla 1.6

Postby oOTTOo » Fri Feb 03, 2012 3:31 pm

lausianne wrote:Did anyone get this to work on >= 1.7.3?
...


It's working OK for me. I have version 1.7.3...
DB 5.5.8 utf8_general_ci
PHP 5.3.5
WEB SERVER Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
Joomla! Joomla! 1.7.3 Stable [ Ember ] 14-Nov-2011

mzeedza
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Feb 03, 2012 4:01 pm
Contact:

Re: Text Logout link Joomla 1.6

Postby mzeedza » Fri Feb 03, 2012 4:26 pm

thank

aburkenazio319
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat Mar 03, 2012 7:23 pm

Re: Text Logout link Joomla 1.6

Postby aburkenazio319 » Sat Mar 03, 2012 7:44 pm

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.

User avatar
jmuehleisen
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4874
Joined: Thu Nov 09, 2006 2:46 pm
Location: Kampala, Uganda
Contact:

Re: Text Logout link Joomla 1.6

Postby jmuehleisen » Sun Mar 04, 2012 5:16 pm

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
You do not have the required permissions to view the files attached to this post.
John Muehleisen
Visit my "Getting Started with Joomla" site, now with videos, tips, and new user tutorials:  http://welcometojoomla.com

kinneyet
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Wed Dec 23, 2009 8:56 pm

Re: Text Logout link Joomla 1.6

Postby kinneyet » Fri Mar 16, 2012 1:44 am

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.

lee-da
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Feb 01, 2012 3:10 pm

Re: Text Logout link Joomla 1.6

Postby lee-da » Mon Feb 04, 2013 4:28 pm

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


Return to “General Questions/New to Joomla! 2.5”

Who is online

Users browsing this forum: No registered users and 8 guests