The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
204 views

get random users each time based on the meta key

I have many users on my website, out of some has status "elite". I am saving this status in meta key/value for each user ('meta_key' => 'elite_member', 'meta_value' => '1'). I want to display ...
1
vote
1answer
388 views

Author List page: Exclude based on last post date

I have a Author page that I built using this code and it works fine. However, I have several writers that range from frequent to one-time writers. I would like to seperate out writers that have not ...
2
votes
2answers
545 views

How may I filter get_users() similarly to pre_get_posts?

I have filtered posts, pages and custom_post_types based on $current_user custom usermeta field values using pre_get_posts(). Is there a similar method/function to alter get_users() based on ...
2
votes
3answers
867 views

Sort users in get_users() in custom order

<?php $blogusers = get_users('include=5,6,2,7,12,8'); foreach ($blogusers as $user) { ... } ?> Right now, these users will sorted by first name. How do I sort this in the order the ...
0
votes
1answer
201 views

Echo text if field under user_meta is empty with get_users()

With get_users() I am listing users and their information. I've a custom field in the database, people_lists_class. <?php $blogusers = get_users('role=contributor&orderby=display_name'); ...
0
votes
2answers
2k views

How to get the user description with get_users?

I'm using this piece of code to list users and their information. The problem I'm having is that the description isn't showing. Obviously it's because the description lays under "user_meta" and not ...
2
votes
1answer
2k views

How to do get_users() with multiple meta_keys

In the codex it says its possible to do get_users() with multiple meta keys by using the meta_query parameter but it doesn't explain how. Can someone give me an example?
0
votes
1answer
4k 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. ...
-2
votes
1answer
147 views

Get all user with both meta_value

I was wondering if there were any efficient way of fetching all user comparing two different meta_key. I am currently fetching all user compared to the first meta, then loop trough the user_id to ...
2
votes
2answers
2k views

Can I pass two roles to the function get_users?

I want to get the users of role academic and student. I have tried using the code below (passing an array of roles, but all users are being displayed, so clearly it's not working. ...
0
votes
2answers
487 views

List users with the most total posts view

I'm asked by my friend to create a widget for his multiauthor blog. He wants to list 3 authors with the most total post view from their posts. I've got the job done for the post view using post ...
0
votes
1answer
1k views

Override orderby to create list of users by custom meta_value

I'm having issues ordering a loop of users by a custom meta_value. Reading the Codex for get_users(), it doesn't actually say that you can use the meta_value for orderby. When I try to do it I get a ...
0
votes
1answer
1k 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 = ...
1
vote
2answers
626 views

Menu page with list of users

I need a way to create a menu page with a list of all users for administrative purposes. The list will be used by users that don't have permission or acceses to the "Users" menu page. The page need to ...
2
votes
1answer
944 views

How can I query all users who registered today?

I'm trying to use meta_query to return all users that have registered today : $args = array( 'meta_query' => array( array( 'key' => 'user_registered', ...
5
votes
2answers
946 views

get_users is expecting unserialized meta_value

I'm trying to get all users assigned to a custom usermeta. I know that get_users() is supposed to work; however, it doesn't seem to be working. What I have is a usermeta storing a category ID and I'm ...
7
votes
6answers
11k 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 ...
1
vote
1answer
4k 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 ...
1
vote
1answer
234 views

Users: List A to Z, for Users

I would like to create a list of all the alphabets that represent each user in my site. Example: A -> Link that shows list of all users whose **nickname** starting with letter "A" B -> ...
5
votes
2answers
446 views

Why does get_users suddenly return duplicates?

I'm having a hard time figuring this one out. I'm running a simple users query : $args = array( 'role' => 'custom_role', 'orderby' => 'ID', 'order' => 'DESC', 'number' => ...
0
votes
1answer
956 views

Create a page Meta Box listing all blog users

I have a custom post type where each post can only be seen on the frontend by one specific user. I have figured out how to make an archive template where only posts with the meta _allowed_user = ...
1
vote
1answer
856 views

How to use “offset” to paginate get_users?

Is is possible to paginate the get_users function with the "offset" parameter? I have complete my custom query of users for my list and now I need to paginate the results into multiple pages. Here ...
2
votes
1answer
1k views

Get users with atleast one post

How can I get all users with atleast one post? I don't think it's possible with get_users function.
1
vote
1answer
1k views

How to list users that have written custom post types and hide the ones that have not?

I'm trying to build an author list that would show all authors that have written a Custom Post Type post, and hide authors that have no posts. With wp_list_authors it would be easy to show users that ...
3
votes
1answer
2k views

How to paginate the get_users function?

Im using the get_users function to show a custom list of users on the site. The only issue Im having a problem figuring out now is how to paginate the result. This is a sample of the function that Im ...
0
votes
3answers
1k views

How to count get_users query?

I have been searching high and low for a way to count the amount of results from a get_users query. Most of what I found is to count the total number of posts in a post query, but nothing for ...
4
votes
3answers
4k views

List users by last name in WP_User_Query

How can I list users by last name ASC when using WP_User_Query? There is an orderby parameter but looking in core it doesn't accept ordering my user meta. Anyone know how to extend WP to allow this ...
1
vote
2answers
2k views

Order users by custom user meta

I'm showing a list of users like so: <ul> <?php $directors = get_users('role=director'); foreach ($directors as $director) { $dir_id = $director->ID; ...
0
votes
5answers
3k views

Order by first name

I'm trying to order the member list by display_name or first name ASC. http://sim.is/sim/felagatal-sim/ This doesn't seem to work. Any pointers out there? :/ $users = get_users(array( 'role' ...
0
votes
1answer
739 views

trying to list users & display first - last name

For some reason this is not working for me :( $get_members = array( 'blog_id' => $GLOBALS['blog_id'], 'role' => 'sm_flagar', ); $blogusers = get_users($get_members); foreach ...
0
votes
1answer
989 views

Best way to get user id for get_users function?

I'm trying to make a table of users by role type. What is the best-practices method of getting the user id? My goal is to print each users first & last names, username and email. What I have now: ...