The members mrh compare role function.
Published Date - July 31, 2023
Function for comparing roles by their position.
mrh_compare_role( $role_a, $role_b, $operator );
$role_a
$role_b
$operator
The following example is for adding a hook callback.
if ( !function_exists( 'mrh_compare_role' ) ) {
require_once ABSPATH . PLUGINDIR . 'membersmembers/addons/members-role-hierarchy/inc/functions-position.php';
}
// The input(s).
$role_a = null;
$role_b = null;
$operator = '==';
// NOTICE! Understand what this does before running.
$result = mrh_compare_role( $role_a, $role_b, $operator );
The function is defined in the following location(s).
members/addons/members-role-hierarchy/inc/functions-position.php
function mrh_compare_role( $role_a, $role_b, $operator = '==' ) {
$pos_a = mrh_get_role_position( $role_a );
$pos_b = mrh_get_role_position( $role_b );
return mrh_compare( $pos_a, $pos_b, $operator );
}