pmpro_isAdmin

The Paid Memberships Pro pmpro isAdmin function.

Description

pmpro_isAdmin( (constant) $user_id = NULL ); 

Parameters (1)

0. $user_id — Optional. (constant) => NULL
The user id.

Usage

  1. if ( !function_exists( 'pmpro_isAdmin' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/functions.php'; 
  3.  
  4. // The user id. 
  5. $user_id = NULL; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = pmpro_isAdmin($user_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/functions.php  
  1. function pmpro_isAdmin($user_id = NULL) 
  2. global $current_user, $wpdb; 
  3. if(!$user_id) 
  4. $user_id = $current_user->ID; 
  5.  
  6. if(!$user_id) 
  7. return false; 
  8.  
  9. $admincap = user_can($user_id, "manage_options"); 
  10. if($admincap) 
  11. return true; 
  12. else 
  13. return false;