Reply To: Setting up activated users with stored metadata
Still working on this, I discovered something while debugging:
1) If I set my priority to 1 like so:
add_action('bp_core_activated_user', array( $this, 'setup_registration_metadata'), 1 );
then in my setup_registration_metadata() function I use add_user_meta() to capture the first_name & last_name values at that point in time. Thankfully it makes an entry in the usermeta table with the expected value from get_user_meta($user_id, 'first_name', true)
2) Unfortunately, something else apparently is hooked afterwards (possibly a method from the “Enable BuddyPress to WordPress profile syncing”, which then overrides any value I had set for those fields so that in the end the WordPress fields are now incorrect or wiped.
It seems apparent to me that the “Enable BuddyPress to WordPress profile syncing” option is the culprit, but would that be a bug that the setting is grabbing the wrong values because even if I don’t hook into bp_core_activated_user the meta values that were successfully stored at registration are then wiped during activation? For example:
- first_name becomes the username
- last_name is cleared completely
Setting the priority to 20 the results show that by that point the originally stored meta_value(s) have already been wiped.