Pinned Profiles in Member Directory

-
um-numbah-wan

Just another Ultimate Member tips for your site – a road to a powerful membership website!

If you want to make specific profiles show at the very first results as pinned profiles in Member Directory, you can try this approach in 3 easy steps!

  1. Add the following code snippets to your Theme’s function.php file or via Code Snippet plugin.
add_filter("um_prepare_user_query_args","um_custom_prepare_user_query_args", 9999 );
function um_custom_prepare_user_query_args( $args ) {
	
	$args['meta_query'][ ] = array(
			'relation' => 'OR',
		   	'featured_clause' => array(
				'key' => 'is_featured',
				'value' => '1',
				'compare' => '='
		   	),
		   	array(
				"key" => 'is_featured',
				"compare" => "NOT EXISTS"
		   	)
	);

	$args['orderby'] = array(
		'featured_clause' => 'ASC',
		
	); 

	return $args;
}

2. Add a new Dropdown field and enter the Meta Key is_featured in the Profile Form via UM Form Builder. Set the field Privacy to Administrator role so that only Admins can make the changes to this field when editing a Profile in front-end. Dropdown choices should be 1 and 0.

3. Try editing a profile and set the Is Featured profile to 1. Hit on Update to save the changes made to the profile.

And the profile should show up in the Member Directory as first featured profile!


Let me know if this works for you! Leave some good vibes in the comment and don’t forget to subscribe to my newsletter to get weekly WordPress & Ultimate Member tips for your site!

Subscribe to my newsletter!

Help me reach other people who need the help

2 Comments Pinned Profiles in Member Directory

    1. Hi Swapnil, Have you tried adding a profile size in the Upload settings? Please go to WP Admin > Ultimate Member > Settings > General > Uploads?

Leave a Reply

Your email address will not be published. Required fields are marked *