0
votes
1answer
69 views

Hide plugin dashboard menu item for specific roles

I am writing a plugin and I am trying to only display the admin dashboard menu item to specific roles. I have this controlling snippet so far... // Check User Role global $current_user; if( ...
1
vote
1answer
74 views

wp_dropdown_roles() to replace option value = code

I'm trying to replace a hardcoded dropdown list of roles in a plugin. Currently this is the code: echo '<select name="xf_user_role_' . $id . '" id="xf_user_role_' . $id . '">'; ?> ...
0
votes
1answer
65 views

Set user ID at time of wp_create_user

I'd like to add a new user to the WordPress user table. The code for wp_create_user works fine but it is adding the user incrementally to the next available ID in the user table. Instead, I want to ...
3
votes
1answer
66 views

How to Structure a New Role/Capability Scheme?

I have a situation where I need users to be flagged as "Instructors" on a site. That role should basically be whatever the user's current role is with the added capability to see comments from ...
0
votes
1answer
99 views

How to add more than 1 user role to sub-menu pages

I create a plugin with 6 submenu pages. I need 4 of them to be accessible by administrator and a custom user role i created say 'coach' user. Then the 2 of them to be accessible by administrator and ...
0
votes
0answers
52 views

Capabilities for custom post type visible in backend but not working

In my plugin I have created a custom post type and defined capabilities for both the subscriber and the administrator role. When I go into the backend and look at the capabilities that are in the ...
4
votes
2answers
3k views

Send user activation email when programmatically creating user

I wondered if someone here might be able to help. Basically, I've created a custom registration form that when validated, inserts a user to the user table. function _new_user($data) { // ...
3
votes
1answer
162 views

WordPress Capabilities: edit_user vs edit_users

The official documentation only mentions edit_users, but in the source I found many places are using edit_user, what is the difference? Are there any conventions for singular and plural capabilities? ...
0
votes
4answers
3k views

what's the meaning of the field wp_capabilities in table wp_usermeta

I am new to wordpress, in table wp_usermeta I notice that we have a row meta_key meta_value wp_capabilities a:1:{s:13:"administrator";b:1;} First, what's the meaning of ...
0
votes
1answer
69 views

How can I change my assigned user role in WordPress 3.5.1?

My current user role is "Administrator". I'd like to change my role to "Editor" (through out database field). I read Database_Description, but it did not help.
0
votes
1answer
139 views

Check user's role and store in variable

I am using custom user roles which I create and assign by using a plugin. I was wondering how I could retrieve the user's role and store it in a PHP variable. What I am trying to achieve is something ...
4
votes
2answers
759 views

Add custom user capabilities before or after the custom user role has been added?

Should custom user capabilities be added before the custom user role has been added, or the other way around? add_role() asks for and array of $capabilities in the third parameter of the function. ...
1
vote
1answer
149 views

Can a Plugin Override New User Default Role Type

I'm making a plugin that creates user accounts. Is there a way I can create new users that get the role that I (the plugin developer) tell them to, as opposed to making them all the default new user ...
1
vote
1answer
75 views

How to write a plugin to add users to a mail list

I run a multi-site blog with about 300 sites. I have an idea that I want to write a plugin that in order to add all administrators of blogs to a MailMan mail-list. I just want administrators though, ...
2
votes
3answers
945 views

How to restrict plugin's sub-menu pages to admin/subscribers?

I am working on a plugin with 6 submenu pages. I want 5 of them to be accessible by Administrators only and 1 of them to be accessible by Subscribers only. Both user roles will have different ...
0
votes
1answer
1k views

Menu page with minimum capability as 'Subscriber' doesn't allow 'Admin' to access it?

I've added a separate menu page (an object page) with minimum access level required as 'Subscriber'. I'm doing this because I'm registering new users and they'll be 'Subscribers' with an extra ...
2
votes
3answers
3k views

Change default admin page for specific role(s)

I was wondering if anyone knew of a plugin or a way programmatically to change the the default admin page for a specific user/role? I have a master panel page for my plugin currently setup with ...
0
votes
2answers
323 views

How to determine which capability to use?

For example, I want to use add_menu_page() function to add a menu item to the dashboard. To control which users will be able to access it, I'm supposed to use capabilities... <?php add_menu_page( ...
0
votes
1answer
1k views

query users by role

I have a custom plugin which queries users and usermeta, but I now need to filter admins out of the results. A very simplified version of my sql query is: SELECT * FROM usermeta LEFT JOIN users ON ...