Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Function/Call to access Custom Profile Fields?


shedmore
Participant

@shedmore

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);

}

Skip to toolbar