How to force a user logout.

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
honestzed
Registered User
Posts: 57
Joined: Sun Dec 18, 2005 7:27 pm

How to force a user logout.

Post by honestzed »

I have a website in which I have users registered for access to different areas. I am using phpbb3's ucp for logging my members in.

This issue I am having with doing this though, is that if the member is already signed in on my site's phpbb3 forum, and then if they click "login" on my website, they are automatically directed to the forum page instead of the ucp login page.

If they are not logged into the forum, then everything works fine. They are sent to the ucp login page and then are returned to my webpage.

I'm not really sure how to fix this though, since it is just via a form where they are being redirected to the ucp.

i.e.:

Code: Select all

        <form method="post" action="../forum/phpBB3/ucp.php?mode=login">
            <input type="submit" value="Log In" name="login" />
            <input type="hidden" name="redirect" value="../../mypage.php" />
        </form>
Can someone please suggest a fix for this.
User avatar
bubbathegimp
Registered User
Posts: 172
Joined: Tue Sep 25, 2018 8:02 pm
Location: Off Plumb
Name: Bubba
Contact:

Re: How to force a user logout.

Post by bubbathegimp »

I dont understand why you want to force users to automatically be sent to the ucp. they have the option to go there in the forum menus, but if you want to force a logout you can go to general settings in the ACP and click on purge all sessions. but that will log everybody including you out....
If at first you don't succeed, Sky diving is not for you....
Ymmv
User avatar
Toxyy
Registered User
Posts: 811
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

Re: How to force a user logout.

Post by Toxyy »

honestzed wrote:
Thu Jun 18, 2020 3:48 am
I have a website in which I have users registered for access to different areas.
Can you explain this a bit further? Perhaps there's an alternative solution.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][BETA] Sticky Ad || [3.2][RC] Show User Activity ||
[3.2][DEV] User Delete Topics || [3.3][RC] Short Number Twig Extension
User avatar
david63
Registered User
Posts: 18572
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: How to force a user logout.

Post by david63 »

Have you tried turning off "Remember me" on your board? If I recall turning this off, in conjunction with a short session length, will log users out.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52169
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: How to force a user logout.

Post by Brf »

honestzed wrote:
Thu Jun 18, 2020 3:48 am
if the member is already signed in on my site's phpbb3 forum, and then if they click "login" on my website
Why would you make them click "login" if they are already logged in?
User avatar
Lumpy Burgertushie
Registered User
Posts: 68282
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: How to force a user logout.

Post by Lumpy Burgertushie »

I think the point is that if you have used the phpbb login system correctly on your website, there will not be a login link visible to anyone already logged in to your phpbb board and the same for if they are logged in to your website there will not be a visible login link on your board.

so, the problem you envision will not be there.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
honestzed
Registered User
Posts: 57
Joined: Sun Dec 18, 2005 7:27 pm

Re: How to force a user logout.

Post by honestzed »

I have re-worked my code a bit and I think I have a more logical flow now. I have also changed the session time out on my website to also match the same amount of time on my forum.

The next question I have now, is how can I force a logout? I want the user to click a Logout link and have it log the user out of the webpage, and also out of the forum.

Would this just be as simple as: $user->data['is_registered'] = null;

I'm not familiar with the inner workings of phpbb3, and I suspect I cannot change a phpbb3 variable in the way I have indicated above?
User avatar
Dr.Death
Registered User
Posts: 400
Joined: Fri Apr 25, 2003 10:04 am
Location: Germany
Contact:

Re: How to force a user logout.

Post by Dr.Death »

Code: Select all

 $user->session_kill();
Doc.
Post Reply

Return to “phpBB Custom Coding”