Forum Replies Created
-
I am using BP_User_Query and BP_Xprofile_Queury with the following code and it worked for me now.
$xprofile_query = array( 'relation' => 'OR'); foreach ($my_items as $key => $value) { $xprofile_query[] = array( 'key'=> $fieldID, 'value' => $value, 'compare' => 'LIKE' ); } $args = array( 'member_type' => 'donor', ); if ($xprofile_query){ $args['xprofile_query'] = $xprofile_query; } $user_query = new BP_User_Query( $args );
Thank you.
Thank you so much @shanebp.
But I am a little bit worried as this may bring up the results for the items named – “tested”, “pre-test”, “untest”, “not tested”, etc. if I try to filter the items named only “test”.
Any suggestions?
Regards.
Sure no problem. So here is my scenario.
There are 2 member types and I have a custom user field created, let’s called it Items.
Both member types need to select some of those Item checkboxes. Now I need to show the oposite member types with common Items on a member profile. For that I created a custom page and run the Members loop. I was able to show the oposite members. But I am not sure how to match the Items and filter those oposite members. The
my_custom_id()
function works well if it is a textbox field. But it doesn’t work with the checkboxes. You can see how they are stored in the database.I can get the current logged in user’s Items list in an array format. I think if I follow the
my_custom_id()
function then I will have to pass the field name and the array to compare like thismy_custom_id($item_field, $current_user_items_array)
I think with that the SQL select query in the function needs to be modified.
Hope this clarifies my requirement.
I am very new to buddypress. If there is another way to achieve this then I will be happy to implement. My main goal is to show the members with common items selected but from the opposite member type to a logged in member.
Thank you so much.