Skip to content

Instantly share code, notes, and snippets.

@toluaddy
Forked from rolandinsh/gist:5941257
Created February 3, 2020 11:53
Show Gist options
  • Select an option

  • Save toluaddy/77ca4c23ff1c60d0f2e6f31ed4beb1c2 to your computer and use it in GitHub Desktop.

Select an option

Save toluaddy/77ca4c23ff1c60d0f2e6f31ed4beb1c2 to your computer and use it in GitHub Desktop.
update BuddyPress xprofile programmatically
<?php
function smc_update_xprofile($userid,$field,$value) {
// alternative to get user ID
// global $current_user;
// get_currentuserinfo();
// $field = 'Foo'; // xProfile field name
// $value = 'bar'; // desired value
// xprofile_set_field_data($field, $current_user->id, $value);
xprofile_set_field_data($field, $userid, $value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment