Questions tagged [user-access]
The user-access tag has no usage guidance.
399
questions
34
votes
5
answers
66k
views
Allow member to have access to custom post type only. Permission to only edit their own posts
OK I'm looking for the best way to attack this.
I'm very comfortable with PHP and making custom post types with custom meta fields in WordPress.
Here is what I'm looking at doing:
User registers ...
29
votes
4
answers
55k
views
How do I create a custom role capability?
I wish to create a custom capability for accessing the interface of my plugin.
Should the plugin manage adding this capability to all the administrator accounts on activation?
If so: Does WordPress ...
21
votes
2
answers
38k
views
How to check if user is in back end?
In my application, i have one form.
Now if user is in front end i want to display the title but if he is in back end i do not want to display it.
I do not want to check it based on user role.
21
votes
3
answers
2k
views
How to enable suggested edits?
I like the idea of enabling any user of my website to suggest edits to a page. Much like the edit system on Stack Exchange but different in that anyone should be able to edit, not just registered ...
21
votes
1
answer
493
views
With Rest V2 (WP4.7) how does one restrict certain RESTFUL verbs?
I am aiming to restrict certain RESTUL verbs per custom post type. For example, given a Vocabulary custom post type, I would like to say:
Permission Matrix
+-------+---+----------+
|index | X | GET ...
18
votes
3
answers
29k
views
How to programatically change username (user_login)?
As in the title, how to programatically change user's login?
I wanted to use wp_insert_user function, but it appears that when updating current user, it doesn't change their username. Should I use $...
12
votes
5
answers
12k
views
How to restrict attachment download to a specific user?
I have a very specific use case where the site built for a lawyer and each of his clients can login to their own 'specific page/portal' (custom post type) without the ability to access wp-admin etc. (...
10
votes
1
answer
5k
views
Filtering the Admin Comments List to Show Only Comments from the Current User?
In the Comments page (/wp-admin/edit-comments.php), every logged in user can see all the site comments.
I'd like the users to see only his/her own comments and the comments that are left to his/...
9
votes
5
answers
26k
views
How to restrict access to uploaded files?
I have a restricted area on a website that can only be accessed by logged in users. For that I created a page template with a 'current_user_can()' condition.
My problem is that the documents attached ...
8
votes
3
answers
7k
views
wp_update_user not updating
In desperation I am asking for help in this forum too - if someone (ANYONE!) could take a look a this post and see if they could help I'd be eternally grateful
http://wordpress.org/support/topic/...
7
votes
4
answers
10k
views
HTTPS leads to Sorry, you are not allowed to access this page
I have a fresh Wordpress installation that works fine. I decide to make it work under HTTPS so I go in the General config and change the "Wordpress Address" and the "Site Adress" from http://my....
7
votes
4
answers
17k
views
Allowing users to edit only their page and nobody else's
We currently have about 50 pages, each of which I want a user (eg, bob, rob, smith) to be able to edit only 1 page. For example, bob & smith each have their own page. I do not want bob to be ...
7
votes
2
answers
23k
views
Restrict admin access to certain pages for certain users
As the title says, I'd like to restrict back-end access to certain pages for certain users.
While doing a site with 45-50 pages, I realised it would be a much better user experience if the Page menu ...
7
votes
1
answer
18k
views
Can an admin check passwords of registered users?
I have a site where I open accounts for users and hand over login credentials to them.
Now, Let's say that a user forgot his password, and wants to reset it. He clicks "Lost your password?" link on ...
6
votes
5
answers
13k
views
Troubleshooting a "You do not have sufficient permissions to access this page" error
I have a multisite installation running WP 3.5. My main site and a few other blogs on the network work fine. However, if I register a new user and site, that user gets the "You do not have sufficient ...
6
votes
5
answers
7k
views
How can I hide a category from Contributors in the edit/add new post screen?
I have a situation where I need to hide a specific category and it's children from users who are logged in as Contributors. I don't want them to see this category and it's children in the categories ...
6
votes
2
answers
1k
views
Disallowing Users of a Custom Role from Deleting or Adding Administrators?
(Moderator's note: The original title was "Custom User Role Restrictions")
A project I am working on requires me to create two new user roles - one for the owner of the website and the other for ...
6
votes
1
answer
11k
views
How to assign specific users the capability to edit specific pages / posts / custom post types
I'm trying to implement what seemed like a relatively straight forward idea, basically I am building an access control plugin to control viewing and editing of a custom post type (in this case '...
6
votes
1
answer
13k
views
Hide Admin Menu for Specific User ID who has administrator Role
I am trying to hide almost every single admin menu from wordpress dashboard for a specific user id who has administrator role. I want to give that user only option to edit a certain custom post type ...
5
votes
1
answer
17k
views
How to get all capabilities of an existing user role
How can I get ALL the capabilities of an existing user role (eg. Author) ? I'll be using it to quickly duplicate an existing user role, then create a new role then assign or remove capabilities to a ...
5
votes
2
answers
4k
views
Allowing an email as the username?
Is it possible to allow people to utilize their email as their username?
5
votes
1
answer
1k
views
Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
I need to redirect logged-in and non-admin users, from page with id 172, to the home of the website. Note that users that are not logged in can actually see the page.
add_action('admin_init', 'xyz');
...
5
votes
1
answer
453
views
Theoretical Multi-Server WordPress Setup with Shared Users
The organization I work for would benefit if we could take the existing WordPress installations that are located on several (~5) different servers and be able to use a universal database with the ...
5
votes
3
answers
25k
views
Limit access to posts/pages by user roles
I'm looking for a way to protect content by user roles.
Example:
you have to be registered to view posts (frontend).
If a user is a subscriber he can read post 1, 2 and 3, but if the user is a ...
5
votes
3
answers
2k
views
Allowing specific users to only add posts using certain custom taxomy terms
I was searching through the forums, but I can only find slightly related issues.
This is my problem:
I'd like to assign some editors the capability to only add posts in a predefined term of a custom ...
4
votes
3
answers
1k
views
Is WordPress' is_user_logged_in() secure?
I've been wondering about this for a while. Is the following if statement safe enough? Is it easy to break through the code and get access to the content when not logged in?
<?php if ( ...
4
votes
7
answers
14k
views
Website Visible only to Registered users
How can I disable access non registered users? If the user is not logged in I would like to redirect them to a custom registration/login page. Is it possible this using below code as I dont want to ...
4
votes
1
answer
12k
views
Check if specific username is logged in
How can you check if specific username is logged in?
4
votes
3
answers
16k
views
How can I hide media library images from general users?
As an admin I really like the features and functionality of the WordPress 3.5 media manager.
With a multi-user site however all users can see all images in the media library - whether uploaded by ...
4
votes
3
answers
13k
views
How to restrict a page [without plugin]
How to restricted a page in wordpress. For example : user [without login] can see 5 of game list. [example.com/game/]
and after click 'view more', user must login/register and after that, user can ...
4
votes
1
answer
12k
views
How to manually activate user in dashboard only by admin
I'm looking for a function that allows admins (only) to activate new users. When a user registers he have to be approved by the admin before he gets access to log in.
Does anyone know how I can do ...
4
votes
1
answer
3k
views
Post list based on the user that is logged in
I've been all over this site and google, and the WP codex looking for an answer to this one. I know it's out there, and I know it's easy. Maybe has something to do with user_nicename, but I just can't ...
4
votes
1
answer
2k
views
REST API: How can I restrict a custom post type to only be accessible by authenticated users?
I have a custom post type configured to be accessible via the WP Rest API v2.
How do I lock the access to this custom post type so that only the authenticated users can perform GET requests?
4
votes
3
answers
9k
views
Only allow administrators and editors to access wp-admin
I am trying to restrict access to wp-admin so that only administrators and editors are allowed. At the moment I am using this function:
function restrict_admin(){
//if not administrator, kill ...
4
votes
4
answers
2k
views
Show custom post type endpoint in REST API just if user has capability
I created a custom post type for WP, that should just be visitable for user that have a custom capability read_cpt. Within templates and pre_get_posts I can run checks to include or exclude the CPT by ...
4
votes
1
answer
1k
views
Restrict users on multisite WordPress install
I have a series of sites that I maintain as part of a WordPress multisite install. I'd like to be able to create users accounts that are restricted to viewing only a single one of these sites. Is ...
4
votes
1
answer
4k
views
How do you add a custom option to user data?
I would like to add avatars to my users. I have a limited group on a site I'm working. Uploading isn't really a problem we can just put the images on the server and use URL's to set our avatars(Only ...
4
votes
1
answer
3k
views
Using JWT to authenticate a user with an external system?
We have a WordPress application which is going to be linked with a parent system. We want to use JWT for authenticating with the parent. The idea is, if the user is not logged in on the parent, he ...
4
votes
1
answer
1k
views
The 'user_has_cap' hook seems to take two page loads to trigger
This question relates to another question I asked recently (http://wordpress.stackexchange.com/questions/29009/how-to-assign-specific-users-the-capability-to-edit-specific-pages-posts-cus/), the ...
4
votes
0
answers
221
views
Custom post type capabilities require "create_posts" to access the edit posts list page
I have a custom post type and a custom user role that I want to be able to do everything but delete and create this post type. However, this user role can't view the dashboard's list of posts for ...
4
votes
1
answer
808
views
Basic auth WordPress REST API dilemma
Today I tested Basic Auth for the WordPress REST API and it worked perfectly. However, I heard this was a dangerous way of authentication. This is understandable, since people can look into JS files ...
4
votes
1
answer
1k
views
Give editors access to particular plugin - turn "admin.php" into "edit.php"
I'm using the Business Opening Hours plugin. I made it appear in the sidebar using the Client Dash plugin, but when the Editor clicks it, they cannot access it, only the Admins, how can I change that?
...
4
votes
2
answers
297
views
Allow anonymous user to access Themes Customizer
I created a theme and use Themes Customizer. Is there any way I can give anonymous users access to the themes customizer without the ability to save it?
It will be very convenient in terms of user ...
3
votes
3
answers
13k
views
Temporarily disable user role login and replace with message
Is there a simple way to temporarily stop a user role logging in with wordpress?
For example, if I have a user role called media, how can I block them from logging in?
I would like a custom message to ...
3
votes
1
answer
3k
views
Access code/password only restricts page access, no user registration..?
Does anyone know of a plugin that will allow for a simple access/invite code to be given out, and when entered, will allow access to a certain page?
I'm looking to only have one input field and no ...
3
votes
2
answers
2k
views
How to show a category post to a specific registered user
I'm working a private blog and I'd like to know if this can be done with any other plugin or any other way:
Lets say we have 3 categories: CA, CB and CC, and 3 users, UA, UB and UC, all of them can ...
3
votes
1
answer
335
views
Add user capability and check against it
I just realized the following:
// Call the current user info
global $current_user;
// Add a capability
// and set the 2nd argument ($grant) to false
$current_user->add_cap( 'some_cap', false );
...
3
votes
2
answers
2k
views
how to add custom user capabilities using add_user_meta or something else?
i have two WordPress sites with SSO Configurations as described here but the plugin in the answer didn't work for me so i tried to write a code to add capabilities for second site users:
$...
3
votes
1
answer
2k
views
Copy a user from one WordPress site to another
Is it possible to copy a user from one WordPress site to another?
I copied the record from the user table and all the related records from the usermeta table (12 records by default) but I think ...
3
votes
1
answer
802
views
Restrict acceess of a page in backend
How can I restrict editing of a page from backend only to a specific user?
I tried a few plugins but I thought doing it without plugins would be the way to go for me.
What measures I can take to ...