Override query arguments
-
Hi,
As the current plugin version, your code overrides the exclude argument of the members query. This is just a quick fix to operate on bpb-queries.php
I’ve updated the function so it won’t override and check the argument type as it supports String and Array./** * Adjust BP_User_Query * @since 1.0 * @version 1.0 */ function bpb_adjust_user_query( &$data ) { if ( !is_user_logged_in() ) return; $_list = bpb_get_blocked_users( get_current_user_id() ); update_option( 'catch_query_users_query', $_list ); if ( ! empty( $_list ) ) { $list = implode( ',', $_list ); if( empty( $data->query_vars_raw['exclude'] ) ) $data->query_vars_raw['exclude'] = $_list; else if( is_array( $data->query_vars_raw['exclude'] ) ) array_merge( $data->query_vars_raw['exclude'], $_list ); else $data->query_vars_raw['exclude'] .= ',' . $list; if( empty( $data->query_vars['exclude'] ) ) $data->query_vars['exclude'] = $_list; else if( is_array( $data->query_vars['exclude'] ) ) array_merge( $data->query_vars['exclude'], $_list ); else $data->query_var_raw['exclude'] .= ',' . $list; } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Override query arguments’ is closed to new replies.