I would always go for the role
“check”.
As in your case:
if ( current_user_can( 'vendor' ) ) {
// do stuff
}
Or of course the distributor role
as created by you.
This way you can be sure that one is not interfering with the other and you can assign each role
to its own “task” (e.g. allowing to edit only a specific custom post type
or even his/her own meta-box
) even though the capabilities are equal.
About possible security risks I can not judge, that depends all on the capabilities you have add to those roles.
Selecting by role
gives you imho more freedom and has no negative effect as far as I know.
The only thing you have to be aware of is that you have to be consequent in dividing tasks/allowing access when they are for a specific role
.
No idea if this is an answer which helps you out, maybe some of the other users here can/will inform you better than I do. This what I wrote is seen from my perspective, so be my guest.
Related Posts:
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- WordPress Capabilities: edit_user vs edit_users
- How to Structure a New Role/Capability Scheme?
- How to allow Unfiltered HTML in a wordpress multisite install
- Limit role to one plugin [duplicate]
- Logout users upon login, based on caps/role?
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- How to determine which capability to use?
- Allow contributor user role to perform copy operation PHP
- Buddy Press restrict the capability to edit users
- Getting a List of Currently Available Roles on a WordPress Site?
- How do I create a custom role capability?
- How to store username and password to API in wordpress option DB?
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- Send user activation email when programmatically creating user
- How to properly validate data from $_GET or $_REQUEST using WordPress functions?
- Nonces can be reused multiple times? Bug / Security issue?
- Can someone explain what wp_session_tokens are, and what are they used for?
- WordPress and PHP Sessions – Security and Performance
- Change default admin page for specific role(s)
- What is the difference between esc_html and wp_filter_nohtml_kses?
- How to Change the Entire WordPress Admin panel Look and Feel?
- Nonce in settings API with tabbed navigation
- Log in from one wordpress website to another wordpress website
- Allowing Custom Capability to Manage Plugin Options
- Escaping built-in WP function return strings
- What is the difference between strip_tags and wp_filter_nohtml_kses?
- WP Cron doesn’t save or in post body
- Add Capabilities to Custom Post Type after it has been created [duplicate]
- How to add more than 1 user role to sub-menu pages
- Odd behaviour with submenu link creation
- WordPress restrict plugin file direct access
- Plugin development: is adding empty index.php files necessary?
- Confusion on WP Nonce usage in my Plugin
- How to restrict plugin’s sub-menu pages to admin/subscribers?
- How to not let a user with a new role edit users that have administrator role?
- Execute plugin for specific user role(s) only
- Coding a plugin on WordPress; when should I sanitize? [duplicate]
- Correct way check nonce (security) using old Options API
- Why do I need to check if wp_nonce_field() exists before using it
- query users by role
- Is there any way to check for user login and send him to login?
- WordPress security issue to output data from user input from theme option form
- Hide plugin dashboard menu item for specific roles
- get_posts() not working when accessing with a custom user role
- Verify if user is wordpress logged in from another app since wordpress 4.0
- Secure Pages Best Practice
- Securing/Escaping Output of file content – reading via fread() in PHP
- Set different custom menu items for different user roles
- Prevent third party plugin’s admin page access based on user type
- best way to make a WordPresss multisite that is secure but at the same time supporting my plugin development efforts
- Video Security just like facebook [closed]
- You do not have sufficient permissions to access this page on a submenu
- wp_dropdown_roles() to replace option value = code
- Create a custom capability to allow an ‘Editor’ to edit only ‘Subscriber’ users
- Is disabling test_form in wp_handle_upload a security concern?
- How to connect my wordpress plugin to a remote database securely?
- wp_nonce_field displaying twice
- Is it necessary to do validation again when retrieving data from database?
- Hide custom post type by user roles
- Checking a WordPress for OWASP top 10 vulnerabilities [closed]
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- WordPress custom post type capabilities issue
- add_submenu_page hooked function must explicitly check user capabilities – why?
- Are there any security risks when submitting data-attribute data through AJAX?
- Check user’s role and store in variable
- Why would you use esc_attr() on internal functions?
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Is it possible to use WP-CLI in a plugin (or theme)?
- Secruity Questions on a timer
- How to use gettext for specific user role
- Using HTML links within translatable string
- Unable to access custom plugin backend
- How can I save a password securely as a settings field
- How To Create A File Archive in WordPress?
- How can I change my assigned user role in WordPress 3.5.1?
- insufficient permissions; coding an action for plugin governed by custom capability
- Using password protection to load different page elements?
- HTML Elements in my WP Plugin being generated in JS. Security and Translated Text Question about this method being used
- How to store sensitive user data (passwords)
- Enable a role named ‘backend_user’ to access my plugin pages
- Add custom parameter for custom user role
- How do I make secure API calls from my WordPress plugin?
- esc_attr() on hard coded string
- how to add security questions on wp-registration page and validate it
- How to give custom roles the capability to edit one Menu instead of every Menu
- How I can give access to my custom plugin for editor roles user?
- Experts opinions needed: How (in)secure is this approach?
- Remove all capabilities in separate method fails versus included in method
- Remove from a div by class name from post page if post author role is not administrator
- Adding admin for specific users
- New Users are saved with no role selected
- WordPress User Management Departmental Managers
- Plugin capabilities
- Data Validation, dynamically generated fields (select for example)
- Remove default wordpress roles
- esc_url, esc_url_raw or sanitize_url?
- Plugins in symlinked directories?
- how to add custom user capabilities using add_user_meta or something else?