Last active
April 22, 2024 13:31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Perks // GF Better User Activation // Set Redirect URL by User Role | |
* http://gravitywiz.com/documentation/gravity-forms-better-user-activation/ | |
*/ | |
add_filter( 'gpbua_activation_redirect_url', function( $url, $activation ) { | |
// Enter the roles and redirect URLs | |
$redirects = array( | |
'subscriber' => 'https://google.com', | |
'editor' => 'https://bing.com', | |
); | |
/** | |
* @var $activation GPBUA_Activate | |
*/ | |
$feed = $activation->get_signup()->config; | |
$meta = rgar( $feed, 'meta' ); | |
$role = rgar( $meta, 'role' ); | |
if( array_key_exists( $role, $redirects ) ){ | |
$url = $redirects[ $role ]; | |
} | |
return $url; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment