The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About Permissions , Login Redirect, & Invoice
#3
<?php
/**
* Redirecting users on login based on user role
*/
function my_login_redirect( $url, $request, $user ){
if( $user && is_object( $user ) && is_a( $user, 'User' ) ) {
if( $user->has_cap( 'administrator' ) ) {
$url = admin_url();
} else {
$url = home_url('/users-only/');
}
}
return $url;
}
add_filter('login_redirect', 'my_login_redirect', 10, 3 );

?>

Will that work for a redirect page?
  Reply


Messages In This Thread
RE: About Permissions , Login Redirect, & Invoice - by Ferguson230 - 08-30-2018, 05:03 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)