Skip to content

Instantly share code, notes, and snippets.

@matty0501
Last active April 22, 2024 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matty0501/b607d2608b177a9453b11ba50355b7ee to your computer and use it in GitHub Desktop.
Save matty0501/b607d2608b177a9453b11ba50355b7ee to your computer and use it in GitHub Desktop.
<?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