Use this hook: xprofile_updated_profile
More info in /bp-xprofile/screens/edit.php ~Line 127
I tried this hook
function something_updated_profile( $userId, $posted_field_ids, $errors, $old_values, $new_values ) {
/*if ( empty( $errors ) ) {*/
print_r( $posted_field_ids );
echo “<br>user id: ” . $userId . “<br>”;
print_r( $new_values ); die;
/*}*/
}
add_action(‘xprofile_updated_profile’, ‘something_updated_profile’, 1, 3);
But on the update of general settings (new password / confirm password) it’s not printing anything
Please use the code
button when posting code.
…it’s not printing anything
That hook is found in a function that has a redirect after the hook, so you cannot dump to the screen.
Trying writing to a debug log or actually changing something with your function.
But more importantly – the settings code is not the same as the profile fields code.
I apologize for not noticing that you said general settings and not profile fields in your OP.
Try using this hook for Settings > General: bp_core_general_settings_after_save
Found in bp-settings/actions/general.php
Note that it does not pass any data – so you’ll need to get the data from $_POST
.
And the hook is followed by a redirect, so you cannot print to screen.
I think a good enhancement would be for this hook to pass some data: bp_core_general_settings_after_save
Currently, there is no way to tell if there were errors.
The same issue is found in the other files in bp-settings/actions/
You can open an enhancement ticket here.
Use the same login info you use for these forums.
Include a reference to this thread in the ticket description.
Hello Team,
I tried using this hook bp_core_general_settings_after_save
but in $_post
I also want current username as well.
is there any way to get the user id in template file when the user update his profile.