Title: Option Request
Last modified: August 22, 2016

---

# Option Request

 *  Resolved [edwardboswell](https://wordpress.org/support/users/edwardboswell/)
 * (@edwardboswell)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/option-request-1/)
 * The plugin works fantastically. But I was wondering if there is a way to flash
   a message to the user as of why he/she got logged out.
 * I currently have a membership site. When they get logged out, they are redirected
   to the home page. I want the message to show that they are not allowed to share
   login info and they were logged out automatically due to this.
 * [https://wordpress.org/plugins/prevent-concurrent-logins/](https://wordpress.org/plugins/prevent-concurrent-logins/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Frankie Jarrett](https://wordpress.org/support/users/fjarrett/)
 * (@fjarrett)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/option-request-1/#post-5858452)
 * The Prevent Concurrent Logins plugin doesn’t handle redirections, so something
   else is hooking into WordPress and doing that.
 * By default, when a user tries to access the WP Admin, and their session is expired,
   WordPress will either send them to the login screen or if heartbeat catches it
   there will be a lightbox login with a special message that their session has 
   expired.
 * Example: [http://note.io/1M3HWKC](http://note.io/1M3HWKC)
 * It sounds like you may be requiring users to be logged in to view certain front-
   end content as well, which means there is probably a membership plugin of some
   kind on your site that is causing them to be redirected to your homepage.
 *  Thread Starter [edwardboswell](https://wordpress.org/support/users/edwardboswell/)
 * (@edwardboswell)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/option-request-1/#post-5858454)
 * Sorry, I didn’t clarify to well.
 * I do have a membership plugin, s2member, and some custom hooks for redirection
   as well.
 * I was just wondering if there was a way on the front end to send a message via
   Ajax to tell them why they got logged out. I have no problem modifying my theme,
   but was wondering if there was a way to hook into your plugin so I can output
   the message.
 * Thanks for the awesome and quick response!
 *  Thread Starter [edwardboswell](https://wordpress.org/support/users/edwardboswell/)
 * (@edwardboswell)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/option-request-1/#post-5858466)
 * Never Mind, I found a way through my membership plugin. I love your plugin, its
   very quick and easy to use.
 * Thank you for the help
 *  Plugin Author [Frankie Jarrett](https://wordpress.org/support/users/fjarrett/)
 * (@fjarrett)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/option-request-1/#post-5858469)
 * Hey Edward, no worries.
 * This plugin uses the `wp_destroy_other_sessions` function that was newly added
   in WP 4.1 to destroy a current user’s old sessions.
 * So I think what you are wanting to achieve is beyond the scope of what this plugin
   does – there is not a place to hook in.
 * The easiest way to do what you want is to modify s2member so the WP default behavior
   is used and users are sent to the `wp-login.php` page when their session is expired
   and they attempt to view a page designated for loggin-in users only.
 * When WP redirects to the login screen there is a query var called `reauth=1` 
   in the URL which indicates that the user needs to be reauthenticated, we can 
   assume this also means that WP knows they were previously authenticated but now
   for some reason they aren’t anymore. So then you can redirect wherever you want
   if that query var exists.
 *     ```
       function my_login_redirect_for_expired_sessions() {
       	if ( 1 != get_query_var( 'reauth' ) ) {
       		return;
       	}
   
       	wp_safe_redirect( home_url( '/my-custom-login-screen/' ) );
   
       	exit;
       }
       add_action( 'login_init', 'my_login_redirect_for_expired_sessions' );
       ```
   
 * The code above is untested, but this is the most support I can provide for this
   issue 🙂
 * Good luck!
 *  Plugin Author [Frankie Jarrett](https://wordpress.org/support/users/fjarrett/)
 * (@fjarrett)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/option-request-1/#post-5858473)
 * Thanks, Edward! I would greatly appreciate a short [five star review](https://wordpress.org/support/view/plugin-reviews/prevent-concurrent-logins#postform)!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Option Request’ is closed to new replies.

 * ![](https://ps.w.org/prevent-concurrent-logins/assets/icon-256x256.png?rev=1152517)
 * [Prevent Concurrent Logins](https://wordpress.org/plugins/prevent-concurrent-logins/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/prevent-concurrent-logins/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/prevent-concurrent-logins/)
 * [Active Topics](https://wordpress.org/support/plugin/prevent-concurrent-logins/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/prevent-concurrent-logins/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/prevent-concurrent-logins/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Frankie Jarrett](https://wordpress.org/support/users/fjarrett/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/option-request-1/#post-5858473)
 * Status: resolved