• Hi , I would like to redirect custom role type of the user like “Gym owner” to admin dashboard .I have given the following permissions :

    Array
    (
    [edit_dashboard] => 1
    [edit_tribe_events] => 1
    [edit_tribe_organizers] => 1
    [edit_tribe_venues] => 1
    [level_0] => 1
    [read] => 1
    [gym_owner] => 1
    [read_private_tribe_events] => 1
    )

    Let me know.

    I am using woocommerce Login also define the following in functions.php
    //Gym Owner Redirect to Admin
    function gym_owner_login_redirect( $redirect, $user ) {

    $role = $user->roles[0];
    $dashboard = admin_url();
    $myaccount = get_permalink( wc_get_page_id( ‘myaccount’ ) );

    if( $role == ‘administrator’ || $role == ‘gym_owner’ ) {
    $redirect = $dashboard;
    } elseif ( $role == ‘customer’ || $role == ‘subscriber’ ) {
    $redirect = $myaccount;
    }

    $redirect = (string) $redirect;

    return $redirect;
    }
    add_filter( ‘woocommerce_login_redirect’, ‘gym_owner_login_redirect’, 99, 2 );

    Let me know how i can redirect it to dashboard.

    Its redirecting to myaccount page woocommerce .

    Thnaks

Viewing 1 replies (of 1 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    Hi,

    Add ‘view_admin_dashboard’ capability to the role to allow it access to the admin dashboard when you have active WooCommerce. Redirection code is not needed then. For more information about user redirection to front-end by WooCommerce read this post.

Viewing 1 replies (of 1 total)
  • The topic ‘Access Admin panel after Login’ is closed to new replies.