ACF_Location_User_Role::match()
Matches the provided rule against the screen args returning a bool result.
Метод класса: ACF_Location_User_Role{}
Хуков нет.
Возвращает
true|false
.
Использование
$ACF_Location_User_Role = new ACF_Location_User_Role(); $ACF_Location_User_Role->match( $rule, $screen, $field_group );
- $rule(массив) (обязательный)
- The location rule.
- $screen(массив) (обязательный)
- The screen args.
- $field_group(массив) (обязательный)
- The field group settings.
Список изменений
С версии 5.9.0 | Введена. |
Код ACF_Location_User_Role::match() ACF Location User Role::match ACF 6.0.4
public function match( $rule, $screen, $field_group ) { // Check screen args. if ( isset( $screen['user_role'] ) ) { $user_role = $screen['user_role']; } elseif ( isset( $screen['user_id'] ) ) { $user_id = $screen['user_id']; $user_role = ''; // Determine $user_role from $user_id. if ( $user_id === 'new' ) { $user_role = get_option( 'default_role' ); // Check if user can, and if so, set the value allowing them to match. } elseif ( user_can( $user_id, $rule['value'] ) ) { $user_role = $rule['value']; } } else { return false; } // Compare rule against $user_role. return $this->compare_to_rule( $user_role, $rule ); }