Hey all,
I've edited my layout and all so the bottons that are on top are gone.
Now the only problem I have is that there's no logout botton.
Can someone please tell me how to make one?
I've tried to make a link that goes to http://(website).com/index.php?action=logout but then I get Session verification failed. Please try logging out and back in again, and then try again.
Please help.
Please read the Posting Guidelines.html (http://www.tinyportal.net/index.php/topic,581)
You get a session verification error because the session ID is passed in the URL when you logout. If you look at the logout button that you took out, you can see how the ID is passed into the URL.
Quote from: IchBinâ„¢ on January 22, 2009, 08:25:19 PM
You get a session verification error because the session ID is passed in the URL when you logout. If you look at the logout button that you took out, you can see how the ID is passed into the URL.
I kept trying that but I just cant work it out how it work.
What I want is a text hyperlink that logs you out when you click it in a PHP block but I cant get it. :(
Show me how you are passing the session id into the link in your code then, so I can show you whats wrong.
Quote from: IchBinâ„¢ on January 22, 2009, 09:08:17 PM
Show me how you are passing the session id into the link in your code then, so I can show you whats wrong.
<a href="(website).com/index.php?action=logout;sesc=session_id">Logout</a>
Thats the best I can get, I also tried too edit the normal logout PHP code but without luck.
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">Logout</a>
Be sure that you've included $scripturl and $context in your global command at the beginning of your code.
Quote from: Stroopy on January 22, 2009, 09:15:47 PM
Quote from: IchBinâ„¢ on January 22, 2009, 09:08:17 PM
Show me how you are passing the session id into the link in your code then, so I can show you whats wrong.
<a href="(website).com/index.php?action=logout;sesc=session_id">Logout</a>
Thats the best I can get, I also tried too edit the normal logout PHP code but without luck.
As you can see by Deni's code you were not including the actual session ID. The word session_id does not hold any value. If you hover your mouse over the link after using Deni's code you will see there is an actual ID number that is like 40 characters long that is necessary to login and logout.
Thanks Deni! :up:
:) I knew right where it was and happened to have an index.template.php file open on my computer. It was just a matter of doing a search for the text and copying it. :)
How can you do this using tpmenu link?
I've tried "index.php?action=logout;sesc=session_id" (no quotes), but I get "Session verification failed. Please try logging out and back in again, and then try again."
I can't use "', $scripturl, '?action=logout;sesc=', $context['session_id'], '" either, or I get mysql fits.
Any suggestions?
TinyPortal 1.0 beta 5-1
SMF 2.0 RC3
That's because SMF2's code has changed. You'll probably have to do something like this:
"', $scripturl,'?action=logout;', $context['session_var'] ,'=', $context['session_id'],'"
That's a no go. If I enter that via the menu manager I get "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''?action=logout;', $context['session_var'] ,'=', $context['session_id'],'"' WHER' at line 1".
I've even tried putting it in manually in mysql.. it goes in but the link does nothing but go to the main page.
The mouse over just comes up "http://mywebsite.com/index.php". No session info at all.
I'm guessing there's no way to do this within the tpmenu structure.
So are you trying to do it in the menu manager or a php block like the title of the topic says?
I ended up making a PHP article page with logout confirmation. Like this.
$logoutlink = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">[LOGOUT]</a>';
echo "<center><font size=3>Please confirm logout....<br>";
echo $logoutlink;
echo "</font></center>";
Then I made a link in menu manager to link to that article. But I would prefer to find a cleaner way of adding a logout link the menu manager menu. :crazy2:
Quote from: TankGirl on May 28, 2010, 01:35:56 AM
I ended up making a PHP article page with logout confirmation. Like this.
$logoutlink = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">[LOGOUT]</a>';
echo "<center><font size=3>Please confirm logout....<br>";
echo $logoutlink;
echo "</font></center>";
Then I made a link in menu manager to link to that article. But I would prefer to find a cleaner way of adding a logout link the menu manager menu. :crazy2:
You could just place that code into a php block, tested and seems to work fine on our test site!
Then I end up writing the whole damn nav block.. a dozen links that always change... the menu manager at least makes this easy and modular.
Oh and i have seperate nav blocks for guest and members.
Especially with articles.. just a drop menu boom link done... lol
I guess i'll just stick to my way until tinyportal decides to add logout option to menus...
Well there's no way to pass in any type of variables in the menu manager. Sorry.