What does this mean “matches the page” ?
You need to know the field_id (numeric) of the profile field(s) you want to match.
Take a look at this:
https://buddypress.org/community/groups/creating-extending/forum/topic/search-member-profile-fields-by-url/
Matches the page e.g. extended profile value = research group, page name = research group.
Using the content in the link you provided, I’ve built a function that outputs a list of user ids exactly as I need it.
Can a list of members (based on user ids) be called using this line alone or is it necessary to code the entire loop into my shortcode?
‘return bp_has_members($get_these_members)’
You don’t need the entire loop – just the parts you want.
Using the members loop will be easier than building your own.
Hi Shane,
Everything is working nicely aside from the members loop. Basically, I’ve got a series of child pages. If the user’s profile info matches the child page permalink then they need to display. I had planned on using a shortcode to allow the site admin to display this members list wherever they wanted to but I’m having real trouble trying to insert the members loop into a shortcode. It causes other bits of the site to display incorrectly or brings the entire site down altogether.
Could I use an if statement to load the members loop at the end of post content on these pages? How would you go about it?
Thanks
John
>Could I use an if statement to load the members loop at the end of post content on these pages?
Probably.
You have a better chance of getting help if you use pastie or gist.github to show your code.
I’ve created a gist here:
https://gist.github.com/2888847
The problem, I suppose is more to do with WordPress shortcodes. I’m sure the members loop would work but I’m struggling to get it to load from within the confines of a shortcode.
I don’t see the members loop in your code.
I see this:
`$retval = “
Hi Shane,
The content there was just for testing purposes. CSS aside, it fell apart as soon as I tried to call any of the functions.
I ended up creating a custom action hook, calling it at the end of post content on all pages and then coding up a custom function (available in the now-updated gist) to cross-check the permalink slug with the user’s profile information.
It was pretty much a copy + paste job from there on out.
Thanks for your help!
I working on getting a list of members based on the fields they selected on the extended profiles fields in buddypress. Here is my code
{
global $wpdb;
$membership_group = “Orange Membership (30,000 Naira/Year)”;
$db_query = “SELECT user_id FROM wp_bp_xprofile_data WHERE field_id = 33 AND value = “” .$membership_group .”””;
$match_ids = $wpdb->get_var($db_query);
$get_these_members = ‘include=’ .$match_ids;
if (bp_has_members($get_these_members, ‘per_page optional=9’)) { ?> //Some Codes here
?>
}
The result is returning just the first member it gets from the query instead of a list of members. Please what i’m i doing wrong.
Thanks