Title: Display Users with Same Custom Field
Last modified: January 5, 2023

---

# Display Users with Same Custom Field

 *  Resolved [Michael Thena](https://wordpress.org/support/users/iscomputerman/)
 * (@iscomputerman)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/display-users-with-same-custom-field/)
 * I have over 300 users from different organizations. When a user logs into the
   site, I would like to display a list of other users from that same organization
   on the homepage. I use custom fields in the WP user profile to store their organization
   name. I know a plugin for online users exist, but this is just listing those 
   that belong to the same organization.

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

 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/display-users-with-same-custom-field/#post-16345967)
 * [@iscomputerman](https://wordpress.org/support/users/iscomputerman/)
 * > I know a plugin for online users exist
 * You can use the “UM Online” plugin and add your selection of organization to 
   the plugin widget template `.../plugins/um-online/templates/online.php` as a 
   customization like the user role selection.
 *     ```
       foreach ( $online as $user => $last_seen ) {
   
       	um_fetch_user( $user );
   
       	$user_meta = get_userdata( $user );
       	$user_roles = $user_meta->roles;
       	if ( $roles != 'all' && count( array_intersect( $user_roles, explode( ',', $roles ) ) ) <= 0 ) {
       		continue;
       	}
   
       	// Add your organization customization here
   
       	$name = um_user( 'display_name' );
       	if ( empty( $name ) ) {
       		continue;
       	} ?>
       ```
   
    -  This reply was modified 3 years, 5 months ago by [missveronica](https://wordpress.org/support/users/missveronicatv/).
 *  Plugin Support [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * (@andrewshu)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/display-users-with-same-custom-field/#post-16361583)
 * Hi [@iscomputerman](https://wordpress.org/support/users/iscomputerman/)
 * 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 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 ‘Display Users with Same Custom Field’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/display-users-with-same-custom-field/#post-16361583)
 * Status: resolved