Home Forums WC Vendors Free Support Allowing wp-admin/index.php for vendors

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.


Thank you to all of our customers!


Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #8599

    In my site, I have a vendor that is also a content contributor so I have their role set to Editor and then I’m using User Role Editor to give them a secondary role (vendor) which seems to work fine. The only thing I’m having trouble with is removing the restrictions in WC Vendors which stops them from viewing the dashboard.

    In wc-vendors\classes\admin\class-admin-users.php on line 47…
    add_action( 'admin_menu', array( $this, 'remove_menu_page' ), 99 );
    I want to remove that action, so I’m using this:
    remove_action( 'admin_menu', array('WCV_Admin_Users', 'remove_menu_page'), 99 );
    The code above is in a plugin I have that customizes WooCommerce in various ways. That line sits in my plugin’s main class constructor. The class is initialized using the WordPress action hook “plugins_loaded”, same as WCV_Admin_Users.

    What am I doing wrong here?

    • This topic was modified 7 years, 4 months ago by Jordan.
    WC Vendors Support

    Usually you can just put remove_actions in your themes functions.php file. I think it has to do with the user role not having permission to see the wp-admin dashboard. You’d still need the:

    remove_action( ‘admin_menu’, array( $this, ‘remove_menu_page’ ), 99 );

    ….but also still need to allow the vendor role to see the dashboard. Keep ticking boxes till you find the right capability. 🙂


    When that line is commented out in class-admin-users.php, the user can view index.php as usual so it’s not a capabilities issue.

    I have all my WooCommerce goodies separated into their own plugin file for sake of cleanliness. I tried moving it into functions.php with no change.

    My code:

    add_action( 'plugins_loaded', 'redo_vendor_access' );
    function redo_vendor_access() {
        remove_action( 'admin_menu', array('WCV_Admin_Users', 'remove_menu_page'), 99 );

    Side note – The crayon syntax highlighter is being weird…

    Any pointers?

    • This reply was modified 7 years, 4 months ago by Jordan.
    • This reply was modified 7 years, 4 months ago by Jordan.

    After doing some more research, I found out what’s going on. remove_action() needs to be passed the object that added the action. In class-wc-vendors.php where include_core() is called, it creates an anonymous object for the WCV_Admin_Users class… which means I can’t access that object in order to pass it to remove_action(). Uh oh!

    If I change
    new WCV_Admin_Users;

    global $WCV_Admin_Users;
    $WCV_Admin_Users = new WCV_Admin_Users;

    and then in my code use

    global $WCV_Admin_Users;
    remove_action( 'admin_menu', array($WCV_Admin_Users, 'remove_menu_page'), 99 );

    Then it works and everyone lives happily ever after. BUT that’s kind of annoying because shouldn’t all the new class instances be wrapped in globalized variables in case they add a filter/hook that someone wants to change in the future?

    Long story short I added a new option which, if checked, lets vendors access the dashboard (and see admin notices).

    I plan on using it on my site for the foreseeable future. Is this something others might find useful? Should I submit a pull request?

    • This reply was modified 7 years, 4 months ago by Jordan.
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.
This website uses cookies to ensure you get the best experience on our website.