Forum Replies Created
-
AuthorPosts
-
SoWeBuildMember
Sorry for the bump, but thanks a lot for implementing the form parameter – this solved it using a simple switch statement.
add_action( ‘user_meta_after_user_update’, ‘profile_update_redirect’, 10, 2 );
function profile_update_redirect( $response, $form ){global $userMeta;
switch($form){
case ‘Profiel Contact’:
echo $userMeta->jsRedirect( ‘http://link1.com’ );
break;case ‘Profiel Account’:
echo $userMeta->jsRedirect( ‘http://link2.com’ );
break;default:
echo $userMeta->jsRedirect( ‘http://example.com’ );
break;
}
}SoWeBuildMemberHi Robert,
You have to make sure the form is a registration form – not a profile form. I had that same issue but setting it to registration made the form appear and behave correctly, albeit I needed it to be a profile form.
Setting redirection can be done in the Registration options for User Meta Pro – i.e. you create a form for a certain role, you select the option “Referer” in the registration referral menu.
FYI, I am also still awaiting the solution for this. I think my snippet of code should work with a bit of input from Khaled.
SoWeBuildMemberHi Khaled,
Thanks for your answer and solution. I can confirm that it indeed works with registration!
However, I need it for updating the profile, instead of registration. I figured it could be done using the form redirect example from your documentation:
add_action( ‘user_meta_after_user_update’, ‘user_meta_after_user_update_function’, 10, 2 );
function user_meta_after_user_update_function( $response, $form )In this case I added the $form parameter in order to retrieve the name. The function itself would need to do a a switch statement to check the form name after which we could call $userMeta->jsRedirect.
However, thus far I’ve failed to feed the $form parameter into the ‘user_meta_after_user_update’ action.
If this can still be done with HTML, that would be great. However, if you could point me into the direction as to where to edit this action, that would be fine as well.
Thanks!
Khaya
SoWeBuildMemberWhile we’re on the topic, what would be the code for a switch statement on the form name? I.e. I’d like to have custom redirects depending on the form name, could you please specify?
-
AuthorPosts