Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Search Query and MySQL help


Steven Word
Participant

@stevenkword

I came across this post today while researching using a similar method and I have found a work-around that is functional.
It’s not uber-elegant, but it is functional. Here is how to do it.

1.) Create a function that will update the wp-user usermeta to be the same as that of the xprofile.
2.) Create a hook to update the wp-usermeta with the xprofile data everytime the profile is updated.
3.) User the standard metakey / metavalue functions to pull the data back out.

Here is a code sample that can go in functions.php in your theme:

function copyUserMeta(){
global $current_user;
get_currentuserinfo();
$user_id = $current_user->ID;

$gender= xprofile_get_field_data( “Gender” ,$user_id);
update_usermeta( $user_id, ‘gender’,$gender);

$location = xprofile_get_field_data( “Location” ,$user_id);
update_usermeta( $user_id, ‘location’,$location);
}
add_action( ‘bp_before_profile_edit_content’, ‘copyUserMeta’ );

Then when you need to look up those values you can query using the standard user_meta calls.

Skip to toolbar