Title: Single session
Last modified: August 16, 2017

---

# Single session

 *  Resolved [Phil](https://wordpress.org/support/users/magicfilou/)
 * (@magicfilou)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/single-session/)
 * Hi!
 * There is an option in your plugin to limit to one session BY USER (IP AND Browser)?
 * I need to limit each user to be logged in only once by ip or/and browser.
 * If the user is already logged in on other browser and/or IP he receive a message
   like : You are already connected in other browser or with another IP. Please 
   logout before start a new session 🙂
 * ??? 🙂
    thanks in advance Best

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

 *  [pronl](https://wordpress.org/support/users/pronl/)
 * (@pronl)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/single-session/#post-9415641)
 * [@magicfilou](https://wordpress.org/support/users/magicfilou/)
 * No, the free plugin does not include that option.
 * iThemes Security **Pro** also does not include the option you described but it
   does include a module named **User Security Check** that will allow you to see
   sessions of who’s logged in — and be able to log them out instantly, everywhere.
   Not exactly what you are looking for but it does give you some session control.
 * For more info about the **User Security Check** module read the article below:
 * [New WordPress User Security Check Helps You Review, Take Action on User Security](https://ithemes.com/2016/08/09/wordpress-user-security-check-ithemes-security-pro/)
 *  Thread Starter [Phil](https://wordpress.org/support/users/magicfilou/)
 * (@magicfilou)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/single-session/#post-9415947)
 * ok thank you for your quick answer but I really need to block the possibility
   for users to have several session open at the same time automaticaly.
    -  This reply was modified 8 years, 9 months ago by [Phil](https://wordpress.org/support/users/magicfilou/).
 *  [pronl](https://wordpress.org/support/users/pronl/)
 * (@pronl)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/single-session/#post-9417678)
 * [@magicfilou](https://wordpress.org/support/users/magicfilou/)
 * Try and add this code to your active theme functions.php file:
 *     ```
       add_filter( 'authenticate', 'one_session_per_user', 30, 3 );
   
       function one_session_per_user( $user, $username, $password ) {
       	if ( is_wp_error( $user ) ) {
       		return $user;
       	}
   
       	$sessions = WP_Session_Tokens::get_instance( $user->ID );
       	$all_sessions = $sessions->get_all();
       	if ( count( $all_sessions ) ) {
       		$user = new WP_Error( 'already_signed_in', __( '<strong>ERROR</strong>: User already logged in.' ) );
       	}
   
       	return $user;
       }
       ```
   
 * Tested, and seems to work but use it at your own risk.
 *  Thread Starter [Phil](https://wordpress.org/support/users/magicfilou/)
 * (@magicfilou)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/single-session/#post-9418847)
 * Thank you 🙂 Seems to work yes 🙂
 * little modification for WPML compatibility :
 * add_filter( ‘authenticate’, ‘one_session_per_user’, 30, 3 );
 * function one_session_per_user( $user, $username, $password ) {
    if ( is_wp_error(
   $user ) ) { return $user; }
 *  $sessions = WP_Session_Tokens::get_instance( $user->ID );
    $all_sessions = $
   sessions->get_all(); if ( count( $all_sessions ) ) { $user = new WP_Error( ‘already_signed_in’,
   __( ‘**ERROR**: User already logged in.’,’login_limit’ ) ); }
 *  return $user;
    }
 * thanks again (y)

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

The topic ‘Single session’ is closed to new replies.

 * ![](https://ps.w.org/better-wp-security/assets/icon.svg?rev=3529351)
 * [Kadence Security – Password, Two Factor Authentication, and Brute Force Protection](https://wordpress.org/plugins/better-wp-security/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/better-wp-security/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/better-wp-security/)
 * [Active Topics](https://wordpress.org/support/plugin/better-wp-security/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/better-wp-security/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/better-wp-security/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Phil](https://wordpress.org/support/users/magicfilou/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/single-session/#post-9418847)
 * Status: resolved