Skip to main content

Questions tagged [users]

Refers to accounts with the ability to login and participate in a WordPress site.

Filter by
Sorted by
Tagged with
167 votes
6 answers
421k views

If the current user is an administrator or editor

How can I check to see if the current logged-in user is an administrator or an editor? I know how to do each individually: <?php if(current_user_can('editor')) { ?> <!-- Stuff here for ...
andy's user avatar
  • 2,359
104 votes
8 answers
279k views

How to check if a user is in a specific role?

I have a pretty specific requirement to show different text in a field label on the user profile page based on the current user's role. I can't seem to figure out how to check whether the current use ...
jessegavin's user avatar
  • 3,456
64 votes
3 answers
154k views

How to change the default registration email ? (plugin and/or non-plugin)

After a new user registration, WP sends out an email with the login / password, and a link to the login page. Is there a way to change this defaut email template? I'd also like to change the subject ...
mike23's user avatar
  • 5,981
49 votes
6 answers
57k views

Getting a List of Currently Available Roles on a WordPress Site?

When writing WordPress plugins there is often a need to set up options for which roles on the site have access to certain functionality or content. To do this a plugin dev needs to fetch the list of ...
jerclarke's user avatar
  • 3,043
45 votes
4 answers
136k views

How do I add a field on the Users profile? For example, country, age etc

I'm not very good with computers/codes etc. I use a plugin that makes a registration form thingy and in that form I added country, age group, gender and so on. I click the option that will add the ...
Chloe Aus's user avatar
  • 451
42 votes
4 answers
22k views

Editor can create any new user except administrator

I have set up a WordPress site for a client. The client has the Editor role, however I have installed the Members plugin and given the client the capability to add new users to the WP admin. This is ...
Vayu's user avatar
  • 519
30 votes
2 answers
34k views

How To Add Custom Form Fields To The User Profile Page?

The user profile page has the following fields: Username First Name Last Name Nickname Display name Contact Info E-mail Website AIM Yahoo IM Jabber / Google Talk How can more fields be added to ...
rsman's user avatar
  • 2,290
29 votes
3 answers
12k views

Multiple developers / editors working on a site in progress

Background I'm nearing the final stages of constructing my first fairly large WordPress site, and I'm now encountering some friction. For the most part, the site was developed on my local machine and ...
Gavin Anderegg's user avatar
24 votes
3 answers
19k views

How to check if a user (not current user) is logged in?

I need to display the online status (online/offline) for each author page (custom author page template). is_user_logged_in() only applies to the current user and I can't find a relevant approach ...
Dominor Novus's user avatar
23 votes
1 answer
129k views

How do I display logged-in username IF logged-in?

I'm working on creating some text that says 'Login' to users that are not logged in, and the user's username or display name when logged in. It seems like it should be an easy problem to solve, and ...
Stephen S.'s user avatar
  • 1,029
22 votes
3 answers
57k views

Admin Page Redirect

Is it possible to redirect users to an admin page if they access another admin page? For example if they a user ever hits "all pages" /wp-admin/edit.php?post_type=page they would get redirected to "...
Shae's user avatar
  • 731
20 votes
3 answers
31k views

user_login vs. user_nicename

When you call the get_users() functions, a list of user objects are returned. Each of those users has a number of properties. What is the difference between user_login and user_nicename in those ...
Greeso's user avatar
  • 2,176
20 votes
8 answers
27k views

How to restrict dashboard access to Admins only?

How would we restrict access to the WP admin area to all users except admins? The users on our site have their own profile pages which do all the functions they need. So admin should be off limits to ...
Robin I Knight's user avatar
20 votes
2 answers
11k views

How to allow an user role to create a new user under a role which lower than his level only?

I have three extra roles in my site. Doctor Receptionist Guest those roles are added by following code: * adding Doctor role */ $doctor_role = add_role('Doctor', __('Doctor'), array('read'=>'...
Riffaz Starr's user avatar
18 votes
4 answers
30k 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
17 votes
4 answers
26k views

Allowing user to edit only certain pages

I would want to allow certain user to edit only one page and it's subpages. How would this be possible? I tried the old Role Scoper, but it seems to have a lot of problems and bugs.
naf's user avatar
  • 273
16 votes
7 answers
41k views

How to check if a user exists by a given id

Is there any way to check if a user id exists? I want to create a function similar to username_exists() but which returns if the id exists or not.
Frankolin's user avatar
  • 163
16 votes
9 answers
37k views

Adding fields to the "Add New User" screen in the dashboard

I'd like to add the field "Company Name" to the add new user page in the admin panel. I've done quite a bit of searching and have been unable to find details on how to do this. I can easily add info ...
Zach Shallbetter's user avatar
16 votes
7 answers
17k views

Why are my roles not visible in a Multi-site/Network?

My network is showing roles in some sites and not in others. For some reason that I can't explain, when I add a new user, I have no roles to choose from in the drop down box of a sub-site in my ...
Geo's user avatar
  • 747
16 votes
1 answer
6k views

Custom post type for 'staff' versus using wordpress user profiles?

A scenario I keep coming across is where an organisation might have several staff for whom I want to have some sort of listing and a single profile page with biographical information. Typically I ...
bongoman's user avatar
  • 161
16 votes
3 answers
27k views

Change the Author Slug from Username to Nickname

Hi to the community, is it possible to change the default username slug to nickname if is available? By default the url is something like: http://domain.tld/author/(admin) , is it possible to ...
Philip's user avatar
  • 2,019
15 votes
6 answers
39k views

How to search for (partial match) display names of WordPress users?

I need to create a search page that will display anything related to the supplied search. i.e. comments containing it, events, posts, CPTs and users with that name. How can I search for users in the ...
hannit cohen's user avatar
  • 1,521
15 votes
4 answers
16k views

Remove Ability for Other Users to View Administrator in User List?

(Moderator's note: Original title was "Remove Admin from User Menu") I have created a client administrator role which is essentially an Editor with ability to add/remove users. The article "Editor ...
Carlos's user avatar
  • 153
15 votes
2 answers
18k views

How to use same email for multiple users

I have a very big multisite. And I got a request to enable option that multiple users can use the same email. I found a plugin "Allow Multiple Accounts" which doesn't work properly. I should figure ...
Bob's user avatar
  • 271
14 votes
5 answers
12k views

How to search all user meta from users.php in the admin

The search form at the top of the users listing in the Admin area (wp-admin/users.php) is limited and does not search all of the user meta fields, such as bio, instant messenger handles, etc. I've not ...
John Chandler's user avatar
14 votes
4 answers
34k views

How do I programmatically set default role for new users?

I would like new users of the blog to have custom role, rather then Subscriber. How do I set this programmatically? I know that it can be changed from the backend.
jayarjo's user avatar
  • 518
14 votes
2 answers
3k views

Difference between update_user_meta and update_user_option

Can anyone explain what is the difference between update_user_meta and update_user_option and in which scenarios the both can be used?
mpsbhat's user avatar
  • 297
13 votes
3 answers
37k views

Make WooCommerce pages accessible for logged in users only

I have a website using WordPress, and an e-commerce using WooCommerce. I would like my shop (and all its pages) to be seen by logged in users only. Via the User Access Manager plugin, I have denied ...
Alessandro's user avatar
13 votes
3 answers
24k views

Find out if logged in user is not subscriber

Is there a conditional tag that will allow me to display certain content only if the user is NOT a subscriber?
Nasir Zia's user avatar
  • 293
13 votes
2 answers
7k views

WordPress usermeta scaling for thousands of users

I have developed a CRM plugin for a client integrated with WordPress user management and I stored additional information for each user under the wp_usermeta table. However, the client's customer ...
Sunyatasattva's user avatar
13 votes
2 answers
11k views

Where can I find documentation on what characters are allowed in user names and why?

I would love to be able to use spaces in usernames, but this does not seem possible. Is there a writeup in the codex or somewhere that explains what characters are allowed and why it was restricted to ...
Purcell's user avatar
  • 370
13 votes
3 answers
3k views

Make display name unique

Right now you can make your Display Name whatever you want, you can even impersonate an admin. Is it possible to make the Display Name unique?
FLX's user avatar
  • 1,007
12 votes
9 answers
44k views

Get multiple roles with get_users

I've got some code like this: $query_args = array(); $query_args['fields'] = array( 'ID', 'display_name' ); $query_args['role'] = 'subscriber'; $users = get_users( $query_args ); foreach ($users as $...
blogjunkie's user avatar
12 votes
7 answers
27k views

How to filter users on admin users page by custom meta field?

The Problem WP appears to remove the value of my query variable before it gets used to filter the list of users. My Code This function adds a custom column to my Users table on /wp-admin/users.php: ...
morphatic's user avatar
  • 391
12 votes
2 answers
8k views

Setting admin edit panels & metaboxes positions and visibility for ALL users and admins

My WP 3.3 setup involves several post types and customized edit panels with Advanced Custom Fields plugin (which creates many metaboxes) and other plugins such as SEO metabox panel, Scribu's ...
unfulvio's user avatar
  • 1,814
11 votes
5 answers
37k views

How many users can WordPress handle?

I want to design a member login site in WP but I have a doubt that is WordPress can handle more than 40000 users on same database? I am not sure about this so I am stooping my work here. So please ...
prasad's user avatar
  • 111
11 votes
3 answers
41k views

get_user_meta() doesn't include user email?

I simply wonder why <?php var_dump(get_user_meta(4)); ?> doesn't contain an email address of the user. Instead I have to use get_userdata(4)->user_email; to query the email of the user. ...
mathiregister's user avatar
11 votes
3 answers
2k views

How to get WordPress Username in Array format

I want to create an Autocomplete function in WordPress. I want a search field from where username can be searched. I am using following JQuery UI. <label>Users</label> <input type="...
Minesh's user avatar
  • 317
11 votes
3 answers
37k views

Display user registration date

I want to show user registration date like Member since: 15,dec 2012. I have a code <?php echo date("M Y", strtotime(get_userdata(get_current_user_id( ))->user_registered)); ?> but it ...
Maan's user avatar
  • 135
11 votes
5 answers
7k views

Confirmation required on email change

I'm just wondering why wordpress doesn't send confirmation mail every time user change his/her email address. How do we know that email address is not fake or mistyped? So can anyone give me some ...
PrivateUser's user avatar
  • 3,459
11 votes
2 answers
46k views

What the user_status column?

I was look in the wp_users table a " user_status " column...( all contain zero ) What works is this data?
l6ls's user avatar
  • 331
11 votes
1 answer
3k views

Is there a is_user_logged_in() for multisite?

Is there a is_user_logged_in() function for Wordpress MU / Multisite (3.0+) where I can add in the network site ID like is_user_logged_in(2) where 2 would be the site_id? Update: After a little ...
cwd's user avatar
  • 1,852
11 votes
2 answers
1k views

Override WordPress user with Oauth2 account

I am trying to set up WordPress as an OAuth2 client. All of our users are stored in our proprietary CMS which is an OAuth provider. We have very little (to no) users in our WordPress database, ...
Nick's user avatar
  • 111
10 votes
3 answers
20k views

Check if user is admin by user ID

Any ideas how to check if user (by user ID) is administrator? I don't mean currently logged in user.
jmeinlschmidt's user avatar
10 votes
4 answers
12k views

Showing User's Post Counts by Custom Post Type in the Admin's User List?

I'm trying to figure out how to hook into the /wp-admin/users.php manage page to create custom columns for showing the number of posts users have for the custom post types on WPHonors.com. I created ...
jaredwilli's user avatar
10 votes
2 answers
7k views

How to change user_login with wp-cli?

How to change the username with wp-cli? This does not work: wp user update old_login --user-login=new_login
the's user avatar
  • 1,477
10 votes
4 answers
49k views

get_current_user_id() returns 0?

I'm trying to get the currently login user's id in WordPress. I've used the following code: function users_list() { global $current_user; $current_user = wp_get_current_user(); echo 'User ...
PHP Learner's user avatar
10 votes
4 answers
7k views

Update post counts (published, draft, unattached) in admin interface

I am working on a multi-user WordPress setup and have made it so a particular type of user can only see and interact with posts, images, pages etc that they have authored. The code to make this happen ...
Scott's user avatar
  • 421
10 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
  • 5,981
10 votes
1 answer
859 views

How to Merge Two Authors Into One?

I have several posts in my WordPress site. Some posts belong to Author1 while others belong to Author2. Is there a way (plugin?) to merge the authors (For e.g. merge Author1 into Author2) and have all ...
Regi's user avatar
  • 111

1
2 3 4 5
42