pmpro_check_admin_capabilities

The Paid Memberships Pro pmpro check admin capabilities function.

Description

pmpro_check_admin_capabilities(); 

Usage

  1. if ( !function_exists( 'pmpro_check_admin_capabilities' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/capabilities.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_check_admin_capabilities(); 
  7.  

Defined (1)

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

/includes/capabilities.php  
  1. function pmpro_check_admin_capabilities() 
  2. // Grab the defined (needed) admin capabilities 
  3. $roles = pmpro_get_capability_defs('administrator'); 
  4.  
  5. $caps_configured = true; 
  6.  
  7. // check whether the current user has those capabilities already 
  8. foreach( $roles as $r ) 
  9. $caps_configured = $caps_configured && current_user_can($r); 
  10.  
  11. // if not,setthe 
  12. if ( false === $caps_configured && current_user_can('administrator')) 
  13. pmpro_set_capabilities_for_role('administrator');