Thursday, August 4, 2022
HomeWordPress DevelopmentCan I Get Consumer ID at Login?

Can I Get Consumer ID at Login?


My purpose is to permit my customers to pick out their alternative of redirect web page after login nevertheless it does not appear that the consumer ID is offered after login?

Right here is my code. Any assistance is GREATLY appreciated!!!

perform my_login_redirect( $redirect_to, $request, $consumer ) {
    
    $myID = get_current_user_id();
    if ($myID > 0) {
        $my_redirect = xprofile_get_field_data( "Residence Web page" ,  $myID ); 
        change($my_redirect) {
            case 'Neighborhood':
                return bp_loggedin_user_domain();   
                die;
            case 'Bulletins':
                return home_url('/bulletins');  
                die;
            case 'Prayers':
                return home_url('/prayers');    
                die;
            case 'Watch':
                return home_url('/watch');  
                die;                
        }
    }
    return home_url();  
    die;
}
 
add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments