I’ve decided to create a hidden xprofile field to store this data, but using xprofile_set_field_data only seems to work temporarily, after several minutes, the entire row containing the data disappears from wp_bp_xprofile_data. How can I make this permanent?
add_action( 'bp_setup_nav', 'write_path' );
function write_path() {
global $bp;
global $current_user;
$avatar_path = bp_core_fetch_avatar('html=false');
xprofile_set_field_data('path', $current_user->ID, $avatar_path);
}
So this is a very hacky way i’m doing it. I noticed using xprofile_set_field_data to set the data for an extended profile field only works temporarily. However, overwriting an existing default profile field (i.e. Facebook, Snapchat) seems to stay permanently.
xprofile_set_field_data('Snapchat', $current_user->ID, $avatar_path);
So as admin, I went in and changed the name of the default profile field to my desired one (i.e. Snapchat -> path) and applied
add_filter( 'xprofile_updated_profile', 'update_xprof' );
function update_xprof() {
$path=bp_core_fetch_avatar();
xprofile_set_field_data('path', $current_user->ID, $path);
}
This way works more or less. However, I noticed that the function only kicks in when the user literally clicks ‘Edit’ and changes the data in her/his profile from the front end.
This function does not kick in whenever the user changes his/her avatar. I tried to use
xprofile_avatar_uploaded
in place of xprofile_updated_profile
, but with it, the function doesn’t seem to work at all. Can someone comment on why?
To avoid this situation, take a copy of the Avatars directory when upgrading JIRA and place this into the avatars directory of the JIRA Home Before upgrading JIRA to a JIRA 6+ environment Myloweslife
overwriting an existing default profile field (i.e. Facebook, Snapchat) seems to stay permanently., I noticed that the function only kicks in when the user literally clicks ‘Edit’ and changes the data in her/his profile from the front end.