Page 1 of 1

Automatic logout of users?

PostPosted: November 26th, 2011, 7:32 am
by dapike
Is there a PHP function or something similar that I can embed into a webpage to automatically logout a user who views that page?

- David.

Re: Automatic logout of users?

PostPosted: November 28th, 2011, 2:03 am
by Cristián Lávaque

Re: Automatic logout of users?

PostPosted: November 28th, 2011, 7:50 am
by dapike
Thanks for the tip, but it doesn't seem to want to work on my site. I'm trying to block bogus/spam registrations that are somehow by-passing the s2member registration form and successfully registering without entering data in the mandatory registration fields. I can't seem to block these registrations directly, so I figured that I could at least try to not let them login, by embedding some PHP into the s2member Login Welcome Page that would check whether a required registration field is blank and if so then immediately perform a logout. What is actually happening when I do this is that several warnings are generated, complaining about headers that have already been sent (by the weaver theme it appears). I wouldn't much care about these warnings since they would only be seen by spammers, except that the user remains logged in.

- David.
- David.

Re: Automatic logout of users?

PostPosted: November 29th, 2011, 2:33 am
by Cristián Lávaque
Ah, I see your problem.

You could use the wp hook to check much earlier in the script, before headers were sent. http://adambrown.info/p/wp_hooks/hook/wp

I hope it helps. :)