All Questions
2,085 questions
0
votes
1
answer
40
views
Group users by meta field, with name of meta field as group title
I'm creating a employee photo directory based off users from my site. I'm trying to add front end filtering for this query and I have it mostly working.
What I'm trying to accomplish is to sort 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 ...
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(...
0
votes
1
answer
21
views
Only registered users can see part of the contents of single.php
On my wordpress blog, I want a part of single.php to be visible only to registered users.
For example:
/code/<?php the_title(); ?>/code/
Is there a function that works on a php basis?
What ...
0
votes
0
answers
31
views
Search results not finding in paginated pages just in visible rows
I created this plugin to display a list of registered users with the Faciliator role. Displays the list in a table with name, country and avatar as titles. It works fine but the search box only ...
0
votes
2
answers
2k
views
WP_Query filter by custom meta
I try to make a page to list users with a meta values.
I search to get all users with a site url or user_description
Thx
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:
...
0
votes
1
answer
654
views
How to order users alphabetically by name? in plugin UPME
I have this code:
<?php
class UPME_List_Cards {
public $upme_options;
public function __construct() {
global $upme;
add_shortcode('upme_latest_members_list', array($this,'...
0
votes
0
answers
241
views
Invitation link to a site in multisite network does not work?
I have a WP Multisite, and when a subsite want's to invite a user to the site it will send out an invitation link which looks like this:
https://example.com/testsite/wp-activate.php?key=...
0
votes
1
answer
20
views
Buddypress: "Auto load" specific usermeta in WP?
I have a Buddypress membership page, and for specific customizations I need a few usermeta fields being loaded all the time, for the currently logged user as well as (in case any) the displayed user-...
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 ...
0
votes
2
answers
77
views
After reading 3 story by user ask for subscription popup
I am new in word-press development, i want to make a news website in which user read two story then ask him to pay(Subscription Plan), when he registered he can read unlimited
0
votes
1
answer
100
views
(How) does WordPress protect direct access of user data?
I am setting up a WordPress with a user system.
User information (names, profile picture) of all users should be private, and only accessable when logged in.
The "Ultimate Member" plugin ...
3
votes
1
answer
4k
views
Remove all users from site except one using WP CLI
I want to remove all users from the WordPress site using WP CLI except one (me, as administrator).
This command will remove all users:
wp user delete $(wp user list --field=ID --number=10)
...
2
votes
3
answers
3k
views
Exclude subscriber users from user list
I want to exclude Subscribers from a user list. My code is:
$users = $wpdb->get_results( "SELECT display_name FROM $wpdb->users ORDER BY display_name ASC" );
How can I change that so ...
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 ...
0
votes
1
answer
62
views
Allow Html pages for users with specific roles
On my website there is, beside my WordPress installation, a folder full of html files.
I need to protect them using the WordPress user authentication system. The policy is simple: if you have a role, ...
3
votes
2
answers
2k
views
Suddenly all emails in User have [email protected]
I don't know what happened but suddenly all emails under "User" are changed to [email protected] - see the below picture.
Of course, my first thought was a plugin problem, but when I disable ALL ...
0
votes
2
answers
326
views
Can we get user profile page using user_id in the URL?
The current default profile page is like example.com/user/johndoe. But can I access the page via example.com/user/?user_id=21 where 21 is johndoe's user_id.
1
vote
1
answer
1k
views
WP admin user search doesn't return all users
I have about 1,500 user accounts (subscribers). When I go to the Users section of the WP admin/backend area, and then try to search for a user, it is very unreliable. If I search for a last name or ...
0
votes
0
answers
16
views
Issues with creating user profile for a subscriber, but with different profile page and functionalities
I am building a website where two types of subscribes have to register and get access to a profile page:
Volunteer
Person in need
I attempted to do so, but the person in need user profile still ...
0
votes
0
answers
1k
views
How to display comments by logged in user and responses?
I want to create a profile page and display the logged in persons comments. And, also the responses to his/her comment.
Like this:
Post title
Comment (by logged in user)
---> Responses (...
0
votes
2
answers
906
views
AJAX call not initializing for non-admins in WordPress
I developed my ajax functionality while using a WordPress admin account and everything worked correctly. Testing as a user, however, I cannot get the functionality to call - and pressing the "...
0
votes
3
answers
589
views
How do I change the user via SQL?
I change a user via SQL in wordpress:
SET @old_user='old_user';
SET @new_user='new_user';
UPDATE wp_users SET user_login = replace(user_login, @old_user, @new_user);
UPDATE wp_users SET ...
0
votes
1
answer
629
views
Error when send reset password
I forget my Password in my site, So i go to this link to res
http://domain.com/wp-login.php?action=lostpassword
And put my email and send it.
I received an email, But without link to reset my ...
3
votes
1
answer
2k
views
How can I delete a user from entire multisite nework
I'm making a front-end user delete button but it only removes the user from the current installation and I need to remove them from the entire multisite network so they are able to sign up again with ...
0
votes
0
answers
407
views
Let admin users edit member profiles from front end
I'm using WP User Frontend Pro, but the pro version lacks the feature of letting admins edit registered users profiles from front end.
I'm building a web app using WordPress, and the administrator ...
5
votes
2
answers
2k
views
Post comment as different user than logged in
When I reply to a comment in the WP backend in the "Comments" section (edit-comments.php) I can only post the reply as the logged in user.
Is it possible to select a certain user like in the "Add new ...
0
votes
1
answer
1k
views
SQL to set Display Name to First Name + Last Name
I'm trying to set the wp_users.display_name for a rather larger users db using SQL query.
Got till this point:
SELECT x.display_name, x.first_name, x.last_name
FROM
(SELECT
u.display_name,
f....
11
votes
3
answers
42k
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.
...
0
votes
1
answer
258
views
Sorting Users page admin column with ACF field
I have a CPT called Companies. I created an ACF relationship field called user_company that gets displayed in the Users profile page.
When a user registers, I have to go in and assign them to a ...
23
votes
1
answer
132k
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 ...
2
votes
4
answers
7k
views
Get total number of authors on the site
How do I get total number of Authors on the site?
This shows summery of users on the site but I just want to get number of Authors.
<?php
$result = count_users();
echo 'There are ', $result['...
0
votes
1
answer
456
views
Wordpress: New user role which is ONLY allowed to manage media
I would like to have a new user role (or restrict a role which is already available from Wordpress) which can only manage media (upload, delete pictures etc.) in the wordpress backend - every other ...
0
votes
0
answers
197
views
Unable to retrieve Users (Not logged in) through WP Rest API
We are able to retrieve Rest API results of our WP database, running a Learndash plugin.
We can retrieve details while not logged into the WP site, although limited (10 records or so).
While logged in ...
0
votes
1
answer
175
views
How to add custom user role into wordpress
I added this code snippet to my function.php to create a user but after logging with this role I'm unable to edit the learndash course lessons quizzes...
add_role( 'learndash_content_manager', '...
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 ...
0
votes
0
answers
515
views
Can't retrieve user email address with REST API
I would like to retrieve the email address of an user by id with the REST api from Python. The problem is I don't get the email in the JSON from the two calls I added below. Based on the docs it ...
0
votes
1
answer
21
views
Some data of one custom user profile is erased when I update another custom user profile
I have some problems with custom user profil. I Created 2 différents user profiles :
one is calld "particulier"
the other is called "entreprise"
You can see the code below.
The ...
0
votes
1
answer
101
views
How to handle Wordpress account for terminated employee
An employee was terminated and I want to know the best way to handle this individual's Wordpress/Woocommerce account. He was in the Shop Manager role and he mostly worked doing order fulfillment. I ...
1
vote
1
answer
1k
views
Why is it that not all users have a 'session_tokens' meta_key record in the usermeta table?
I've created my own code based on this good article - https://shocksolution.com/2019/04/16/find-last-login-time-for-wordpress-users-in-the-sql-database/ to get the last login date for a user.
I'm ...
0
votes
1
answer
2k
views
How to add registration date and last login date to user list page
To assist with managing a WordPress install with a large number of users, is there a simple way to include the date the user registered and they date they last logged in as additional columns on the ...
1
vote
0
answers
77
views
How to create a User Role and give permission to only use Web Stories plugin?
I want to create a new user role "Story Maker" with only the "Google Web Stories" plugin shown in the dashboard for the user to create and publish stories.
I don't want the user to ...
0
votes
1
answer
84
views
How to authenticate/verify login credentials & check for user meta without logging in?
I have custom login form and i used wp_signon() to authenticate. However, i wanted to run an additional check for usermeta and if the user has account_status === pending, throw an error or or prevent ...
1
vote
1
answer
646
views
How to allow WordPress updates to only one specific administrator?
I found a code to prevent WordPress update for certain user role:
add_action( 'init', function () {
if ( ! current_user_can( 'administrator' ) ) {
add_filter( '...
0
votes
1
answer
363
views
WordPress password as plain text in email
I am working on a project and we need to send users current passwords when they log in.
So the only option is to the use the password reset feature when the user enters the email, an email will be ...
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 ...
1
vote
2
answers
4k
views
Force user to change their password on the frontend at the first login and password policy
I have 3 users roles on my platform with no access to the WordPress backoffice "external_user1" , "external_user2", "external_user3".
I need to force every user with one of this roles to change his ...
0
votes
2
answers
3k
views
How to get a users list by who created them?
I have two users with the capability to create other users. But their roles are not same.
Tom - Role is Administrator
Jackie - Role is CMS Manger (a custom created role)
Both have capability ...
0
votes
1
answer
25
views
Can I provide a user's user_ID to them and can it also be searchable in a member's directory
We would like a user (student) to have a student ID that they can quote and this stays with them as they learn with us.
When they create a profile, by registering on our site is it possible to provide ...