Hi,
I want to redirect to dashboard if a vendor is logged in and to home page otherwise, I tested debugging for a while with this code but it seems like not working
add_filter( 'hivepress/v1/forms/user_login', 'alter_user_login' , 10, 2 );
function alter_user_login( $props, $form ) {
$vendor = \Hivepress\Models\Vendor::query()->filter(
[
'user' => get_current_user_id()
]
)->get_first();
if( $vendor ){
$props['redirect'] = hivepress()->router->get_url( 'user_account_page' );
}else{
$props['redirect'] = get_site_url();
}
return $props;
}
The get_current_user_id() function seems not getting the id of the logged in user
please help