Filter: um_change_role_data

apply_filters( 'um_change_role_data', $role_data, $role_id ) → {array}

Filters the Ultimate Member related user role data.

Parameters:
Name Type Description
$role_data array

Role data.

$role_id string

Role ID.

Since:
  • 2.0
Source:
Returns:

Role data.

Type
array
Example

Set {some_capability_key} capability for subscriber user role.

function my_change_role_data( $role_data, $role_id ) {
    // your code here
    if ( 'subscriber' === $role_id ) {
         $role_data['{some_capability_key}'] = true;
    }
    return $role_data;
}
add_filter( 'um_change_role_data', 'my_change_role_data', 10, 2 );