![]() |
|
Thread Tools |
#1
|
||||
|
||||
Custom Logout Button
I want to create a custom logout button for my vB 5.3.3.
I'm using the following code from the core/vb/user.php file but it is not working. Can someone help me troubleshoot this code, please? Thank you
No members have liked this post.
|
#2
|
||||
|
||||
What do you think about the following method to logout users?
Is it OK or does it cause any issues or security concerns?
No members have liked this post.
|
#3
|
||||
|
||||
Use the official vBulletin API. /core/vb/api/user.php has a logout method.
I believe something like:
No members have liked this post.
|
#4
|
||||||||
|
||||||||
Thank you Dave for your helpful reply.
Here is the final and functioning code for others, if they need one:
One question, with the above code, the user is logged out then redirected to the forum home. My forum is installed in mydomain.com/forum. How can I redirect users after logout to mydomain.com? --------------- Added 03 Sep 2019 at 17:58 --------------- Maybe I should ask the question differently. Is it possible to execute the as a function or in the background, instead of redirecting to it as a URL?
The following members like this post: In Omnibus
Last edited by doc55; 03 Sep 2019 at 17:58. |
#5
|
||||
|
||||
Did you try to call the API user logout?
__________________
![]() No members have liked this post.
|
#6
|
||||||||
|
||||||||
Originally Posted by delicjous
Thank you for your reply. I did try the API, but I can't make it work. ![]()
Here is my code when I use the API:
With this, I get the following general error from vB: That action could not be completed. Please try again, and if this occurs again please contact the system administrator and tell them how you got this message. Maybe you could help me find what I'm doing wrong. Thanks again. No members have liked this post.
|
#7
|
|||
|
|||
Anyone could help with this script? I really appreciate anu help I can get.
No members have liked this post.
|
#8
|
|||
|
|||
I'm pretty sure you must put define('CSRF_PROTECTION', false); on top of the file.
No members have liked this post.
|
#9
|
||||||||||||
|
||||||||||||
Originally Posted by Dave
Thank you for your reply. ![]()
I tried adding this line on top:
I also tried this line on top:
Both are giving me the same error message and the user is not logged out. Here is the my final code so far:
No members have liked this post.
|
#10
|
||||
|
||||
Works fine if I do
instead. No members have liked this post.
|
#11
|
||||
|
||||
Originally Posted by Dave
Thank you Dave. With that change, The script redirects to the index.php as it is expected and I'm not getting any error messages, but the user is not logged out.
![]()
No members have liked this post.
|
#12
|
|||
|
|||
I used the same script on my vBulletin 5 test forum and it logged me out properly. Maybe try clearing your cookies > login again > try the script.
No members have liked this post.
|
#13
|
||||
|
||||
Thank you for your reply.
I just tested it again after clearing the cookies, but still didn't log out the user. Could this be because I have the option "Remember me" enabled on log-in? I did var_dump($logoutInfo); and this is what I got:
I'm not sure if this would help. No members have liked this post.
|
![]() |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Logout Button replacing Logout text | TheMusicMan | vBulletin 3.5 Template Modifications | 14 | 25 Dec 2007 19:33 |
Logout Button | Burning_Ice | vBulletin 2.x Template Modifications | 10 | 19 Aug 2002 19:13 |
Tags |
custom, logout, php |
«
Previous Thread
|
Next Thread
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|
New To Site? | Need Help? |
All times are GMT. The time now is 17:39.