How to put a value from the registration form into a function
-
I want to consistently run function xprofile_sync_wp_profile() during registration.
As it is the function takes fullname data from the database when the user is logged in, so it can not be run during registration.
For a plugin that does what I need I’d have to take the fullname name value straight from the registration form, so I would have to change this line in the xprofile_sync_wp_profile() function:
$fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $bp->loggedin_user->id );
What should I put after = to get the fullname value from the form?
I’ve studied the bp-xprofile-signup.php file, but in the code the fullname value is part of an array (?) identified by field_id, which I know is ‘1’ for fullname, but there I get lost, way too complicated php stuff for me. Something like this?!:
$fields = BP_XProfile_Field::get_signup_fields();
if ( $fields ) {
foreach ( $fields as $field ) {
$value = $_POST['field_' . $field->id];
$field->id = '1';
$fullname = $value;Please help if anyone can. If I can figure this out, I can probably solve several other problems I have been boring you with for the last few months.
- The topic ‘How to put a value from the registration form into a function’ is closed to new replies.