SHARE
TWEET

Untitled

a guest May 28th, 2017 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function wp4625_handleuserstates() {
  2.   if(is_user_logged_in())
  3.   {
  4.     if(current_user_can('administrator') || current_user_can('editor') || current_user_can('edit_posts'))
  5.     {
  6.       // The user is an Admin, Editor or other WP user with permission to edit pages
  7.     }  
  8.     else
  9.     {  
  10.       // get user status data from Eonet Manual User Approve plugin
  11.       $userapproved=get_user_meta( get_current_user_id(), 'eonet_mua_status' );
  12.  
  13.       if(is_array($userapproved))
  14.       {
  15.         if($userapproved[0]==1)
  16.         {
  17.           // an approved user
  18.         }
  19.         else if($userapproved[0]==0)
  20.         {
  21.           // a pending user - ensure they are logged out!
  22.           wp_logout();
  23.         }
  24.         else
  25.         {
  26.           // a disapproved user
  27.         }
  28.       }
  29.       else
  30.       {
  31.         // something unexpected happened
  32.       }
  33.     }
  34.   }
  35. }
  36. add_action('template_redirect', 'wp4625_handleuserstates');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top