2022 Developer Survey is open! Take survey.

Questions tagged [user-roles]

Names for a set of user capabilities.

Filter by
Sorted by
Tagged with
3 votes
0 answers
23 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 ...
user avatar
1 vote
0 answers
42 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 ...
user avatar
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 ...
user avatar
0 votes
1 answer
59 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 ...
user avatar
  • 11
0 votes
1 answer
18 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 ...
user avatar
0 votes
0 answers
14 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 ...
user avatar
0 votes
0 answers
9 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 ...
user avatar
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 ...
user avatar
0 votes
0 answers
8 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 ...
user avatar
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 ( ! ...
user avatar
1 vote
1 answer
38 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' ) ){ ...
user avatar
0 votes
1 answer
23 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?
user avatar
0 votes
0 answers
18 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 ...
user avatar
  • 1,267
0 votes
0 answers
28 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 ...
user avatar
0 votes
1 answer
13 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 ...
user avatar
1 vote
0 answers
27 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 ...
user avatar
  • 11
0 votes
1 answer
58 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 ...
user avatar
0 votes
0 answers
11 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 ...
user avatar
0 votes
0 answers
8 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 ...
user avatar
0 votes
0 answers
11 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
user avatar
  • 1
0 votes
0 answers
11 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 ...
user avatar
  • 17
0 votes
1 answer
39 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) ...
user avatar
0 votes
1 answer
13 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 ...
user avatar
  • 452
0 votes
1 answer
45 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 ...
user avatar
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....
user avatar
1 vote
1 answer
16 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(){...
user avatar
  • 13
1 vote
1 answer
96 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 &...
user avatar
0 votes
0 answers
20 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 "...
user avatar
  • 117
0 votes
0 answers
24 views

Counting post and changing roles in mysql database. Query not code

Hello I'm struggling to find an answer talking specifically about counting post and changing roles but on mysql language not php in the wordpress source. I'm not creating a plugin neither I want to ...
user avatar
0 votes
0 answers
17 views

Is there a way to only allow certain user ranks to comment on a post

I have a suggestion page on my WordPress site and I would like for a moderator to create comments giving updates on the progress. However, I only want that rank to be able to comment. Is this possible?...
user avatar
1 vote
1 answer
42 views

Remove Capabilities from WP admin for specific user role

I am trying to remove some menu-links capabilities from the wp-admin for a user role called wsm. I have tried many ways and when i just add the code below it will remove those links from the menu for ...
user avatar
0 votes
0 answers
14 views

How to query users to count all with a custom capability and limit it to a set of roles?

On a site with 12 custom user roles I need to count users with the 'supervisor' custom capability but limited to four specific roles. The following code counts all users with the 'supervisor' ...
user avatar
  • 317
0 votes
0 answers
34 views

logout users with specific role after close browser tab

I'm looking for a way to logout a specific user role (external_user) when he closes the tab/window of a web browser. How can i proceed to close the session? Thanks.
user avatar
  • 264
0 votes
1 answer
28 views

Show only pages you are author of

I am trying to only show pages that a user is the author of for any role other than administrator. The code below seems to put the site in an infinite loop and it ultimately dies. add_action( 'load-...
user avatar
  • 105
0 votes
1 answer
44 views

is wordpress stores Role Id in WP database?

i want to extend default roles in my code. and i want to use role id of WordPress roles. i find out role names are stored in 'wp_options' table under key name 'wp_user_roles'. but i am not able to ...
user avatar
0 votes
0 answers
51 views

Hide media library images from other roles uploaded by admin

Can this function (https://www.role-editor.com/forums/topic/hide-specific-images-or-images-by-specific-user-role-or-specific-user-id/) be updated to hide images from other users (but not admin) in the ...
user avatar
  • 976
0 votes
0 answers
51 views

Clone wp-admin/users.php (Users Admin Page)

I have created a new page in admin. I need to show all the users in this page(like Users admin page). The reason for this is because i want to show certain custom user roles only on this page. I tried ...
user avatar
0 votes
0 answers
24 views

How to insert the current user's role into the body class in the admin backend

I've tried updating this code from body_class to admin_body_class but it's not inserting the .role-author into the back end body class like it did with the front end body class... i'm guessing it's ...
user avatar
  • 976
0 votes
0 answers
16 views

How to Add a cutsom slug to my custom author role

My new custom user role that I just created has this default slug like demo.com/author/peter , I want to change the it for a particular custom role to demo.com/editor/peter without using a plugin, the ...
user avatar
  • 1
0 votes
1 answer
30 views

Use PHP code to create custom user roles. Call it once?

I have the following PHP code in my wordpress site. I have noticed that when I disable the following code, those two user roles still exists both for current and new users. /* -------------------------...
user avatar
0 votes
0 answers
14 views

Auto Change Wordpress Roles

If a user register as Author / Subscriber / Contributor / Editor then they automatically changed to my custom created wordpress role i.e (writer). Is there any way for that?
user avatar
0 votes
1 answer
15 views

Execute function only for specific user roles

I'm referencing the below solution (which came from here Force Password Complexity) to enforce a certain level of password security. It works as expected, but it is running for ALL user roles. I do ...
user avatar
0 votes
1 answer
19 views

I have 3 types of prices in WP and I need to change price for each specific user role using hooks

not a tough coder so could use some help here. What I'm trying to do is, I have 3 types of prices in WP and I need to change price for each specific user role using hooks https://itgalaxy.company/%D0%...
user avatar
0 votes
0 answers
23 views

Admin user name not showing up in author dropdown

I recently moved my Wordpress site from GoDaddy to Hostinger. Now, my Wordpress user account (which is the admin) doesn't show up in the dropdown list of authors when I create a new page. My admin ...
user avatar
0 votes
0 answers
8 views

implement custom roles in custom plugin

i am developing an Wordpress plugin which actually works quitte good ;-) But i have a requirement to implement user roles. So i am reading stuff about custom capabilities in wordpress. There is so ...
user avatar
1 vote
0 answers
51 views

Custom post types as sub menu pages and role capabilities issue

I'm working on this: Create a menu entry in the admin panel name "Products" Have a dozen of custom post types, all as submenus items of my admin menu "Products" entry Allow a role ...
user avatar
  • 111
0 votes
0 answers
38 views

Error while creating a clone role in wordpress

I am trying to create a new member. The name of user role is Prime Members and those users should have same capabilities as customer. I am using following code. <?php add_action('init', 'cloneRole')...
user avatar
0 votes
0 answers
24 views

Login Based on ip

I have to create an internal site for company. So I have to restrict all people out of the company to have a login. And all people from the company need to access the site without a login
user avatar
0 votes
0 answers
27 views

Why "Mine" is the default view when adding 'capability_type' in register_post_type

I'm tweaking default's wordpress permissions by adding my own via the capability_type and map_meta_cap in register_post_type(), but I noticed that as soon I add the capability_type argument, the ...
user avatar
  • 1
0 votes
1 answer
26 views

Which capabilities are available in Gravity Forms Salesforce plugin? [closed]

Which capabilities are there in Gravity Forms Salesforce plugin and what do they do?
user avatar

1
2 3 4 5
27