PDA

View Full Version : Creating a logout button in the header area


Exstedt
04-11-2009, 07:41 AM
Hi all,

I'm trying to create a logout button in my header navibar, mainly because my current style doesn't have one by the username/password area.

I'm new at this, and the only code I've tried to use was

<td><a href="login.php?do=logout&logouthash" accesskey="6"><img src="$stylevar[imgdir_misc]/log_off.gif" width="90" height="25" border="0"></a></td>

But when I press the button, I keep getting an error message (vbulletin message).

"An error occurred while attempting to log you out. Click here to log out."

When I proceed to click that link, I'm logged out just fine, but I'd rather not have everyone do that.

Any help on what code to use to allow people to log out would be appriciated.

Thank you,
regards
Yngve

--------------- Added 1239440235 at 1239440235 ---------------

I managed to make it with the use of the "similar threads" below :D

/close

--------------- Added 1239443961 at 1239443961 ---------------

/REOPENED

I spoke too soon. I'm now experiencing issues when i try to LOG IN to the forums. I type my information in, and press the Login button. I get the welcome message, and my nickname is visible on the Who's Online listing below, however I'm still just a Guest as if I didn't log in at all. The only way I've been able to log in and get control over my registered account is through the admin control panel.

The objective was to get a logout button working.

What I did
In the header code:

- ADDED
<!-- member logout button -->
<td align="$stylevar[right]">
<a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out('$vbphrase[sure_you_want_to_log_out]')"><img src="$stylevar[imgdir_misc]/log_off.gif"
border="0" width="90" height="25" alt="<phrase 1="$bbuserinfo[username]">$vbphrase[log_out_x]</phrase>"></a></td>
<!-- end member logout -->

In the FORUMHOME
-REMOVED
Everything between <!-- member logout -->

<!-- end member logout -->

Mainly because I thought the addition of the initial code could be in conflict with the latter.

I found these codes in the 'similar threads' below.

Many thanks for advice and help to fix my Login.

Regards,
Yngve

--------------- Added 1239461500 at 1239461500 ---------------

Is anyone able to help? Perhaps I'm not good enough at explaining what is happening.

Mr-Moo
04-11-2009, 03:05 PM
You are missing the IF commands and some other key user information. Please refer to my example below (which you can copy+paste into your template).


<if condition="$show['member']">
<td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out()">$vbphrase[log_out]</a></td>
</if>


Please let me know if this works,
Thank you