Anybody???
I could really use the help please!
xprofile_get_field_data( $field_name_or_id, $user_id );
Thanks Andy, I appreciate it. I can see it now…I will dig through the bp-xprofile.php to figure out the other functions.
Thanks for the great work!
Andy let me ask you….I am playing with the bp-facebook plugin you ported, and specifically trying to add a value to the insert function you have in there now
function bp_fbconnect_insert_data( $user_id, $usermeta )
///////I tried setting an extra value inside that function – statically for now (just for testing) right under the default “full name” insert you have in there now.
I set it up like this:
xprofile_set_field_data(‘Age’, $user_id, ‘Test’);
I have tried setting with double quotes, no quotes, and several different ways, but it never seems to insert into the “Age” field I created in Buddypress.
Any ideas whats going wrong here? I am wondering if this function isnt firing at the right time? OR maybe I am making a stupid mistake
Thoughts? Thanks
Okay….Andy is probably busy, I didnt mean to explicitly ask Andy (only) …if anyone has any advice on this I would appreciate it!
I’m attempting to do something kinda similar. I just want to create a block (pardon my Drupal lingo) that shows a blog’s author information in my theme. I want to specifically show their BP custom fields.
Right now I’ve copied over bp-sn-parent/profile/profile-loop.php to my theme and called: locate_template( array( 'profile/profile-loop.php' ), true )
but this gives me everything in the user’s profile. I would like to get a little more granular and just specify certain fields. hmmm
Here is my current example as it exists.
For some reason…no matter what I try, I can’t inject SPECIFIC variables via the xprofile_set_field_data function….I run this function (below)
ONLY AFTER running two conditionals to make sure
/////////
ONE the buddypress globals are set
and
TWO the check for the xprofile function passes
Both conditionals pass (as expected) then go to my test function below
////////
End result — The echo statement appears correctly…but nothing is appearing in the field values for the user – I am pulling my hair out??????
Sample
////////
function BP_Insert_Test($wpuid, $age) {
$age = ’22’; // Should appear in the profile
echo(‘user id is ‘ . $wpuid . ‘ and userdata is ‘ . $age);
xprofile_set_field_data(2, $wpuid, $age);
}
Any ideas?
Okay…I have more details from my testing. It works now, but I am not really sure WHY. It seems to me that you have to (for some reason) call the get_field_data function (even if its on a useless peice of data) before you can use the set_field_data function.
If you notice from my post above…the only thing that is different is that I have added a new variable that is simply capturing the Name field (number 1). Well when I add this:
$nametestfield = xprofile_get_field_data(1,$wpuid);
And then the set_field after it (with my age variable)…than it starts working, and the field is inputted.
SO….Is there a reason why you can’t call the set_field independently. Calling in the name is basicaly useless in the function above, but it DOES make the whole thing work for some reason.
///////////////////////////////
function BP_Insert_Test($wpuid, $age) {
$age = ‘tester gender’;
$nametestfield = xprofile_get_field_data(1,$wpuid);
echo(‘user name exists already’ . $wpuid . ‘ and userdata is ‘ . $age);
echo(‘Need Field is’ . $nametestfield);
xprofile_set_field_data(2, $wpuid, $age);
}
Anybody have ideas on the post/question above????
I’m also facing same issue.. even I added manually insert query inside code like this (I have stored the values in session)
$sql=”INSERT INTO wp_bp_xprofile_data (field_id, user_id, value) VALUES(1,$curr_id, ‘”.$_SESSION.”‘)”;
result=mysql_query($sql)or die(mysql_error());
This is storing the data in database but not retrieving
@shedmore did u got this fixed up ???