Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am working on custom app for a client that requires some extra fields in the user's profile. I have successfully created a registration page that saves the custom fields and now I need to do the same for the "Edit Profile" page. The function that I used to save the custom fields on registration is generic enough that I think I can use it for the update too. I cannot find the right hook to make it work, though. I have tried "profile_update", "edit_user_profile_update", and "personal_options_update" with no luck. Is there something that I am missing here?

share|improve this question

closed as off-topic by ialocin, kaiser Aug 7 at 11:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

up vote 2 down vote accepted

After trudging through the BP source code today, I believe that I have finally figured this out. The hook used to update Profile Fields in BuddyPress is "xprofile_data_before_save". If anyone know of something better, please let me know!

share|improve this answer

You could also use the extended profiles function include in buddypress to create extra profile groups / fields.

Then you can all the groups into the register or edit page by just replacing the loop

<?php if ( function_exists( 'bp_has_profile' ) ) : if ( bp_has_profile( 'profile_group_id=1' ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

with:

<?php if ( function_exists( 'bp_has_profile' ) ) : if ( bp_has_profile() ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

With that you will display all profile groups in the register page. You can do the same with edit.php to display all fields in the edit profile page.

To make this work properly you know need to do a small tweak. You need to move the out of the loop and then save all the fields ids like this:

You also move this outside of the loop so it will look:

<?php endwhile; endif; endif; ?>
<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php echo implode(",",$fields_ids);?>" />
</form>

The last part is to be sure that all fields are saved into the database. Hope it helps, i used on edit.php but it should work the same on register.php

Regards

share|improve this answer
    
Yeah I looked at doing that but I could not get enough control over how the fields are laid out to do what I needed. Thanks! –  Joseph Sep 30 '11 at 18:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.