The tag has no wiki summary.

learn more… | top users | synonyms

5
votes
2answers
681 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 ...
5
votes
2answers
302 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' => ...
4
votes
1answer
416 views

Custom post type support for get_users('orderby=post_count');

The default WordPress function get_users('orderby=post_count'); only orders users with the count of the posts they've made. Any idea how to modify this to support custom post types as well? UPDATE: ...
3
votes
2answers
3k 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 ...
3
votes
1answer
275 views

How to display the names of users from a specific group with a shortcode?

I have in the database a table with the user_id and corresponding group_id values, so each row contain the ID of the user that is a member of a group and the related group ID. The question is: How to ...
2
votes
1answer
1k 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 ...
2
votes
2answers
71 views

Paginate a list of users?

I'm currently displaying a list of all users using the following code. The only problem is that I need to paginate and only display 10 users at a time. I'm familiar with pagination using CPT's and ...
2
votes
1answer
642 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. ...
2
votes
1answer
470 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', ...
2
votes
2answers
505 views

Sort get_users by custom field

I have a custom USER taxonomy called 'label' which also has a custom field of 'sort_order' - I am trying to return a list of users that have the label taxonomy and then sort this list by the ...
1
vote
6answers
4k 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
2answers
132 views

Efficiency on displaying random authors based on large database

I'm trying to display a list of 5 authors randomly. Here are some solutions I had found: http://stackoverflow.com/questions/5502609/get-authors-randomly ...
1
vote
2answers
58 views

Displaying a random user with a shortcode

I'm trying to setup a shortcode to show a single random user each time the page is refreshed. I've been successful in displaying all users or a select user by the user ID. Here is my shortcode as it ...
1
vote
2answers
129 views

Getting all the users who have author privilege

Can anyone tell me how to get all the users who have author privileges by querying the DB in WordPress and order them by number of posts written by them. I use the following query to get all the ...
1
vote
1answer
674 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?
1
vote
1answer
199 views

Order the users by the date of their latest post

I use the following code for getting the authors of in my multi-author blog and order them by their post count. I want to order them by the date of their last post $authors = ...
1
vote
1answer
607 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
829 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 ...
1
vote
1answer
3k 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
204 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 -> ...
1
vote
1answer
635 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 ...
1
vote
2answers
155 views

global $current_user not current user

I believe I have a misunderstanding of what the global variable $current_user is exactly. I'm attempting to display the current user's email and name on a page using add_filter('the_content', ...
1
vote
2answers
73 views

Adding tags and inputs to a user's profile

I'm adding a number of items to the user profiles using this method in my functions.php function modify_contact_methods($profile_fields) { // Add new fields $profile_fields['twitter'] = ...
1
vote
1answer
149 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 = ...
1
vote
1answer
296 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 ...
1
vote
2answers
197 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 ...
1
vote
1answer
491 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 sort by first name. How do I sort this the order the numbers ...
1
vote
0answers
22 views

How to get Role Subscribe Users on Admin Menu only in Pages in Wordpress

How to get Role Subscribe Users on Admin Menu only in Pages in Wordpress and also asign pages to only a specific user and also get the pages on homepage by user ID. Example: here a link, i want to ...
1
vote
2answers
277 views

Get author id from url

I am trying to get the authors user_id on a page linked to by using get_author_posts_url(),. For example http://example.com/author/John%20Smith where John Smith is user_id is 23. I need to get ...
1
vote
2answers
487 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 ...
0
votes
2answers
938 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 ...
0
votes
2answers
62 views

Order get_users() by last login date. Is it possible?

I want to create a page that displays all the blog users ordered by the last login date. I've tried with the get_users() function and I can succesfully get the users' list, but not in the order I ...
0
votes
1answer
655 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 = ...
0
votes
1answer
53 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 ...
0
votes
2answers
336 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

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
1answer
752 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 ...
0
votes
1answer
416 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
587 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: ...
0
votes
1answer
28 views

Wordpress where clauses in db select

I'm currently struggling with implementing a feature for wordpress site. I would like to get the count of all users which have the key pending_approval='true' and is_photographer='true' (located in ...
0
votes
1answer
102 views

Query to get last posts from authors of blog

Firstly I get user with role "author". $author_args = array( 'role' => 'author' ); $authors_list = get_users($author_args); Nextly I reform array $author_list = array(); ...
0
votes
1answer
41 views

how to get the top 10 popular blogs

Our wordpress sites have many many users, each of them have an blog account, they can write posts,comments and so on. Now I want to find out the top 10 popular blogs, according to or order by ...
0
votes
1answer
91 views

Can't manage to make translate_user_role() work

I've been looking into wpse archives to solve my problem but I can't manage to do such a thing. I built this code : $args = array('fields' => 'all_with_meta'); $users = get_users($args); foreach ...
0
votes
1answer
234 views

Reduce number of SQL queries inside WP_Query loop to fetch author data

This question applies to scale and does not concern typical blog implementations. I'm working on a web app where I'm running standard WP_Query to fetch some custom post types. This usually results in ...
0
votes
2answers
255 views

Getting list of top 10 users and sort on last name

I would like to display a list of the top 10 authors based on the amount of posts that they have, and then sort them on last name. To my knowledge, this is not trivial since the last name of a user ...
0
votes
1answer
791 views

get_users meta_query

I can't get meta_queries working correctly on get_users(). For the life of me can't figure out what I'm doing wrong. $args = array( 'meta_query' => array( ...
0
votes
1answer
122 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 ...
0
votes
1answer
688 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
2answers
1k 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
4answers
2k 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' ...