roles ) ? true : false; $should_display_based_on_ids = array_intersect( $ids, (array) $user->ID ) ? true : false; $should_display = ( $should_display_based_on_roles || $should_display_based_on_ids ); return ( 'is' === $display_rule ) ? $should_display : ! $should_display; } /** * Checks user role for possible conflicts. * * @since 4.11.0 * * @param string $current_value Currently processing condition's conflicting value. * @param string $prev_value Previously processed condition's conflicting value. * @param array $conflicting_value Array of values containing the conflicting values as defined in $this->conflicts. * @param string $current_display_rule Currently processing condition's display rule Ex. is,isNot... * @param string $prev_display_rule Previously processed condition's display rule Ex. is,isNot... * @param array $conflicting_display_rule_vals Array of values containing the conflicting display rules as defined in $this->conflicts. * * @return boolean Conflict evaluation result. */ protected function _is_user_role_conflicted( $current_value, $prev_value, $conflicting_value, $current_display_rule, $prev_display_rule, $conflicting_display_rule_vals ) { $current_value = explode( '|', $current_value ); $prev_value = explode( '|', $prev_value ); $is_current_value_conflicted = ! empty( array_intersect( $current_value, $conflicting_value ) ); $is_prev_value_conflicted = ! empty( array_intersect( $prev_value, $conflicting_value ) ); $is_current_display_rule_conflicted = in_array( $current_display_rule, $conflicting_display_rule_vals, true ); $is_prev_display_rule_conflicted = in_array( $prev_display_rule, $conflicting_display_rule_vals, true ); if ( $is_current_value_conflicted && $is_prev_value_conflicted && $is_current_display_rule_conflicted && $is_prev_display_rule_conflicted ) { return true; } return false; } }