• I don’t believe the previous filters work any more, so how does one go about completely excluding the current user from the directory?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @hshah

    You can still use this filter hook to exclude a specific user from the User Query:

    um_prepare_user_query_args

    add_filter("um_prepare_user_query_args","um_custom_exclude_current_user", 10, 1 );
    function um_custom_exclude_current_user( $args ){
          $args['exclude'] = array( 123, 333, 99, 5 ); // exclude users by user ID
     return $args;
    }

    Regards,

    Thread Starter hshah

    (@hshah)

    @champsupertramp

    I have tried that and numerous other things before creating this thread.

    Just to reconfirm, I just put what you posted into my functions.php and added some error_log lines so that I could see what was going on when I loaded the members directory page. This is on a staging site so all caching etc is disabled.

    The log file was empty… the function wasn’t even invoked.

    /Edit: Even tried a search and still it was empty. Just to make sure the logging wasn’t broken in any way, I intentionally broke the function, and that wrote to the log file.

    Others have mentioned that this stopped working when the directory was updated to use ajax etc. I can definitely tell you it doesn’t work lol!

    • This reply was modified 6 years, 2 months ago by hshah.
    Thread Starter hshah

    (@hshah)

    @champsupertramp

    Any comment with something that actually works?

    Thread Starter hshah

    (@hshah)

    @champsupertramp

    Anyone around? lol 🙂

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

The topic ‘Directory – Excluding Users’ is closed to new replies.