The Joomla! Forum ™



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.



Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Jan 27, 2011 7:07 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 27, 2011 6:51 pm
Posts: 10
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:
        <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


Top
 Profile  
 
PostPosted: Sun Jan 30, 2011 7:08 pm 
Joomla! Master
Joomla! Master

Joined: Mon Oct 27, 2008 9:27 pm
Posts: 18280
Location: Akershus, Norway
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


Top
 Profile  
 
PostPosted: Fri Feb 11, 2011 4:22 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Feb 11, 2011 4:10 pm
Posts: 1
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!


Top
 Profile  
 
PostPosted: Fri Feb 11, 2011 4:32 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Mon Sep 07, 2009 3:18 am
Posts: 1869
Try this :
http://docs.joomla.org/Customising_the_ ... orm_module
http://docs.joomla.org/Screen.menus.edi ... ink_-_User

_________________
coffee & smoke just fine

OOm Nezar


Top
 Profile  
 
PostPosted: Fri Feb 11, 2011 5:49 pm 
Joomla! Master
Joomla! Master

Joined: Mon Oct 27, 2008 9:27 pm
Posts: 18280
Location: Akershus, Norway
The logout button is styled by this in personal.css:

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


Top
 Profile  
 
PostPosted: Fri Feb 11, 2011 6:25 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 7986
Location: New York
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!.


Top
 Profile  
 
PostPosted: Tue Mar 29, 2011 3:53 pm 
Joomla! Intern
Joomla! Intern

Joined: Tue Mar 29, 2011 3:49 pm
Posts: 56
Man I've been struggling with this for two days - hope this solution helps someone else:

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


Top
 Profile  
 
PostPosted: Mon Jun 06, 2011 6:50 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 29, 2009 9:39 pm
Posts: 25
Thank you Gistapulous! exactly what I was looking for!


Top
 Profile  
 
PostPosted: Mon Jun 13, 2011 8:29 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Tue Apr 15, 2008 5:18 pm
Posts: 279
Location: Los Angeles, CA
Gistapulous wrote:
Man I've been struggling with this for two days - hope this solution helps someone else:

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


Top
 Profile  
 
PostPosted: Thu Jun 16, 2011 12:39 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Mar 05, 2010 6:46 pm
Posts: 3
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.


Top
 Profile  
 
PostPosted: Thu Jun 16, 2011 1:54 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Tue Apr 15, 2008 5:18 pm
Posts: 279
Location: Los Angeles, CA
red2678 wrote:
Is there any way to get that into a menu item? :-[


Top
 Profile  
 
PostPosted: Thu Jun 16, 2011 2:10 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Mar 05, 2010 6:46 pm
Posts: 3
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.


Top
 Profile  
 
PostPosted: Thu Jun 16, 2011 2:17 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Tue Apr 15, 2008 5:18 pm
Posts: 279
Location: Los Angeles, CA
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)


Top
 Profile  
 
PostPosted: Fri Jun 17, 2011 3:33 pm 
User avatar
Joomla! Ace
Joomla! Ace
Online

Joined: Sat Feb 11, 2006 8:32 am
Posts: 1155
Location: Tilburg, Holland
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:
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:
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:
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...


Top
 Profile  
 
PostPosted: Thu Jul 28, 2011 1:12 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Jul 28, 2011 12:46 pm
Posts: 2
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.


Top
 Profile  
 
PostPosted: Wed Aug 03, 2011 3:55 pm 
Joomla! Intern
Joomla! Intern

Joined: Wed Feb 11, 2009 12:17 am
Posts: 52
Location: Colorado
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


Top
 Profile  
 
PostPosted: Tue Sep 27, 2011 4:55 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Sep 15, 2005 3:20 pm
Posts: 10
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.


Top
 Profile  
 
PostPosted: Fri Sep 30, 2011 3:55 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 19, 2011 12:05 pm
Posts: 9
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.


Top
 Profile  
 
PostPosted: Thu Oct 20, 2011 2:57 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 12, 2006 4:07 am
Posts: 8
Now there's an app for that. Seems to work fine.

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


Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 11:06 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Sep 30, 2009 10:17 pm
Posts: 27
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


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 6:23 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Mon Aug 24, 2009 10:11 pm
Posts: 73
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.


Top
 Profile  
 
PostPosted: Thu Feb 02, 2012 2:49 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Sep 30, 2009 10:17 pm
Posts: 27
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


Top
 Profile  
 
PostPosted: Thu Feb 02, 2012 3:03 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Apr 06, 2006 3:15 pm
Posts: 114
Did anyone get this to work on >= 1.7.3?

All that Quick Logout gives me is this error message:

Code:
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.

Top
 Profile  
 
PostPosted: Thu Feb 02, 2012 3:07 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso

Joined: Thu Nov 09, 2006 2:46 pm
Posts: 4874
Location: Kampala, Uganda
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


Top
 Profile  
 
PostPosted: Fri Feb 03, 2012 3:31 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Sep 30, 2009 10:17 pm
Posts: 27
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


Top
 Profile  
 
PostPosted: Fri Feb 03, 2012 4:26 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Feb 03, 2012 4:01 pm
Posts: 1
thank


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 7:44 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Mar 03, 2012 7:23 pm
Posts: 1
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.


Top
 Profile  
 
PostPosted: Sun Mar 04, 2012 5:16 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso

Joined: Thu Nov 09, 2006 2:46 pm
Posts: 4874
Location: Kampala, Uganda
Quote:
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.

Attachment:
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


Top
 Profile  
 
PostPosted: Fri Mar 16, 2012 1:44 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Dec 23, 2009 8:56 pm
Posts: 12
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.


Top
 Profile  
 
PostPosted: Mon Feb 04, 2013 4:28 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Feb 01, 2012 3:10 pm
Posts: 3
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2  Next



Who is online

Users browsing this forum: No registered users and 41 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group