Support » Plugin: Ultimate Member - User Profile & Membership Plugin » Any way to have Featured Member ability?

  • sanziam

    (@sanziam)


    Hi all.

    Wondering if anyone has found a way to “filter” a member directory by a particular meta key/value to only show those particular members ie I’ve made a form field called Featured Status (featured_status) that only the “admin” can see/edit with options like “Featured” and “Normal” etc.

    I now would like to create a Member Directory (Featured Members) that shows ONLY members with a Member Status of “Featured”. UM does not seem to be able to do this in the UI by default.

    Is there a filter/hook I can use to filter on this user meta key featured_status JUST for the Featured Members directory?

    Searched the docs and this forum with no luck.

    Thanks

    Sanz

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @sanziam,

    I’m afraid, it’s not possible in the current version of the plugin and would require customization of plugin files. If you need this customization I suggest hiring a developer for assistance.

    Regards.

    Hi @ultimatemembersupport … FYI I can confirm it IS possible and WITHOUT customisation of plugin files!

    I AM a developer and was really just asking the community if they have solved this issue so I don’t have to waste time reinventing the wheel if someone has already done it.

    It would have been handy if you had provided more than just the usual response of “not possible, go hire a developer”.

    You may have even mentioned something like “check out um-filters-members.php and look for um_prepare_user_query_args … that should put you on the right track!” … which would have saved everyone time.

    Anyway for those who might like to do something like only show Members with a particular custom user meta key/value, you can use the um_prepare_user_query_args filter found in um-filters-members.php. Something like the following for my particular use case:

    
    add_filter('um_prepare_user_query_args', 'um_modify_members_directory_query_featured_only', 121, 2);
    function um_modify_members_directory_query_featured_only( $query_args, $args ){
    	global $ultimatemember;
    	
    	extract( $args );
    	
    	if ( !is_user_logged_in() ) {
    		
    		$query_args['meta_query'][] = array(
    			'key' => 'featured_status',
    			'value' => 'Featured',
    			'compare' => '='
    		);
    		
    	}
    	
    	return $query_args;
    	
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.