Questions tagged [user-roles]

Names for a set of user capabilities.

Filter by
Sorted by
Tagged with
0 votes
1 answer
18 views

How to lock users account until approvation

I have created a custom role that I've named customer public function setup_user_roles() { add_role('customer', 'Customer', $customer_capabilities); add_role('moderator', 'Moderator', $...
  • 3
0 votes
0 answers
20 views

How to assign a custom gender to a user role?

I'm looking for a way to assign a custom gender I created to a user role. I have also created very specific custom roles for this, but for the example, let's say that I would like as soon as a user ...
  • 1
0 votes
2 answers
24 views

Adding a new role with administrator's capabilities

I'm trying to add a new role to my website that is based on administrator's role. I want my new role to have all the capabilities admin has. Problem is, when I log in with my new user, I can't access ...
0 votes
1 answer
18 views

Redirect user based on role when they try access a particular page

Please how can I redirect a user base on the role when they try to access a particular page? I would need the code to do this, please.
0 votes
2 answers
27 views

Check if specific role exists

I'm trying to write a function that checks if a specific role exists. I found the following code on the web but it doesn't work for me: function role_exists( $role ) { if ( ! empty( $role ) ) { ...
0 votes
0 answers
9 views

Get users by rôle in a list

i'm using masterstudy theme in wordpress and i made some changes by adding project on each course so i have a field named company name on the project section where i have to write project povider (...
0 votes
0 answers
13 views

Adding plugin editing capability for Author

I am new to php environment. Any idea how we could enable plugin editing roles and capabilities for Author or another scenario could be adding as sub-admin with limited roles. Any help would be ...
0 votes
1 answer
63 views

User Capabilities are not available in WP REST permission callback?

I want to only permit the execution of specific admin tasks for users who are currently logged in to the wp admin panel (via is_user_logged_in) and who have a specific capability (via ...
  • 391
0 votes
1 answer
27 views

Block user roles from accessing the WordPress dashboard

I want to block multiple user roles from accessing the WordPress dashboard, I have a custom role, and I want to block it along with other roles, but I don't know how to edit the code. the code below ...
  • 5
0 votes
0 answers
17 views

How do I modify the user role 'subscriber' to allow the user to delete posts

I've created a form to allow users to create new posts of a custom post type user-posts. This works well, any registered user of any role can create a new post of this custom post type. I created an ...
1 vote
0 answers
10 views

'upload_mimes' filter seems to be restricting viewing/downloading as well

I am trying to allow administrators to upload SVG files using upload_mimes filter. function custom_upload_mimes( $mimes ) { // Allow additional mime types for administrators if( ...
0 votes
1 answer
34 views

Execute PHP code only with specific user role

I have a WordPress website with woocommerce and I want to set a minimum order quantity for products. I have found code online which does exactly what I need it to do and it works perfectly.(the code ...
0 votes
1 answer
18 views

Change user role when user's first post gets published

On my websites the contributors (user role contributor) are allowed to post posts. All their posts are not published automatically (these posts are with pending status). After approving their first ...
0 votes
0 answers
31 views

can't create user without email for an author after converting single site to multisite

We're converting a single site to multisite, and in the process we're seeing something strange with users. Previously, we could create and update users to use as authors that don't have an email ...
  • 101
0 votes
0 answers
24 views

Wordpress user role with create user capability?

I want to create a user type (Let’s call it “clinic” which is similar to editor role in wordpress) but with permission to add_users /create_users capability. I wanted to limit that capability of this ...
0 votes
1 answer
23 views

Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)

I need to create a small members area, probably for about 1000 users, not more. I want to set private information there, forms, interaction, etc. More in particular it'll be for "providers" ...
0 votes
1 answer
24 views

Role capabilities issue

I need some help with capabilities for a CPT. I register a new CPT with a capability type 'agenda'. To do this I use the code below in the register array 'capability_type' => 'agenda', After ...
  • 27
0 votes
0 answers
21 views

Redirect Page ID, based on logged-in User Role

I am trying to accomplish the following in WordPress via the functions.php file. If user is "This Role" & If "Page ID#" is being visited then "Redirect" to this &...
0 votes
0 answers
14 views

How to fix the Post Preview Button (CPT & map_meta_cap)

I'm trying to create a custom post type that can be edited by users with a custom role (as well as administrators, editors and authors). Althought the idea for the users with this custom role is for ...
0 votes
0 answers
10 views

Restrict Custom Post Type per role in Dashboard

I would like to set up some restrictions on how some roles can access given posts to edit in Dashboard. I have a custom post type affiliates having 2 nested levels. Custom Role User Editor should be ...
  • 824
0 votes
1 answer
29 views

Retrieve user roles but exclude default roles

I am currently using the wp_roles() function to retrieve all user roles available like this: <?php foreach (wp_roles()->get_names() as $role) { echo translate_user_role( $role ); } ?> ...
  • 203
1 vote
0 answers
22 views

How to change or add user role after getting post request data about pay? [closed]

How to change or add user role after getting post request data about pay? qiwi2.php file in theme folder: <?php include($_SERVER['DOCUMENT_ROOT'].'/wp-load.php'); $qiwi = [ "public_key&...
3 votes
0 answers
26 views

Locking Down Wordpress Application Password Permissions / Capabilities

I am working on a Wordpress installation where we recently decoupled the frontend into a NextJS application that is no longer hosted on the same domain as the admin. We are accessing data etc through ...
1 vote
0 answers
109 views

Parent User and Child User - relate users

I need to create a system in which I have 2 types of users: Company User (C) and Employee User (E). I need C to be able to register as many E as necessary and for C users to be able to publish ...
0 votes
1 answer
8 views

Newly created user role not displaying on users screen

I have created a new role with the following code: add_role('sponsored_content', 'Sponsored Content', get_role('contributor')->capabilities); I have added users to this role. When viewing the ...
0 votes
1 answer
64 views

How to add author role as a custom field to custom post type in wordpress?

I want to add a custom field in the wordpress custom post type, such that this field dynamically fetches the value of the author role. Purpose - I want to add this custom field so that I can filter ...
  • 21
0 votes
1 answer
34 views

Why does admin_body_class not work?

I'm trying to add the body class of the current user role to both the frontend and the admin backend. Why does admin_body_class not work for admin? The comment to this question does not work: How to ...
0 votes
0 answers
23 views

Setting an expiration date for wordpress roles

I need to know if there is any manual way to set expiration date for a given role. In my website, when a person purchases a video, they are assigned a role. What I am looking for is to restrict this ...
0 votes
0 answers
21 views

Show an admin menu item in Editor role

I am new to Wordpress and would like to know how to add a specific admin menu item to the role Editor (in this case it is "User Login History"). This plugin shows its name for Administrator ...
0 votes
0 answers
9 views

users in their Role can only their Posts

I got a custom post type called "objects". I now want that only users in the role "groupA" can edit nor delete posts from users in role "groupA". Same with Media. Is that ...
0 votes
0 answers
14 views

Editor role can only create/edit/delete users who have one of two roles

I need help with something, what happens is that I have created a custom role derived from the Editor role that Wordpress has by default and I have added some extra capabilities. Now, my goal is that ...
0 votes
0 answers
22 views

How can I make this cleaner or smaller? [duplicate]

This code works, but it's going to get huge! I have 150 "a href" to make and this is going to get rough, lol Each role has a custom url. How can I make this cleaner or smaller? if ( ! ...
1 vote
1 answer
43 views

if role is logged in then do something

I need some pro eyes please. Over all, I'm adding one button/link to the MAIN NAV depending on the logged in role. I have this “working” code: if ( ! function_exists( 'add_extra_item_to_nav_menu' ) ){ ...
0 votes
1 answer
28 views

Could we know who published a post on WordPress?

Besides knowing the author, could we know like which user with the Editor role published a post? Is this being tracked in the db?
0 votes
0 answers
25 views

Why can my subscribers create new posts for review?

My subscribers seem to have permission to create posts. After reading the documentation on capabilities, this shouldn't be the case. Subscribers should only be able to manage their own profile. I have ...
  • 1,275
0 votes
0 answers
31 views

Custom Role read_private_posts Not Working

I've created a custom role via add_role, it's in my activation hook and is being removed on deactivation, thus I'm deactivating and reactivating my plugin to see the role permission changes. I can see ...
0 votes
1 answer
37 views

Restrict access to custom post type based on its taxonomy terms

I'm just beginning to understand the roles and capabilities in Wordpress and I'm not sure that I can do what I would like. I have a custom post type, "cats", that has specific taxonomies ...
2 votes
0 answers
36 views

Filter custom posts based on the user role of author

I am using CPT plugin to create new custom post type, and along with I am using elementor and jet smart filters to display list of posts in the frontend and filter them. I am trying to filter out ...
  • 21
0 votes
1 answer
137 views

Learndash change user role after completing the course

I am moving a site from a LearnPress LMS to the LearnDash LMS, and I need to move over a custom function that changes the user role when the user completes the course (there is only one course right ...
0 votes
0 answers
36 views

User can't search himself on rest api

I have a custom role and here is the capabilities; Array ( [read] => 1 [edit_posts] => 1 [delete_posts] => 1 [upload_files] => 1 [list_users] => 1 ) The user is can ...
0 votes
0 answers
10 views

Edit and delete permissions pages and posts

Does anybody know if it is possible to protects some pages and posts from editing / deleting unless if the role is admin? Not all posts and pages has to be protected against this! I can not read ...
0 votes
0 answers
18 views

How to assign a role to a simple visitor?

I'd like to know how to assign a role to a visitor/guest.. I've searched for a plugin or else, but none were able to do that ! Can anyone help me ? Thanks a lot
  • 1
0 votes
0 answers
14 views

Disabled delete_others_posts if post is from admin

I need some help with capabilities. I created a new role for my theme with the capability "delete_others_posts". This role can delete posts from other users and also from admins. Is there a ...
  • 27
0 votes
1 answer
48 views

Auto Delete Users (auto_delete_users)

I need some help cause I couldn't find any solution for my problem and haven't the knowledge to solve the problem on my own. What I'm trying to do: I want to delte every WordPress user (subscriber) ...
0 votes
1 answer
17 views

How can I check if a visitor can read a post?

I know how to check capabilities for logged in users, with $can_read = current_user_can('read',$post->ID); But the above code returnes false when the user is not logged. So how can I check if the ...
  • 462
0 votes
1 answer
142 views

How to disable activation email to specific user role?

I'm using Ultimate Member to manage my user roles. I have the Activation Emails active and it sends to new subscribers as expected. But when a user with role "Employee" subscribes, I don't ...
0 votes
1 answer
18 views

Assigning a capability to a user role (code check)

I wrote this piece of code to add manage_options capability to my shop_managers, and it does work. I wanted to ask before i move this code to my live site, if the function is called in the right place....
1 vote
1 answer
25 views

Add, edit specific CPT with custom role

Who can help me with roles and capabilities? I am stuck on this and I need some help. I want a role that only can add, remove edit etc. a specific CPT. What I have so far add_action('init', function(){...
  • 13
1 vote
1 answer
288 views

Redirection of users away from wp-admin (but not administrators)

I want to redirect all users except the admin away from the wp-admin page. If the logged in user tries to access /wp-admin then they will be redirected back home. Right now they get a page that says &...
0 votes
0 answers
23 views

While creating a post, can I restrict the authors in the dropdown list based on their user role?

I am running an online course website. The user roles include student, teacher etc. I've got 5 teachers so far, but the students are 200+. When I am creating a course(with a custom post type "...
  • 131

1
2 3 4 5
28