All Questions
192 questions
104
votes
8
answers
283k
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 ...
167
votes
6
answers
427k
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 ...
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 ...
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 ...
9
votes
2
answers
7k
views
Commenting in user profile page?
I am trying to build custom user profile with the guidance of this tutorial: How to make a WordPress profile page
I have successfully implemented it to my theme, everything is working well.
Now what ...
46
votes
4
answers
137k
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 ...
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 ...
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 ...
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 ...
49
votes
6
answers
58k
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 ...
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 ...
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.
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 ...
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 ...
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 $...
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 ...
3
votes
4
answers
15k
views
User Profile / Add Custom Fields
Hello: I am trying to add 7 custom fields to the standard Wordpress wp-admin/profile.php page. There are a few site which suggest a simple bit of code to do this, for example:
http://wpengineer.com/...
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 ...
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 ...
23
votes
1
answer
131k
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 ...
20
votes
3
answers
12k
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'=>'...
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 ...
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 ...
12
votes
3
answers
38k
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 ...
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 ...
7
votes
1
answer
8k
views
How to use alias domain for multisite installation?
Is it possible to use alias-domain for multisite installation? I have tried domain-mapping plugin and Multi Domains plugin for WordPress, but this does not solve this problem.
Example:
I have ...
6
votes
1
answer
7k
views
How to limit users to one comment per post
I am using WordPress as a petition site and hacking the comments system to work as the petition signup. I would like to find out how I can limit a user to post only one comment per post. So far I can ...
5
votes
7
answers
52k
views
How to change user`s avatar?
Is there a way o changing user's avatar without plugins? Why there's no "Avatar Upload" section in Users > Your Profile?
I can't use a plugin. Am I blind or being forced to use Gravatar? ;/
3
votes
2
answers
2k
views
How to use hyperdb to separate and share a user dataset between wordpress installs?
I'm looking for a way to separate my users and usermeta table to be in a different database than my main WP install. The end goal is sharing these table over a number of WP installs.
From what I read,...
3
votes
4
answers
5k
views
How to set custom upload directory per user after moving content directory
I set the content and the wordpress directory of wordpress like described in the codex:
define('WP_SITEURL', 'https://' . $_SERVER['SERVER_NAME'] . '/wordpress');
define('WP_CONTENT_DIR', dirname(...
1
vote
1
answer
22k
views
Get user input from a form
I am trying to create a form that will allow users to update their information on the front end. I am just starting to learn PHP (I know C# very well). If I use this code to create a form on a ...
22
votes
3
answers
59k
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 "...
20
votes
8
answers
28k
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 ...
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 ...
16
votes
10
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 ...
15
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.
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 ...
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
3
answers
8k
views
Email user when password is reset by admin
I am really new to WordPress programming and I am not even sure if this feature exists. What I am trying to do is send an email to users (not admin) when an admin changes their password/email?
At ...
7
votes
3
answers
7k
views
wordpress multisite, how to keep user on subdomain throughout registration process?
I am running wp subdomain multisite in combination with domain mapping. This means I can create a new subdomain site xyz.site.com and map the domain name 'xyz.com' to that site.
The problem I have is ...
7
votes
5
answers
12k
views
WordPress auto login after registration not working
I looked up a bunch of threads trying to figure out how to automatically log a user in after registration, and came up with this.
function automatically_log_me_in( $user_id ) {
$user = ...
4
votes
1
answer
8k
views
Getting all user metadata from user
I am trying to show bio and other custom metadata for my users in a page. So, i want to query the user metadata table for it. I have tried but did not find any functions for that.
What i am looking ...
4
votes
3
answers
4k
views
Set a maximum upload count for users on a specific user role
For users with the Contributor user role, I want to restrict the total amount of images that they are allowed to upload. I found this code posted on an answer here:
add_filter( 'wp_handle_upload', '...
3
votes
2
answers
14k
views
Show User Their Password
I've got a few automated scripts that run to notify users of certain updates to the application, etc... and for one in particular, I need to be able to display the users user_login and their password.
...
3
votes
3
answers
6k
views
How to delete users with no order history through phpmyadmin sql?
I have a wordpress ecommerce website which I have begun to update after not touching it for over a year. The first thing I did was implement reCaptcha into all inquiry and contact forms to reduce the ...
3
votes
1
answer
5k
views
How to Set an Individual Homepage for Each User?
I would like to give my users the ability to customize the homepage of the site. For example, if somebody is not logged in only the default categories appear.
Once someone creates an account and ...
3
votes
1
answer
2k
views
Custom taxonomy on users with UI
WP lets us register_taxonomy() with users as the object type, thus creating taxonomies mapped to user IDs rather than post IDs.
Unfortunately this method is poorly documented and many features don't ...
2
votes
3
answers
6k
views
Add a custom column in users list page
I need to hook to the users list page.
I Need to add a checkbox column for each user to remember if they have paid or not.
Thanks for help because can’t find snippet to hook to this admin page.
2
votes
5
answers
6k
views
How to use tinyMCE for user “biographical info” without messing with any core file?
I noticed when you typein the user's “biographical info” on the profile, it shows up in one page! Looks really terrible. So:
Is there a way to use tinyMCE or other solution for user “biographical ...
2
votes
1
answer
12k
views
How to create custom LOGIN and REGISTRATION forms?
I have developed a theme for Wordpress and I need to customize login and registrations form.
At the moment, as usual, the login and the registration URL are:
http://www.example.com/wp-login.php
http:/...