• Hello,

    i`m using Easy Digital Downloads + Frontend Submissions plugins to create an multivendor marketplace and i have this problem:

    I want to set up 3 different Menus: One Menu for “guests”, One for “subscriber” and one for “Frontend Vendor” user role.

    This i can do with the “Nav Menu Role” plugin, but the problem is, if a subscriber registers as vendor and gets the Frontend Vendor, then he still has also the Subscriber role, so he has 2 roles and a vendor still see the Menu for subscriber user role.

    Of course this works well when a Subscriber is just an Subscriber, or if a user registers straight as Vendor, then he has only the Frontend Vendor and can see the Menu for the Frontend Vendor user role.

    So there a 2 options to avoid this problem:
    OPTION 1: Some function which replaced the old user role with the new one instead of just adding a addional role.

    OPTION 2: Adding a HIDE MENU / HIDE MENU ITEM for specific user role function to the Nav Menu Roles Plugin.

    Unfortunately (what i really don`t understand) Nav Menu Roles plugin and all other similar plugins, has only this functions: SHOW for logged out users, SHOW for logged in users or SHOW for specific user role, BUT NOT a HIDE for specific user role.

    PLEASE HELP ME! ??

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I think the best approach is to simply remove the subscriber role when the front end vendor role is assigned. This can be done with the $wp_user_object->remove_role() method. The trick is adding this to whatever process assigns the vendor role. Ideally there would be a hook or similar way to run additional code when this happens. Examine the code that assigns the vendor role for clues.

    If all else fails, use the core ‘add_user_role’ action which the add vendor role process more than likely fires. If the passed role is front end vendor, get the user object from the passed ID and call the above mentioned method to remove the subscriber role if it is present.

Viewing 1 replies (of 1 total)
  • The topic ‘Replace or delete old user role when getting a other user role’ is closed to new replies.