Your question seems to boil down to this
I can’t figure out how to check that the $userids in question are an
administrators user ID.
Try
user_can($id,'administrator')
http://codex.wordpress.org/Function_Reference/user_can
The Codex has a warning about using role names with the current_user_can
function and it is very similar to user_can
so I suppose caution is order until the conflicting instructions are sorted.
Do not pass a role name to current_user_can(), as this is not
guaranteed to work correctly.
The same page also says:
$capability
(string) (required) capability or role name
Default: None
- @param string $capability Capability or role name.
Are you hacking core file? The users.php
isn’t this users.php
is it? That is a high maintenance path your are going down if it is.
Related Posts:
- allow editors to edit menus?
- How to change a user’s role?
- Is there way to rename user role name without plugin?
- How to add a Capability to a User Role?
- How can I get a list of users by their role?
- How to allow editor to edit privacy page / settings only?
- Reset default roles and capabilities
- Is it possible to add new user Roles?
- Temporarily give ‘manage_options’ capability
- Hide specific admin users’ posts
- How to filter the role selector?
- How can I change a user role upon visiting a page?
- How to let the Contributor role preview unpublished posts?
- Assign Subscriber capabilities to a custom user role
- Roles at registration (classipress)
- How to allow registered users to change their user role through frontend?
- Contributors missing from author dropdown
- How to add author role as a custom field to custom post type in wordpress?
- Author Role – Allow editing of Gallery images
- What is the difference between “create_users” and “add_users” capabilities?
- How to display user role
- Users Role and Access
- How to remove sticky post capability for a specific user role?
- Let new user role to ‘edit_others_posts’ of other user role, not of its own type
- User registration approval based on role selected
- Why does this check to see if user is authorized to edit a post fail for all but super admins?
- add_menu_page() for more than one user role
- How do I turn off the Admin Bar for all Subscribers?
- Hide from specific role the top admin bar new button
- exclude roles from overview
- How do I remove the Other Roles field (from User Role Editor plugin) in wp-admin/user-new.php
- Can you set a role as author?
- How to allow a user to make their post (ad) a draft, and then publish again without needing approval?
- How to allow user to edit post in wordpress
- wordpress editor role remove all but ‘menus’ in appearance menu
- Customized role that allows users to “Submit for Review” instead of “Publish”
- Adding an additional role to an Administrator
- Conditional tag based on the role of author in author.php
- Allow editors to post iframes [duplicate]
- if user has a certain role then display image
- My subscriber has the “edit comment” capability but can’t edit comment
- allow non logged in user to upload images in media library
- Assign a role to the user who registers on a form
- Subscriber (with read permissions) cannot view Private posts
- DISALLOW_FILE_EDIT constant being ignored
- How to change user role using hook
- Add custom role across network in multisite
- how to remove some permissions from a shop “manager role” in woocommmerce?
- reset the users roles – is there a way to do this?
- User roles are changing automatically
- Custom Capabilities for CPT and Problem with current_user_can()
- Custom wordpress admin page/url “You do not have sufficient permissions to access this page.”
- user_can() not working for comment authors
- Which capabilities are available in Gravity Forms Salesforce plugin? [closed]
- Hide front-end from every logged out user and redirect them to the default login page
- WordPress add_rewrite_rule redirection match GET variable not passing through to custom template
- ‘upload_mimes’ filter seems to be restricting viewing/downloading as well
- How to restrict an admin page, if the user is not superadmin?
- Allow user edit widgets
- Problems using ‘add_role’
- Let editors view post in admin but not be able to perform a save/edit
- Capabilities don’t add
- Migrating Roles from one environment to another
- Show menu in sidebar if on specific page AND specific user role (is_page, current_user_can)
- Letting users create a post that is a custom post type from a page
- Conditional Tag for Wishlist membership. If the user is added to two levels show particular content
- How to create a front facing user sign up, log in and profile pages like FoodGawker.Com [closed]
- Learndash change user role after completing the course
- How to disable activation email to specific user role?
- logout users with specific role after close browser tab
- Admin user name not showing up in author dropdown
- Adding all custom capabilities to admin
- How to give plugin access to specific role(s)
- Is there a way to allow users with “Subscriber” user role to access media library in backend and frontend
- current_user_can( ‘edit_user’ ) does not work
- Separate user bases or hide users of another role or connected to another minisite
- How to restrict subscriber editing other posts but read specific posts in backend
- grant multiple roles access to specific admin menu item
- Change role in maintenance mode
- Publishing post strips custom html element when user is not admin
- Best practices to handle multilpe roles and capabilities?
- Check what capabilitie(s) an action requires
- Allow multiple roles to specific user
- Give a user role capability to create orders for clients
- user has permission to read a custom post but it is not being shown in wordpress plugin
- Restrict custom fields based on user roles
- Restrict content piece by role – Protection message in content?
- Select dropdown with 2 choices from foreach
- Custom Admin Menu Order for all User Roles
- translate_user_role doesn’t work
- Force “submit for review” on update?
- Allow users to change author of post
- Is there a way for a limited user to just view the page of a post without being able to edit it?
- How do I make a draft post accessible to everyone?
- Authors Ability to Review Post from Contributors
- How to assign role to a custom registration form?
- How to add user roles? [closed]
- Check if specific role exists
- WordPress users roles wp-admin
- User roles empty