Tagged: buddypress, list, Member Types Pro, shortcode
- Allan Dorr on July 24, 2017 at 11:21 am #10032
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?
- Brajesh Singh on July 25, 2017 at 12:42 pm #10056
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?
- Allan Dorr on July 28, 2017 at 1:00 pm #10098
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?
- Brajesh Singh on July 28, 2017 at 4:27 pm #10103
No problem. I am glad it is working.
It will search for profile fields and the name.
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.
- Brajesh Singh on September 27, 2017 at 6:32 pm #10875
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.
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.
- Brajesh Singh on September 27, 2017 at 7:00 pm #10877
If you pass type=”newest” it will list the list ordered by user id in the reverse order.
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, 6 months ago by xmginc.
You must be logged in to reply to this topic.