public static function get_instance($lib)
 {
     if (self::$instance === null) {
         self::$instance = new URE_Role_Additional_Options($lib);
     }
     return self::$instance;
 }
 public function set_role_additional_options_hooks()
 {
     $role_additional_options = URE_Role_Additional_Options::get_instance($this->lib);
     $role_additional_options->set_active_items_hooks();
 }
Пример #3
0
 protected function save_roles()
 {
     global $wpdb;
     if (!$this->last_check_before_update()) {
         return false;
     }
     if (!isset($this->roles[$this->current_role])) {
         return false;
     }
     $this->capabilities_to_save = $this->remove_caps_not_allowed_for_single_admin($this->capabilities_to_save);
     $this->roles[$this->current_role]['capabilities'] = $this->capabilities_to_save;
     $option_name = $wpdb->prefix . 'user_roles';
     update_option($option_name, $this->roles);
     // save additional options for the current role
     if (empty($this->role_additional_options)) {
         $this->role_additional_options = URE_Role_Additional_Options::get_instance($this);
     }
     $this->role_additional_options->save($this->current_role);
     return true;
 }