• Resolved lbwbx

    (@lbwbx)


    I see no changes when applying this filter for example in my child theme functions.php

    function um_custom_prepare_user_query_args( $query_args, $directory_settings ) {
    
    	$query_args['exclude'] = array( 3, 4 );
    	return $query_args;
    }
    
    add_filter( 'um_prepare_user_query_args' ,"um_custom_prepare_user_query_args", 10, 2 );

    I still see users with ID 3 and 4 in the directory…I’ve also tried other query modifications and they don’t seem to do anything. Such as:

    add_filter( 'um_prepare_user_query_args' ,"um_custom_prepare_user_query_args", 999999999, 2 );
    function um_custom_prepare_user_query_args( $args, $directory_settings ) {
        $test_only_one_user = "[email protected]";
    
    	$args['meta_query'] = array(
            "relation" => "OR",
            array(
              'key' => 'user_email',
          'value' => serialize( $test_only_one_user ),
          'compare' => 'LIKE'
            ),
            array(
          'key' => 'user_email',
          'value' => $test_only_one_user,
          'compare' =>  '='
            )
          );
    
    	return $args;
    }

    still makes no difference.

    Any ideas how I can filter and exclude users programmatically (and globally) within the directory results?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @lbwbx

    Please clear the cache and test it. I tried the following codes and it seems to work fine on my end.

    add_filter( 'um_prepare_user_query_args' ,function( $query_args, $directory_settings  ){
    
    	$query_args['exclude'] = array ( 1, 7 );
    
    	return $query_args;
    
    }, 30, 2 );
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘um_prepare_user_query_args not working’ is closed to new replies.