Hi,
its possible redirect diffrent users with diffrent roles on spicified page when use Addon User Registration Addon ?
For example i have roles :
alfa1 ,
beta1
alfa 2
beta2
and need after user login redirect to:
alfa1 -> /alfa1-page,
alfa2 -> /alfa2-page,
beta1 -> /beta-page,
beta2 -> /beta2-page,
Its possible ?
chrishajer
(Chris (Gravity Forms))
May 17, 2019, 7:47pm
2
Is the user already logged in and they already have that role? If so, the User Registration add-on is irrelevant, right?
To populate a field in the form with the logged-in user’s role, you can use this:
https://gravitywiz.com/dynamically-populating-user-role/
Then, base your conditional logic for the confirmation on that value of that field.
ok, for more details.
User need be registered by User Registration Addon plugin and get specified cutom role defined on system ( its not problem - roles is already here: alfa1, alfa2 , beta1, beta2 )
When user confirm account can login by Register Addon Widget (i know on this widget can set up page after login but is global for all users no matter what role have)
What i need on last step is User after login must be redirect for page like this :
It will be possible define ?
webaware
(Ross McKay)
May 18, 2019, 1:44am
4
The free plugin Login with Ajax can help you with that, and additionally is a great way to help your members login to your site from the front end.
1 Like
This plugin not work with User Registration Addon.
Can anyone help with hook for get diffrent redirect page after login for diffrent user roles ?
Its login process , when user already registered like as describe.
i try this but need click two times login button when redirected:
function login_redirect_custom( $login_redirect, $sign_on ) {
$current_user = wp_get_current_user();
$role_name = $current_user->roles[0];
if ( 'administrator' === $role_name ) {
return home_url('/admin-panel');
}
if ( 'alfa1' === $role_name ) {
return home_url('/panel-alfa1');
}
}
add_filter( 'gform_user_registration_login_redirect_url', 'login_redirect_custom', 10, 2 );