BuddyDev

Search

BuddyPress Member Types Pro – [bpmtp-members-list] shortcode

  • Participant
    Level: Initiated
    Posts: 10
    Allan Dorr on #10032

    Hi Brajesh,

    As I mentioned, since this is a new topic, I am starting a new thread.

    The shortcode [bpmtp-member-list] works great, also when I apply a member_type filter, and change the type to alphabetical…
    but, when I try to get a list of Users based on an x-profile field, like this:
    [bpmtp-members-list member_type=organizer type=alphabetical meta_key=Country meta_value=Germany]

    I get no users.

    I also tried:
    [bpmtp-members-list member_type=organizer type=alphabetical search-terms=Germany]

    Which shows me all users.

    Am I forgetting something?

    Thanks,
    Allan

  • Keymaster
    (BuddyDev Team)
    Posts: 22201
    Brajesh Singh on #10056

    Hi Allan,
    Thank you for asking.

    The first use will not work as you are using the meta query but you are not searching for meta query. BuddyPress profile field data is not stored in user meta.

    The second case will work if you change ‘search-terms’ to ‘search_terms’

    The currently supported options are:-(Example shows an array, you will use = instead of => in shortcode)

    
    
    			'type'                => 'active',
    			'page'                => 1,
    			'per_page'            => 20,
    			'max'                 => false,
    
    			'include'             => false,    // Pass a user_id or a list (comma-separated or array) of user_ids to only show these users.
    			'exclude'             => false,    // Pass a user_id or a list (comma-separated or array) of user_ids to exclude these users.
    
    			'user_id'             => false, // Pass a user_id to only show friends of this user.
    			'member_type'         => '',
    			'member_type__in'     => '',
    			'member_type__not_in' => '',
    			'search_terms'        => '',
    
    			'meta_key'            => false,    // Only return users with this usermeta.
    			'meta_value'          => false,    // Only return users where the usermeta value matches. Requires meta_key.
    
    

    Query based on profile field is possible using xprofile_query but it needs multi dimensional array(which is difficult to allow in the flat shortcode options).

    I will be looking at ways to improve it in future.

    Please try the ‘search_terms’ and let me know if it works or not?

  • Participant
    Level: Initiated
    Posts: 10
    Allan Dorr on #10098

    Hi Brajesh,

    Thanks! The ‘search_terms=Germany’, etc. seems work, so I’ll use that for now. Oh man, I can’t believe I overlooked that the “-” should be a “_”.

    Will this search for Germany everywhere, or just profile fields?

    Thanks,
    Allan

  • Keymaster
    (BuddyDev Team)
    Posts: 22201
    Brajesh Singh on #10103

    Hi Allan,
    No problem. I am glad it is working.

    It will search for profile fields and the name.

  • Participant
    Level: Enlightened
    Posts: 24
    xmginc on #10863

    Hi Brajesh,

    Could there be a way to add values into the shortcode to manually order the directory?

    For example, perhaps order alphanumerically based on an xprofile value?

    My hope is to manually order a directory for managers based on their seniority – not alphabetically.

    Thanks!
    Kuni

  • Keymaster
    (BuddyDev Team)
    Posts: 22201
    Brajesh Singh on #10875

    Hi Kuni,
    The member type shortcode supports only the order by filter supported by BuddyPress.

    BuddyPress does not support ordering by xprofile yet. So, It is almost not feasible for now to do it.

  • Participant
    Level: Enlightened
    Posts: 24
    xmginc on #10876

    Thanks for letting me know Brajesh. Good to know before I spend too much time on this 😄

    It’s too bad there is no way to manually order the members yet in Buddypress…

    Just an idea for future: I wish there was a way to use the user_id method but somehow pause and restart the loop between each id so that you can manually sort them by user_id number such as id 5, then id 3, then id 10 etc.

    Aside from that, thanks again for an invaluable plugin. Love it.

  • Keymaster
    (BuddyDev Team)
    Posts: 22201
    Brajesh Singh on #10877

    Hi Kuni,
    Thank you.

    If you pass type=”newest” it will list the list ordered by user id in the reverse order.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 24
    xmginc on #10878

    That’s great to know thanks Brajesh!

    Due to the nature of this particular directory which needs to be manually ordered, I’ve used the following method:

    – used [bpmtp-members-list include=”…”] shortcode and inserted a single ID in the quotes
    – repeated the shortcode for each member ID [bpmtp-members-list include=”10″][bpmtp-members-list include=”24″][bpmtp-members-list include=”17″] etc.
    – used CSS to hide #pag-bottom and float and style each member as needed
    – in this particular scenario, I am using a theme framework to create each member in their own columns

    So far, so good for the time being 😄

    • This reply was modified 5 years, 2 months ago by xmginc.

You must be logged in to reply to this topic.

This topic is: not resolved