Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

Restrict wp-admin access to vendors

MultivendorX

Resolved
Viewing 9 reply threads
  • Author
    Posts
    • #147117
      MaxenceTP
      Participant

      Hello,

      I have added a plugin to set multiple roles to a user (vendor + administrator for example) : https://en-gb.wordpress.org/plugins/user-role-editor/
      I want to enable the option “Vendor’s Backend Access”, but when I do that, even with the admin role I cannot access to the wp-admin.

      Is it possible to add exceptions ? For example if you have the admin role, you can bypass this rule.

      Thank you

    • #147246

      @MaxenceTP, I presume there is a primary role and a secondary role. Make sure to set the primary role as the vendor.

      But, as you are working with capabilities, then it might cause issues for the vendor’s flow also.

      By default we do let vendors access the backend, so make sure you didn’t enable the backend access option : https://prnt.sc/3U0GyGeg13ya

    • #147257
      MaxenceTP
      Participant

      Even with Administrator as primary role, and vendor as secondary, I cannot access wp-admin with the “Vendor’s Backend Access” enabled :'(

    • #147258
      MaxenceTP
      Participant
      This reply has been marked as private.
    • #147275

      It seems like the vendor is facing a capability issue probably due to multiple role permission.
      As we don’t know why this is happening, so it is quite difficult for us to shed light on the reason behind this.

      Whether this is a role conflict issue, just to be sure please create a new vendor, who doesn’t have any other secondary roles. Then check whether that vendor is able to access the backend.
      If he is able to access the backend, then you must debug this issue. It will need you to check each capability related code

    • #147297
      MaxenceTP
      Participant

      There is no problem if I only have the vendor role, I want to disable wp-admin : it’s working.
      But if I’m admin + vendor, I cannot access wp-admin as MVX is blocking wp-admin when I have the vendor role.

      I want to add a condition, if it’s true : you can access the wp-admin, even if it’s blocked by MVX.
      Do you understand ? Is there a filter / hook for that ?

    • #147356

      Hi,
      using below filter we add capability for vendor.
      Kindly use this filter for vendor to add capability to use admin dashboard.

      apply_filters('mvx_vendor_capabilities', $caps);
      Copy

      Regards,

    • #147363
      MaxenceTP
      Participant

      I don’t really understand how this hook can solve my problem ?

      I think that will be easier to add a filter in the function “restrict_wp_backend” (class-mvx-pro.php), with the vendor ID as parameter. And add the same filter in the function “remove_dashboard_header_right_panel_nav” (class-mvx-pro-frontend.php).

      Can you add that filter ? Or do you have another solution ?

    • #147386
    • #180105
      WCMp Admin
      Keymaster

      We haven’t heard back from you, so we presume this issue has been fixed.
      So we are closing this one.
      If you need any further help, do open another thread.

Viewing 9 reply threads

The topic ‘Restrict wp-admin access to vendors’ is closed to new replies.