Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Aill3urs on "Woocommerce Redirect"

$
0
0

Hi

I have add in fonction.php this

add_filter('woocommerce_login_redirect', 'ras_login_redirect');

function ras_login_redirect( $redirect_to ) {
global $current_user, $wpdb;
$role = $wpdb->prefix . 'capabilities';
$current_user->role = array_keys($current_user->$role);
$role = $current_user->role[0];

if($role=="adminsitrator"){
$redirect_to = 'http://anypage.com';
return $redirect_to;
}else{
$redirect_to = 'http://anotherpage.com';
return $redirect_to;
}
}

But it s look like it can t take the current user role

Any Idea ?

Regards


Viewing all articles
Browse latest Browse all 8245

Trending Articles