I found the issue on this one – If you have a better suggestion, please let me know
In my functions.php it seems I am interrupting the “saving” process by forcing a redirect
Below is a small snippet of what I was doing
add_action("um_after_user_updated","um_custom_after_user_updated", 10, 3 );
function um_custom_after_user_updated( $user_id, $args, $to_update ){
if( empty( $user_id ) ) {
$user_id = get_current_user_id();
}
$rolename = UM()->roles()->get_priority_user_role( $user_id );
$userdata = get_userdata( $user_id );
switch( $rolename ) {
case 'partner_pending':
// do other stuff on DB
// do other stuff on DB
header("Location: https://<mySite>/<userRole>/");
exit();
break;
default:
break;
}
}
When I comment out the “exit();” everything works just fine
I also have a hook into um_after_member_role_upgrade
and when I remove “exit();” it seems that both of these custom functions runs, which leads me to believe that I only need to hook into um_after_member_role_upgrade OR um_after_user_updated to have some custom actions after profile saved is clicked … is that right?
— Some context —
Currently I have a user registering as “Role A” which requires email validation.
From there I use the profile completeness plugin to auto update the user to “Role B” once a profile is complete. I then use the um_after_member_role_upgrade hook to set the profile back to “awaiting_admin_review” (this also logs the user out until review is passed). The goal here is to have admins review the profile before the user becomes “fully active” on the site as “Role B”
Is there maybe a better way to achieve this with UM, or a better way to do the redirect after profile change without interrupting the saving process?
-
This reply was modified 3 years, 8 months ago by pantoeflou. Reason: more detail on process
-
This reply was modified 3 years, 8 months ago by pantoeflou.
-
This reply was modified 3 years, 8 months ago by pantoeflou.