Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
19 votes
4 answers
31k 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 $...
Mateusz Hajdziony's user avatar
12 votes
5 answers
27k 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 ...
mike23's user avatar
  • 6,029
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 ...
zealeus's user avatar
  • 73
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 ...
luqo33's user avatar
  • 248
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 ...
NetConstructor.com's user avatar
6 votes
1 answer
14k 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 ...
Md. Amanur Rahman's user avatar
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?
NetConstructor.com's user avatar
4 votes
1 answer
13k views

Check if specific username is logged in

How can you check if specific username is logged in?
Shae's user avatar
  • 731
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 ...
Demilio's user avatar
  • 883
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 ...
Lynne's user avatar
  • 116
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 ...
Jem's user avatar
  • 185
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 ...
Rick Curran's user avatar
  • 1,076
4 votes
1 answer
881 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 ...
Jayce's user avatar
  • 43
3 votes
1 answer
339 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 ); ...
kaiser's user avatar
  • 50.8k
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 ...
Nelu's user avatar
  • 197
3 votes
1 answer
3k views

How to remove "Super Admin" from All Users for those that are not a "Super Admin"?

I would like to remove the filter at the top that says "Super Admin" for users that are not a "Super Admin". How do I go about doing this? This screenshot shows what I am talking about:
Matt's user avatar
  • 1,131
3 votes
3 answers
1k views

Can I create users that have access to *some* other users posts instead of all other users posts?

I’ve been using basic user rights functionality on a multi-user WP site for a while and its worked out great, having most user accounts just have access to their own posts but a few “editors” having ...
AdamJones's user avatar
  • 328
3 votes
0 answers
746 views

How to customize wp_signon()

I am trying to get a customized sign on process. The features that are absent in WordPress by default are the following: Allow user to choose a password at the time of registration. Allow user to ...
Srihari's user avatar
  • 224
2 votes
1 answer
1k views

Check if someone is editing a post (this content is currently locked)

I'd like to create a kind of auditing. How can I check if an user is modifying an article? Is there a db query I can do to achieve this task? I've found the following solution but I wonder if there ...
Revious's user avatar
  • 323
2 votes
1 answer
3k views

How can I get multisite primary blog (url or path) for current user?

In a multisite setup, when users are visiting a blog/site that there are not a member, I would like to display a link to "HOME" that takes them to their "primary" blog. I know how to determine if a ...
Rachel Baker's user avatar
  • 1,946
2 votes
2 answers
5k views

Can you have multi-site WP and keep users separate?

I'm aware that multi-site exists but I've never used it. Could I use it in a type of reseller mode, where I ran one install of WordPress but provided completely separate sites for separate users? ...
AmbroseChapel's user avatar
2 votes
1 answer
2k views

Set default page for user account in admin

I have set up an ecommerce site using wordpress/woocommerce and am now adding the users who will be dealing with the orders to the site. The only part of the site that they need to have access to is ...
trustfools's user avatar
2 votes
1 answer
6k views

Managing Users and Creating Groups [closed]

We're going to be transitioning from a small, outdated CMS that's no longer supported, to WordPress for our new CMS. Our old CMS allows us to restrict access on the back-end so that by default User A ...
j08691's user avatar
  • 785
2 votes
2 answers
153 views

Add a wordpress blog to my website having users

I have a php/mysql based site with users segregated into different groups... i want to add blogging system to it so that each group has its own blog which can be authored by users who are designated ...
Nilaksh Das's user avatar
2 votes
0 answers
173 views

Share user table from WP with Drupal

I'm developing a sister website to a well-established private site that is already built in Wordpress. I can't use Wordpress to create what I need and I am therefore using Drupal. The owners of the ...
N.C.'s user avatar
  • 21
1 vote
1 answer
174 views

Log all users out of all locations after 24 hours

Good day, experts. Please I need the code that can help me log all logged in users on my WordPress website out of all locations after a particular time. This is what I have so far: add_action('...
Raphael Oluwasanmi's user avatar
1 vote
2 answers
1k views

Hide everything on site for visitors except specific page IDs

I have a client who wants to close down access to the entire site, every post, category page, archive etc (while keeping the content), except for three specific pages (Start, about us, contact). None ...
talven's user avatar
  • 103
1 vote
3 answers
7k views

Redirecting or displaying a message on first login

I've been trying to decipher a way to display a message to a user on first login and can't seem to get it to work. I'm not sure what I'm missing, or if there's something else I need to do. Any help ...
Zach Shallbetter's user avatar
1 vote
1 answer
1k views

show text If special user is logged

I want to check if special user id is logged in WordPress. i know we have a function name is_user_logged_in() but we can't change the id of user logged in, in this function. I need a function like ...
saeed shabani's user avatar
1 vote
1 answer
149 views

Upgrade Nightmare - No Posts, Permissions Issues and Can't Create a new post

Symptoms: Can't view ANY previous Posts, but the correct totals are listed by class - published, draft.... When creating a new post - no save or publish button Unable to administer ANY plug-ins - ...
jon gatrell's user avatar
1 vote
1 answer
94 views

How do I count the number of pages a user has seen on my site, and force them to log in after a certain amount

I'm looking to write a little function that counts how many pages the user has clicked through in this section. When it gets to a certain amount, I want to prompt them to log in and prevent them from ...
DJZEEGLER's user avatar
  • 119
1 vote
1 answer
367 views

How to disable a specific page for a specific user

For say, I have this page https://www.website.com/courses/wp-admin/admin.php?page=wpProQuiz&action=delete&id=1 I want to disable this page for the username remo. How can I do this?
Pravin Nath's user avatar
1 vote
2 answers
1k views

remove/hide pages from users backend

I'm using this code in functions.php to hide/remove some pages from custom users backend and works well, but how can I reach to hide the subpages as well? add_filter( 'parse_query' , '...
mesu's user avatar
  • 11
1 vote
1 answer
52 views

Restrict users post for himself

I am trying to build a system that lists users posts only (that I have managed to code) but also restricts users from seeing eachothers posts. If user A has his post under: domain.com/category/postA ...
Mastafu's user avatar
  • 45
1 vote
3 answers
6k views

How to create user groups and allow custom posts and plugin modify/access to specific group?

I am looking for plugin or is there any method/function to create user groups and give an access them to modify/access.
Mahesh's user avatar
  • 31
1 vote
1 answer
2k views

How to display only logged in user's post comments in comments area

I am making a custom Wordpress site where School students logged in and add their posts. I am giving them rights to use wp-admin panel with little customization and modification. QUESTION: "How can ...
Nikhil Joshi's user avatar
1 vote
1 answer
1k views

Control Category of each user can post

i need to know if has some plugin to control category of each user can post. Exemple: USER A - Only can post on the category A USER B - Only can post on the category B Thanks for TIPS!!!
Preston's user avatar
  • 147
1 vote
1 answer
2k views

Allow user access to Dashboard only!

Update: This snippet below removes the menu also for my admin account: function remove_menu_items() { global $menu; global $user_ID; if( $user_ID ) : /* Dashboard only acccess ...
Simon's user avatar
  • 11
1 vote
1 answer
557 views

Restrict access of admin uploads to certain logged-in users?

This is a very open-ended, speculative question with lots of possible angles: has anyone worked with ways to restrict the access of certain uploads to a logged in user? I.e., how can the site admin ...
markratledge's user avatar
  • 8,735
1 vote
0 answers
2k views

wordpress user roles are not working

I have never assigned or used a role before on this site, I have just created a new user role with plugin "user role editor" and also assign an editor Role to other account, whenever I log ...
Rehab Ahmad's user avatar
1 vote
1 answer
21 views

Displaying different in-page content to cliente/admin

i'm a young informatic engineer student who is developing his first wordpress website. It is a booking website when a client can see the available hours in certain local and book it, and the local can ...
javier romero's user avatar
1 vote
0 answers
377 views

Good way to block users within a multisite setup without deleting them?

This is probably a common problem with multiple possibilities to solve. However I am asking for an easy solution as I guess I am not the first one to have this problem. Assume we have a huge company ...
Blackbam's user avatar
  • 565
1 vote
0 answers
115 views

Problem with automatic role change through cron job

I have a function called by a daily cron job that automatically changes the role of users after a period of time. The 1st role update should happen 120 days after registration, and a 2nd role update ...
Cyrille Kriegel's user avatar
1 vote
0 answers
470 views

Subsite access without being a member of the subsite in wp multisite network

How can a user access a subsite without being the member of that subsite in a wp multisite network? What I understand is that a user can not access a private post in a subsite if he is not the ...
bakar's user avatar
  • 101
1 vote
0 answers
360 views

Reset Password policy

Looking for to add reset password policy. Password specifications : 12 characters in length, 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character. I find a hooks for manage ...
Samuel's user avatar
  • 354
1 vote
0 answers
127 views

How can I allow an User to publish only 5 posts per month?

I want to give my users the ability to publish posts. User Role 1: Can Publish 5 Posts per Month User Role 2: Can publish 10 Posts per Month And User Role 3: Can Publish 15 Posts per month It should ...
Leon's user avatar
  • 11
1 vote
1 answer
506 views

Create custom post with custom user rules

I am create a custom user post type testimonial and want to give permission to user to edit and delete there post but its show some error. 1. I created user rule. function ...
Shiv Singh's user avatar
1 vote
0 answers
210 views

Where are $current_user->allcaps set?

I recently found a problem with WP in which even the admin has no permission to get to anything on /wp-admin/. Oddly enough, when I compared the $current_user->allcaps to those on a normal site, I ...
NoBugs's user avatar
  • 452
1 vote
1 answer
362 views

Users can only view their content from the front end

There was a great answer to how users can manage their posts only from the back-end. What I am wondering, is how to allow users to only see their posts, pages, etc, which have their user id attached ...
Keith Groben's user avatar
0 votes
2 answers
10k views

Custom user profile, registration, login page with theme

WordPress user profile page uses the administration interface, and its user registration / login page is not part of the theme. I would like to change it into the custom theme of my site customize ...
He Shiming's user avatar