WordPress and buddypress programming

Automatically Log Out idle users

Viewing 0 reply threads
  • Author
    Posts
    • #3763
      michael mc
      Keymaster
      @michael
      if(empty($id)){
             wp_logout();
          }
      
      In your function.php file, paste the following code:
        add_action('wp_logout','go_home');
          function go_home(){
            wp_redirect( '/wp-login.php?action=logout&custom-logout=yes' );
            exit();
          }
      
          //If the custom parameter is set display the message on the login screen
          if(!empty($_GET['custom-logout']) && strtolower($_GET['custom-logout']) == "yes"){
           function custom_login_message() {
               $message = '<p class="message">Add your message here...</p><br />';
               return $message;
           }
           add_filter('login_message', 'custom_login_message');
          }
Viewing 0 reply threads
  • You must be logged in to reply to this topic.