All Questions
254 questions
0
votes
1
answer
1k
views
Can I Create a Second Admin Level User Role?
I want to create a second User Role, which has the same priveleges like a Admin User Role.
This way I can use the Adminimize plugin to disable some features there.
I'm trying to have a User Account ...
1
vote
1
answer
973
views
create shortcode to list users with specific meta key value
I have a function that I use to list users within a specific role, that match a specific meta key value. It works when I use it directly on the page ---
<?php
$bmail = $current_user->...
0
votes
1
answer
70
views
Custom Field Repeating When Using foreach
I'm trying to display user avatars by login user name using custom fields like this -
And here's the code -
function user_avatar() {
$name = get_post_meta( get_the_ID(), 'user_name', true )...
5
votes
1
answer
4k
views
Grouping users under parent user
What it needs to be like:
one "super user" with user role company
normal users with user role employee
I don't want "super user" to be able to have more capabilities, especially admin-like ...
1
vote
1
answer
15k
views
Updating user meta
I'm struggling to figure out to get the code to update a single current user meta. For instance if I want to update their first name automatically. I'm using
$current_user = wp_get_current_user();
...
0
votes
0
answers
259
views
How to update user meta from php file?
I need to update user meta from php file on my server. Maybe I need some additional permissions?
<?php
require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
$user_id = 1;
$new_value = 'http://...
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 ...
0
votes
0
answers
39
views
How can I list users by date in an array in meta_value?
I keep an order list of all users. I keep this list in the meta_key value named payments. The payments meta allows me to keep information about the payments the user made. To give an example for an ...
2
votes
1
answer
2k
views
Hide a user from WordPress
I'm using the below code to hide a user from the WordPress User List:
add_action( 'pre_user_query', 'ap_pre_user_query' );
function ap_pre_user_query( $user_search ) {
$user = wp_get_current_user(...
0
votes
1
answer
52
views
how add more field to wp user and save it to database
$creating = isset( $_POST['createuser'] );
$new_user_login = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : '';
$new_user_firstname = $...
0
votes
1
answer
5k
views
How to get user meta value in wordpress
I have created a custom usermeta field named "designation" and fetched all its meta value in loop but it shows duplicates and empty values. I have tried to resolve by using array_unique() function but ...
1
vote
1
answer
3k
views
Creating user without username and password
I have a registration form which will filled by users and according to that form i have only First name, Last name, Middle name, Email address as important and so many other minor things.
After ...
1
vote
3
answers
16k
views
get current user not working
I was trying this code to get current user info, but showing nothing. My WordPress version is 3.3.1
<?php
wp_get_current_user();
/**
* @example Safe usage: $current_user = ...
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
3k
views
Get meta key with value for user
I need get some meta data for some users. I have meta data with the keys auto and shop and I need get their values. I'm able to access other data related to users using this code:
<?php $roles = ...
2
votes
1
answer
6k
views
Extra User Profile Field Upload File / Image
I have been following the following tutorial to try and an upload form to the user profiles. http://www.scribd.com/doc/81666407/Add-and-Remove-WordPress-User-Profile-Fields-and-Display-Them-Within-...
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 ...
5
votes
1
answer
10k
views
Where the Nickname is being used in WordPress
I see most of the place is using the "Display name", so why I need to set a Nickname?
Where it is being used?
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' => ...
1
vote
1
answer
2k
views
how to delete all users and posts based on 'user_meta'?
I have developed a small wordpress application where It has Institutes(wp user), Trainers(wp user), Trainees(wp user), courses(custom post) and notifications(custom post). All the application is ...
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' );
...
0
votes
0
answers
347
views
Add another role to a user when they click a button?
On my site, there are roles "user, authors, etc.".
Default role for user is "User" which I want to keep it for all users.
How to add another role to a user when they click a button?
I tried with my ...
2
votes
3
answers
11k
views
Drop down list in user profile page
I am having problems finding an answer to this. I need to have a custom user meta field.
I can create them which is fine but I need to create a drop down one.
For example I want the user meta to ...
6
votes
1
answer
29k
views
Return all users with a specific meta key
I'd like to use get_users() to return all users that have a particular meta_key, but I don't want to specify what the value has to be because it will change for every user. The value is a json string. ...
0
votes
0
answers
613
views
REST_query_vars for users
I'm wondering if it's possible to make that code work for users
function my_rest_query_vars($valid_vars) {
$valid_vars = array_merge($valid_vars, array('meta_key', 'meta_value', 'meta_compare'));...
1
vote
2
answers
935
views
Force a user's posts category
I'm kind lost on how to do that. Let me explain my problem.
I have an admin who can define a lot of categories. Then i want him to be able to attribute through the dashboard multiple categories to ...
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 ...
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
2
answers
1k
views
How get meta from all users?
I want to get all users with their respective data. I already get all the users:
$users = array();
$users_query = new WP_User_Query( array(
'role' => 'subscriber',
'orderby' => '...
3
votes
0
answers
2k
views
How to add quick edit and bulk edit fields to users admin section
Salutations, is there a way to add quick edit and bulk edit fields for the users section in wordpress. I have found a lot about post types and custom post types but i'm specifically looking to add ...
0
votes
0
answers
83
views
How to Moderate Edits to User Profiles?
I would like to moderate WordPress users’ edits to their own profiles. As I understand it, the default would be for the profile changes to go online immediately. Instead, I’d like to leave the older ...
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.
...
2
votes
0
answers
207
views
Unique User Account Number + Displayed Via Shortcode
I've seen a couple articles on creating unique account numbers for users:
https://stackoverflow.com/questions/37693209/create-unique-account-number-for-every-user-that-registers-to-the-system-using-w
...
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
$...
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? ...
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
2k
views
update_user_meta add value on the top on existing value
I'm working on a plugin that will allow people to favorite authors on WP site.
When you click on Favorite this author button, it will send author ID to below function and save that value in DB.
...
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'] */
...
0
votes
1
answer
563
views
Storing data to database and user registration
The project that I'm working with have a quote form. When someone submit the quote request, the information should be stored into a new table in the database and also prompt the user to register an ...
0
votes
1
answer
76
views
How to prevent multiple user accounts with the same meta field?
I run an ecommerce site on top of wordpress.
There is a particular meta field that users fill out when they checkout with me. Let's say it is the address of the user.
I would like to setup my site ...
0
votes
1
answer
711
views
update multiple user meta field based on another meta field
I have a user meta field called "user_status" and another called "user_profile_id". The user profile ID is a unique field which is managed manually. It's a 4 digit number. The user_status field is ...
0
votes
1
answer
924
views
The Simple and Correct Way to Add User Meta
I want to give points to users to their activities like writing posts, writing comments, etc.
I thought to use user meta to store points.
I know that I can use add_user_meta...
But the problem ...
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
0
answers
40
views
Safely changing UserID's, re-using deleted UserID's and automatically using deleted userID's instead of an increment
I'm looking for 3 different solutions all relating to user ids, I'm needing a solution to safely make changes without destroying the site.
Issue 1:
I am wanting to change the userID of a user from ...
0
votes
1
answer
45
views
User updating their profile wipes my custom fields
I have created a plugin to add extra fields to user profiles. These fields can only be edited buy admin and do not show on the user'profile page. The extra fields are shown and can be edited by admin. ...
1
vote
0
answers
34
views
get_user_meta an ID for multiple functions
i created an frontend profile for users, where they can add some informations to there profile. All the infos are stored in the usermeta. To show these informations on the frontend profile of the user ...
0
votes
1
answer
623
views
Recovering the table wp_usermeta from users
We had an accident and the table wp_usermeta got truncated.
I have the table wp_usermeta from the staging environment I pushed it in but when I try to login with the admin user (id 1 on both of them)
...
0
votes
1
answer
1k
views
delete_user_meta Delete one value out of array
The code I have is not working cause the value saved as array and I'm not sure how to fix this.
// Remove favorite authors from current users DB
function fav_author_remove_user(){
...
4
votes
1
answer
578
views
Wp_User_Query not sorting by meta key
I'm trying to list users sorted by a meta value. I store a score for each user in their user meta which is just a number but the loop isn't sorting. I include the score in the loop so that I can see ...
2
votes
2
answers
1k
views
How to get top 10 user is based on user meta value
I'm trying to get top 10 users in my wordpress blog based on user meta value.
I've tried few methods & finally able to get just top one user using below wpdb query. But clueless, how we can get ...