public function add_role($role, $display_name, $capabilities = array(), $description = '', $owner = '')
{
// Normalize caps
$caps = array();
foreach ($capabilities as $cap) {
$caps[$cap] = true;
}
// Ask to parent
$role_object = parent::add_role($role, $display_name, $caps);
// Stability
if (!is_null($role_object)) {
if (!isset($this->extend_data[$role])) {
$this->extend_data[$role] = array($display_name, $description, $owner);
}
update_option(self::OPTION_KEY, $this->extend_data);
/**
* Fires when a role is added.
*
* @since 1.6.0
*
* @param string $role The role key.
* @param array $extend The array with extend data for this role
*/
do_action('wpdk_user_roles_added_role', $role, $this->extend_data[$role]);
}
return $role_object;
}