All Questions
254 questions
0
votes
3
answers
295
views
Create new user from phpMyAdmin
I'm trying to copy site that I have created in free web hosting server to my windows pc that runs WP on WAMP. I copied all files, but took wp-config.php from sample site I run on my PC and have done ...
4
votes
1
answer
18k
views
How to get users by a custom field / by user meta data?
I've added a custom field to users profile using the following code:
/*** Adding extra field to get the the user who creates the another user during ADD NEW USER ***/
<?php
function ...
4
votes
3
answers
3k
views
Extending WP_User class and using this sub-class during the whole lifecycle
What I am trying to achieve is the following: for every user on our website, I want to do an API request to a service (local REST API interacting with another database) once and then cache the result ...
1
vote
1
answer
2k
views
List users by meta_key and meta_value
The following function will display a list of users based on their meta data:
<?php function get_users_by_meta_data( $meta_key, $meta_value ) {
$user_query = new WP_User_Query(
array(
...
0
votes
1
answer
5k
views
How to add an attribute to a user?
I have looked for an answer, and couldn't find a clear and relevant answer yet.
I want to add more attribute to the users not to display, but only store information about them. The information will ...
0
votes
2
answers
2k
views
User list order by user meta
i have created user vote that can vote users or author of posts. so for example have 4 users which looks:
user --- ID=1 --- META KEY='_thumbs_rating_up' --- META VALUE='13'
user --- ID=2 --- META KEY=...
0
votes
2
answers
1k
views
get_users with Serialized Custom Meta Value
I'm attempting to use get_users to select users with only a certain meta value. In this case the meta key is extraInfo but the the values are in a serialized array. Can I pull users out like this? ...
1
vote
1
answer
10k
views
Get all user meta by meta key instead of ID
I'm trying to compare user meta values to find highest and lowest values. I have a user meta value set up called "hourly_rate". I want to get the hourly rate for all users and then run PHP's min() and ...
8
votes
1
answer
2k
views
Automatically delete inactive users after 2 months
I am trying to modify this function:
// automatically delete users after 7 days in wordpress
function wcs_auto_delete_users() {
global $wpdb;
$query = $wpdb->prepare( "SELECT ID FROM $wpdb->...
2
votes
1
answer
7k
views
How to add country drop down menu to the user profile?
I've added this code snippet to my functions.php
function my_new_contactmethods( $contactmethods ) {
$contactmethods['country'] = 'country';
return $contactmethods;
}
add_filter('...
1
vote
1
answer
77
views
Is this code true or not
I am a beginner in coding but i have just wrote this code ,
The concept of code is :
The code adds a form with a button to each user profile. The button is captioned as Follow/ Unfollow. It updates ...
1
vote
1
answer
5k
views
How can i create an array user meta?
I want to create a new user meta that contains array content
How can i do this ?
Another question :
is it true using this code to check if the array user meta exists before creating it ?
<?php
$...
3
votes
2
answers
3k
views
How to add follow functionality to multi-author wordpress site?
is there any way to add "follow" functionality to Wordpress ?
so that every logged-in user can follow his favorite author
and only can see post from authors that he followed them ..
A possible ...
0
votes
1
answer
2k
views
Adding fields to the “Add New User” but the form data not saved into DB
i have add new fields when we create new user in user-new.php
the new field appears in the form, but the form data not saved into DB.
after i created new user, i go to "edit user" and see the field ...
1
vote
1
answer
731
views
WPML Default Language User Meta [closed]
I'm having a super hard time finding the names of the default user meta that's included with WPML. WPML has a setting for "Default Admin Language" under every user's profile. I'd like to access this ...
3
votes
1
answer
11k
views
WP_User_Query with combined meta query - not working?
I'm trying to use WP_User_Query class to list all users basing on their specific meta fields.
When I use simple single-meta query, it works fine:
$q = new WP_User_Query( array(
'role' => ...
2
votes
1
answer
1k
views
Query wp_usermeta alongside wp_users
I want to use the WordPress query functions and no external plugins for the task. Here is what I have so far:
add_filter('user_search_columns', 'user_search_columns_bd' , 10, 3);
function ...
0
votes
1
answer
667
views
How to query authors by custom taxonomy?
I have a custom taxonomy for users which is country.
Is there a way to query all admins by term_id or should I get all users and check each one with a for loop?
I tried this:
$user_query = new ...
0
votes
2
answers
1k
views
Storing user submitted forms [closed]
I was wondering what's the best way to create a form which can only be seen by registered users. The main idea I'd like to achieve here is for users to log in and gain access to a page where there's ...
1
vote
2
answers
933
views
Select Multiple meta_value from WP DB; Single Query
I am trying to retrieve each user's first and last name, phone, email, and address from the usermeta table. I'm having trouble selecting multiple meta_values, each with its own meta_key, using a ...
0
votes
2
answers
3k
views
New User Save Filter
I'm using the new(ish) filter add_action( 'user_new_form', 'funcy', 9 ); to add custom fields to Create A New User page. I'm then using
add_action( 'personal_options_update', 'save_user_meta' );
...
1
vote
2
answers
2k
views
Is a user_meta research case-sensitive or not
I am using the Wordpress get_users() function to search for users with a specific meta_key value.
$wordpress_user = get_users( array('meta_key' => 'unique_id',
'...
0
votes
3
answers
317
views
User description only displayed for logged user
In my "About" page I list all WP users of the site. Then in author.php I display the description of the selected user with this code: <?php the_author_meta( 'description' );?>.
Problem: this ...
-1
votes
1
answer
50
views
Store subscription details for users in Wordpress
I want to store subscription details of several category for users. how to store this to wp database. i am beginner to wordpress.
whether i want to create new table or can i use
meta ,taxonomy
or ...
0
votes
0
answers
826
views
User management missing after migration to new host
I just moved my WordPress 3.9 site to a different host by making a mysql dump and restoring it on the new server and uploading the files over. Pretty standard.
However, now I've lost the ability to ...
0
votes
1
answer
65
views
Can user meta be shown or hidden depending on user logged in status?
Can is_user_logged_in be combined with jquery somehow to add/remove fields wrapped in a certain class?
More specifically:
I want to wrap the users' phone and email in class "private".
Then if the ...
0
votes
1
answer
543
views
SELECT from wp_users, get Displayname too
SELECT post_author, count(ID) as amount
FROM dbold_posts
WHERE WEEKOFYEAR( post_date ) = WEEKOFYEAR( NOW() )
AND post_status = 'publish'
AND post_type = 'post'
GROUP BY post_author
I ...
2
votes
1
answer
3k
views
Delete user from frontend
Hi I am working on a frontend admin where a user must be able to delete his account. current_user() is a custom made function of me that retrieves the user meta data.
Does anyone know how I can make ...
0
votes
1
answer
708
views
Assign random (and unique) user meta upon registration
When a user registers, I need to assign a random but unique, 4-digit number as user meta data. The number will be static and not change: Not by the user himself or any user with a higher capability. ...
0
votes
1
answer
1k
views
Get author meta of all writers
We know from the docs that you can get an author's meta like so:
<?php get_the_author_meta( $field, $userID ); ?>
But I would like to have a custom "About us" page which displays all the ...
4
votes
1
answer
556
views
How to create a template for a custom URI associated with the user
I am working on a site where I am using a plugin called Favorite Posts so logged-in users can add a post (a custom post type) to their favorites.
I created a page called my-favorites which allows the ...
0
votes
1
answer
331
views
User meta and public function security
I am using stripe to setup a system of buying credits, which can be used on my wordpress site. I save credits using wordpress user meta, and I increment those credits after a successful transaction ...
20
votes
3
answers
32k
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 ...
0
votes
1
answer
178
views
Display and Allow users to edit their own profiles
I'm working on a site that would have different categories of users, and each user will have his own user profile page with a vanity URL, which he can share with others.
The users are divided into ...
3
votes
2
answers
9k
views
Add a button to users.php
I am working on a plugin that adds meta data for each user to the users.php table that is displayed by adding columns. I have that done but I would like to also add a button that will delete the meta ...
0
votes
2
answers
74
views
Let users register weight each day and save it in DB
I need a way that lets my users register they're weight (kg) and maybe % of bodyfat and save that information on each user in the DB.
Then i need a way to output that number again on the logged in ...
0
votes
1
answer
98
views
Creating Custom user type just like custom post
How to create custom user types (User Role) just like the custom post types.
For example:
User Role 1: Having a normal profile field.
User Role 2: Having 3 extra fields in the profile.
2 ...
0
votes
1
answer
3k
views
Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?
even though I think I understand the hierarchy of roles in WordPress, I never really bothered creating my own user roles or custom capabilities.
What I need to achieve is to assign a few capabilities ...
6
votes
2
answers
20k
views
How to display custom user meta from registration in backend?
I'm considering using the hooks for the WordPress registration form to add some custom fields: https://codex.wordpress.org/Customizing_the_Registration_Form
My question is, if it's even possible, how ...
0
votes
1
answer
902
views
Validate user meta and redirect
I wanted to add some extra fields to obtain extra user info which I have added easily that looks like.
The example code for a single form field, I added:
add_action( 'show_user_profile', '...
1
vote
1
answer
730
views
How to list users by custom field?
I have a custom user field in the standard database, called company.
I want to output on to a page the usermeta info only of users whose company matches Widgets Inc ...
How do I do that?
What I'd ...
0
votes
1
answer
2k
views
wp_insert_user not creating account correctly when ID is manually set
So, I'm trying to create a new user account with wp_insert_user based on credentials I receive from a Facebook user profile. I want the new user account ID to equal the Facebook account ID (ex: ...
0
votes
1
answer
257
views
Get users with different roles and call function on each of them (user_meta)
First of all, I have a custom function in functions.php that gets some author information. This works on great on single posts with a single author.
<?php function the_author_box() { ?>
<div ...
1
vote
1
answer
2k
views
WP_User_Query pulling ACF to loop
I'm using following code to display my users on template
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$paged -= 1;
$limit = 100;
$offset = $paged * $limit;
$args = ...
4
votes
3
answers
10k
views
How to order users alphabetically by their last name?
I use the following shortcode and function to display members of some departments:
add_shortcode( 'list_of_members', 'members_listing' );
/* usage: [list_of_members department = 'psychology'] */
...
1
vote
1
answer
7k
views
users and usermeta table
Is it mandatory for each user to have entries in usermeta table as well or it's optional? Recently, I came across a wordpress database which has thousands of users in user table however only a few of ...
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 ...
1
vote
2
answers
158
views
Average Account Age
I'm trying to see if there is a way to find an average age of user accounts which came through my wordpress site not including the age of the administrator account.
When I say age I don't mean their ...
0
votes
1
answer
429
views
Does WordPress Need BuddyPress to Handle Large Amounts of Users?
I understand that technically there can be 18446744073709551615 users (db limitations). But I heard at a talk that the vanilla install of WP in actuality can't handle many users that well due to ...
0
votes
1
answer
202
views
Randomize Users
I'm trying to randomly display my users and I was wondering if I could edit the answer on this page to suit my needs (multiple users instead of a single user): Sidebar random author spotlight
Here's ...