Since: 1.6.0
Author: =undo= (info@wpxtre.me)
Inheritance: extends WP_Roles
Example #1
0
 /**
  * Create an instance of WPDKUserCapability class
  *
  * @brief Construct
  *
  * @param string $id          Unique id of capability
  * @param string $description Optional. Capability description
  * @param string $owner       Optional. Capability owner, who create this capabilty
  *
  * @return WPDKUserCapability
  */
 public function __construct($id, $description = '', $owner = '')
 {
     $this->id = $id;
     $this->description = $description;
     $this->owner = $owner;
     // Cap already exists ? Then get the data
     if (WPDKUserCapabilities::init()->capabilityExists($id)) {
         // Get extends data
         $extend_data = WPDKUserCapabilities::init()->get_extended_data($id);
         if (!empty($extend_data)) {
             list($id, $description, $owner) = $extend_data;
             // Population
             $this->description = $description;
             $this->owner = $owner;
         }
         // Get the users id list with this cap
         $this->users = WPDKUserCapabilities::init()->usersWithCaps($id);
         // Get the roles id list with this cap
         $this->roles = WPDKUserRoles::init()->rolesWithCaps($id);
     }
 }
Example #2
0
 /**
  * Used to invalidate static (internal singleton) and refresh all roles list
  *
  * @brief Invalidate
  *
  * @return WPDKUserRoles
  */
 public static function invalidate()
 {
     self::$instance = null;
     return self::get_instance();
 }