• Resolved Jai

    (@trimastir)


    i need another one help

    by default how to redirect vendor to the backend dashboard without going to the front end dashboard

    because in backend dashboard only shows the Min Max Quantities

    front end dashboard not shown,, so pls check on this do the needful ASAP…..

Viewing 8 replies - 1 through 8 (of 8 total)
  • @@trimastir, in order to direct the vendor to the backend, when they will login, add the following code to the function.php of the current active theme :

    add_filter('login_redirect', 'wp_wcmp_vendor_login_redirect', 99, 3);
    
    function wp_wcmp_vendor_login_redirect($redirect_to, $requested_redirect_to, $user) 
    { 
    
      //is there a user to check?
      if(class_exists('WCMp')){
          if (isset($user->roles) && is_array($user->roles)) {
              //check for vendor
              if (in_array('dc_vendor', $user->roles)) {
                  // redirect them to the default place
                  Return 'https://demo.dualcube.com/wordpress/wp1013/wp-admin/';
              }
          }
      }
      
    }
    
    add_filter('woocommerce_login_redirect', 'wcmp_vendor_login_redirect', 99, 2);
    function wcmp_vendor_login_redirect($redirect_to, $user){
       if(class_exists('WCMp')){
           if (isset($user->roles) && is_array($user->roles)) {
               //check for vendor
               if (in_array('dc_vendor', $user->roles)) {
                   // redirect them to the default place
                   Return 'https://demo.dualcube.com/wordpress/wp1013/wp-admin/';
               }
           }
       }
    
    }
    • This reply was modified 6 years, 7 months ago by Dualcube.
    Thread Starter Jai

    (@trimastir)

    after adding the above code into function.php

    when the vendor will logn in to the website

    it will redirect to my account page, not an vendor backend page

    The above code you have requested should direct them to the backend as uyou have requested in the first thread

    “how to redirect vendor to the backend dashboard without going to the front end dashboard”

    If you want to change the redirect URL, just modify this line Return 'page_url;

    Thread Starter Jai

    (@trimastir)

    thanks for your solution

    it is worked well………

    Thread Starter Jai

    (@trimastir)

    after vendor logout it will redirected to wp admin login page

    i need to redirect to my account page????

    We are happy to help @trimastir

    Thread Starter Jai

    (@trimastir)

    after vendor logout it will redirected to wp admin login page

    i need to redirect to my account page????

    @trimastir, we use WooCommerce hook for the redirect flow. So use logout_url filter and add your own custom code for this.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Vendor Dashboard Redirect’ is closed to new replies.