All Questions
2,085 questions
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 ...
0
votes
1
answer
266
views
users post count
I'm trying to set up users archive pages;
I notice that, if a user exists and is the owner of a custom post, it doesn't have an archive page;
so I looked inside user.php in order to include custom ...
2
votes
0
answers
822
views
Rest API code to get ID of current user not working: get_current_user_id() gives 0
Background
I am trying to write Rest API code to get the ID of the user who triggers the function in question. I found a fantastic answer to this exact question, that was very kindly provided by user ...
0
votes
1
answer
107
views
Filter users in a search
I have made a custom search in users in wordpress and I added it to the landing page by using a shortcode. I want to filter them according their roles, it means I want to exclude all Admin users.
How ...
0
votes
0
answers
115
views
Adding data to User profile
Some plugins for wordpress add fields to the users profile. For example "Company" or "Store" or "Group". How can I add the values to this fields from a custom a frontend ...
1
vote
1
answer
15
views
Show all posts by author
I used to have a page on my site where it would show all posts by a user and it worked. This was the code it was using:
<?php
//$wp_query = new WP_Query( array( 'post_per_page' => 12 ));
...
0
votes
0
answers
56
views
How to limit post (Exception pages) for current user in each role in front end?
Thank you for reading this question
I need an option or code for each user in each role to see only their posts at the front end, and other users' posts to be completely hidden from them, even in ...
0
votes
2
answers
151
views
Fetch all data of Users
I am trying to fetch users All information by using below code.
if($_POST['orga_id']) {
$users_query = new WP_User_Query(array(
'meta_query' => array(
'relation' ...
0
votes
0
answers
111
views
set automatically email address for WordPress users
User registration on my site is done with a mobile number.
I want the email with the structure "{userid}@example.com" to be registered automatically after user registration.
How can I do ...
0
votes
1
answer
23
views
How to pull all the contributer users records and order by Designation (which is users meta data)?
I want to show all the contributors by the Designation. Following code is only pull the records and order by ID But I need to data order by Designation:
function contributors() {
global $wpdb;
$...
0
votes
0
answers
75
views
How to verify which WordPress user requested the API in ASP .NET Core?
I have a use-case where I have a WordPress site and an ASP .NET Core as a Restful API backend. I use the WordPress site entire for Frontend, CMS, and User Authentication.
On certain pages of my ...
0
votes
1
answer
1k
views
ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
I am looking for a way to query users based on a user meta entry for an advanced custom field which has a given value and itself is from a given layout type.
For example, let's say I have the ...
0
votes
0
answers
504
views
Generate a QR code when creating a new WordPress user
I know that you can use the show_user_profile, edit_user_profile, personal_options_update and edit_user_profile_update to add and manage additional fields in user profiles.
In a site I'm developing, I ...
1
vote
1
answer
488
views
count the total number of comments the user has received for his published posts
I want to count the total number of comments the user has received for his published posts.
for example show:
total comments of your all posts : 47
Is there a way to do this?
Can you help me?
1
vote
1
answer
568
views
Remove Capabilities from WP admin for specific user role
I am trying to remove some menu-links capabilities from the wp-admin for a user role called wsm. I have tried many ways and when i just add the code below it will remove those links from the menu for ...
0
votes
1
answer
85
views
How to get custom post_author?
I have a post type that inserts email as a post. I also created users according to those emails.
This is how I added my post type.
$post_array = array(
'post_content' => $mail['...
0
votes
1
answer
1k
views
How to insert current user ID/entry ID into a shortcode?
I'm wondering if someone can help with a code snippet for the functions.php.
I am using a plugin called Connections Pro with the extension Link, which connects the entries to the wordpress user. It ...
0
votes
0
answers
69
views
How to display all user profile info in myaccount page wordpress
I was wandering how to display all user profile info in the myaccount page in wordpress. It only shows Name, Email and Password.
0
votes
1
answer
55
views
Delete user meta but only if found in array
I created a SAVE button that saves a page's URL to the user meta in an array. I'm trying to now create a REMOVE button but I'm finding that when delete_user_meta is used it deletes all entries in the ...
2
votes
0
answers
215
views
Clone wp-admin/users.php (Users Admin Page)
I have created a new page in admin. I need to show all the users in this page(like Users admin page).
The reason for this is because i want to show certain custom user roles only on this page.
I tried ...
0
votes
1
answer
345
views
Associate multiple email addresses with the same user account, so they can log in with either
Is there a way to associate multiple email addresses (2) with the same user account?
The goal is for the user to be able to use their company email or personal email to log into a company portal - ...
1
vote
0
answers
79
views
How to display total number of post done by user, it should display at authors page wordpress [duplicate]
I have added the below function to user.php but it cant display the count on the authors page.
function count_user_posts( $userid, $post_type = 'post', $public_only = false ) {
global $wpdb;
$where = ...
1
vote
0
answers
60
views
Including users in insert link internal link search in Gutenberg
When I select text and insert a link in WordPress admin using Gutenberg, WordPress searches for internal pages based on the link text. It returns posts, custom posts etc., but not users.
I found some ...
0
votes
0
answers
116
views
Change wordpress' database data using ajax - how to get current user id?
I want to update a wordpress' database using ajax. I've created php file and included both
wp-includes/user.php'
wp-includes/pluggable.php'
and when I call
$current_user = wp_get_current_user();
$...
0
votes
1
answer
46
views
Sort new column in Users wp-admin
I created a new column in the Users Admin Tab called "Listings". Each line is a number which means how many Listings an user has.
//// ADD THE NEW COLUMN
add_filter( 'manage_users_columns', '...
0
votes
1
answer
1k
views
WordPress 5.8 - Hide or Remove personal fields from admin Profile page
There are several threads on this topic, but none updated to Wordpress 5.8
The question is, in 2021 WP 5.8, what is the cleanest or recommended code to hide profile fields when creating/editing a user,...
0
votes
1
answer
394
views
Sort column in Users admin Tab
I created a new column in the Users Admin Tab where it says how many Listings an user has.
//// ADD THE NEW COLUMN
add_filter( 'manage_users_columns', 'add_listing_count_column' );
function ...
1
vote
1
answer
2k
views
How can I check if a user's email exists in the database
When making a registration and saving information in the database I want to check if the user's email has already been registrated.
function user_id_exists($user){
global $wpdb;
$count = $...
0
votes
1
answer
1k
views
How to create multiple users at once?
I'm working with a fresh wordpress database and I need to import +250 users at once from xlsx or csv, each user password has to be its name. It is possible to do this on Wordpress?
1
vote
0
answers
32
views
Bulk create clean user_nicename from user_email with SQL function
All user_nicenames were replaced with a domain name in botched import. I'm trying to recreate them from the user_email filed but need them cleaned of all special characters ("@" and ".&...
0
votes
0
answers
222
views
Get current logged-in user from external site
I have 2 sites, a WordPress site and an external php site (hosted on a subdomain, not in the same directory as WP).
I would like the external site to get the current logged in user id, in order to ...
1
vote
1
answer
3k
views
New user form rejected because "passwords don't match"—but there's only one password field
I am trying to add a user to a blog of writings by or about my late father. One of the articles is by my niece, but I cannot add her as a user. The admin form only has one field for password, but ...
0
votes
1
answer
108
views
i need to let a user to add a role from a frontend form
i need to let a registered user who already has role or 2 roles the ability to add himself a role via frontend form.
i tried to look for it and didn't find anything related that can help me.
any ideas?...
0
votes
2
answers
2k
views
Allow a user or role to view drafts and previews, but not other admin privileges?
How do I allow a specific user or a specific role to view drafts and previews, but not allow them to edit posts or have any other admin capabilities? I can add a custom capability to a role, but don't ...
0
votes
2
answers
321
views
Show only the first 300 words / 50 lines of blog posts for non registered users
Is it possible to show ONLY the first 300 words (or even 50 lines) of every blog post for anonymous users? Instead of show the whole article on the page? And after registration all the post would show....
0
votes
1
answer
35
views
How can I clone a suscriber profile in wordpress
Just need PHP code or some way to have a clone button under users like we have code for cloning pages & posts.
0
votes
1
answer
430
views
How do I update user email from frontend input field?
I'm using the below function which is working for my phone and address fields. I can't seem to change the email though... any idea what I'm doing wrong?
function um_modifications_callback() {
// ...
0
votes
1
answer
137
views
Storing huge number of users in wordpress
I would begin coding a school management theme project soon and am looking to keep the DB neatly organised. In this pursuit, since the students could be thousands in a school, would it be a good ...
0
votes
0
answers
44
views
hide user is currently editing warning in admin post page
i have 2 contributor on my wordpress and as we know whenever any other user edit wordpress post so this type of warning is showing to another users that (jhon(user) is currently editing) but i don't ...
1
vote
1
answer
543
views
How to pass a variable between filter/action functions?
In a function fired from filter wp_handle_upload_prefilter, how can I utilise a variable obtained from previously firing action edit_user_profile?
My aim: on user-edit.php, when user uploads a file (...
0
votes
1
answer
1k
views
How to get ID of Edit User page during wp_handle_upload_prefilter, whilst in Media picker?
I have an Advanced Custom Fields field group on Edit User pages (user-edit.php), containing an Image field (avatar). I aim to rename that uploaded filename to match the username of the on-page user.
...
0
votes
1
answer
97
views
No more administrator roles / permissions after WordPress upgrade
After a WordPress plugin I can login as admin, but don't have any permissions.
$ wp role list
is missing the administrator role.
What can I do?
0
votes
0
answers
24
views
How to put the 'assign to new user' select when you delete a user that has custom post type posts, but no normal posts
A client wants to delete some of his users, but since those users have posts of custom post type, but no blogposts per say, the select to reassign the posts to someone else doesn't appear.
Is there a ...
0
votes
1
answer
57
views
No plugin populate user information in to form
I want to create my own form in order to get information on my site. For learning purposes, I do not want to use a plugin. So, please don't tell me to use one. I know they are easy to use, but I want ...
0
votes
1
answer
20
views
Query pages created by deleted users
I need to query all and any pages that are created by either deleted users or users that are no longer users of the website.
Here is my query
$args = array(
'author' => '0',
'post_type' => '...
0
votes
0
answers
75
views
Adding a dropdown on the user admin
I all I'm following this: Add custom column to Users admin panel
I need to add a dropdown in the user page (plus+ if I can create the dropdown with values from ACF).
The dropdown would be for a ...
0
votes
1
answer
1k
views
How to Use Global Variables Inside Header and Footer
I set global variables for some custom user data in my functions.php to use them in navigation inside header and footer.
if (is_user_logged_in()) {
# users wordpress id
global $user_id_wp;
...
2
votes
1
answer
6k
views
Users table missing from Database [closed]
I have a functioning WordPress site, with two users (an Administrator and an Editor). I can log in to the WP back-end fine with either user. I can create pages, etc. But when I look at phpMyAdmin, ...
1
vote
0
answers
202
views
Translate emails into the language of the user
The following scenario: An admin activates a function or similar for a user (in the WordPress frontend). Now the user should be informed about this by email. Therefore an AJAX call is sent to the ...
0
votes
1
answer
206
views
How to get last user with wpdb?
can someone please help me with this query:
$ultimousuario = $wpdb->get_var( "SELECT TOP 1 FROM $wpdb->users WHERE user_login = 'usuario*' ORDER BY user_login DESC");
echo "<p&...