Skip to content

Instantly share code, notes, and snippets.

@cryptexvinci
Created August 8, 2025 07:17
Show Gist options
  • Select an option

  • Save cryptexvinci/66e5ec8d2d9038d24094ed9911119857 to your computer and use it in GitHub Desktop.

Select an option

Save cryptexvinci/66e5ec8d2d9038d24094ed9911119857 to your computer and use it in GitHub Desktop.
Show unapproved members in the member directory for all User Roles
<?php
/**
* Enable viewing of unapproved members in the member directory
*
* Hooks into the member directory query to temporarily allow all users
* to view unapproved members by modifying user permissions.
*/
function um_enable_view_unapproved_members() {
add_filter( 'um_user_permissions_filter', 'um_allow_edit_everyone_permission' );
}
/**
* Modify user permissions to allow viewing all members
*
* @param array $permissions Current user permissions
* @return array Modified permissions with 'can_edit_everyone' enabled
*/
function um_allow_edit_everyone_permission( $permissions ) {
$permissions['can_edit_everyone'] = true;
return $permissions;
}
// Hook into the member directory before query execution
add_action( 'um_member_directory_before_query', 'um_enable_view_unapproved_members' );
@vilelalban
Copy link

  1. Thanks for the code, but now I need UNREGISTERED users to also be able to view the member directory with active and inactive members.

  2. I also need to remove the EDIT PROFILE button (DELETE or DO NOT DISPLAY).

  3. Just as the INACTIVE MEMBER message appears for INACTIVE users, the ACTIVE MEMBER message also appears.

A reference image is attached

DELETE or DO NOT DISPLAY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment