How to run xprofile_sync_wp_profile() on registration
Can anyone please tell me how to run xprofile_sync_wp_profile() on registration?
xprofile_sync_wp_profile() splits first_name and last_name from BP’s fullname registration field and stores them in WordPress’ standard usermeta table. That is tremendously useful, if you can count on that data being there.
I’ve tried putting the function in a plugin to run on user_register as action hook, but got a “cannot redeclare” error because the function is already in bp-xprofile-filters.php.
I’ve tried editing the add_action thingy in that file from xprofile_updated_profile to user_register, but it had no effect.
I can’t find any more documentation on how to use this function.
Any pointers very much appreciated!
Edit: As far as I understand this function now only kicks in when the user updates his profile:
add_action( 'xprofile_updated_profile', 'xprofile_sync_wp_profile' );
That could be never, so you can never count on that first_name, last_name data being there in wp_usermeta. In my case I need first_name, last_name “somewhere” for synchronisation with ListMessenger mailing list. There are many other scenarios where you’d need them.
Replacing xprofile_updated_profile with user_register did not work. Should I try other hooks? Which ones? Or am I on the wrong track? Does the ‘$bp->loggedin_user->id’ line make it impossible to run this function on registration? How about on first login? Is there a hook for that?
Also, if I can get this to work, it looks like a small step to include a few lines to autogenerate a username from the full name.
The topic ‘How to run xprofile_sync_wp_profile() on registration’ is closed to new replies.