Title: Looping through users
Last modified: August 22, 2016

---

# Looping through users

 *  Resolved [fishnyc22](https://wordpress.org/support/users/fishnyc22/)
 * (@fishnyc22)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/looping-through-users/)
 * Hey there. Question about this plugin. I want to have a sidebar on a category
   archive page that shows the contributors (author) and their bio. I would like
   to loop though the users, get all authors who have a category checked off and
   list them. Can you help me figure out how to get that data looping through the
   users. Any help is greatly appreciated. Thanks for creating this plugin.
 * Regards,
 * Dave
 * [https://wordpress.org/plugins/author-category/](https://wordpress.org/plugins/author-category/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Bainternet](https://wordpress.org/support/users/bainternet/)
 * (@bainternet)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/looping-through-users/#post-5327529)
 * I don’t see whats that got to do with this plugin.
 * contact me using my sites contact form I’ll see if I can help you.
 *  Thread Starter [fishnyc22](https://wordpress.org/support/users/fishnyc22/)
 * (@fishnyc22)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/looping-through-users/#post-5327534)
 * Hey there… I was hoping the creator of the plugin would be able to tell me what
   values I need to look for for when looping through users. I need to know what
   categories the user is restricted to posting to based on what was selected in
   their user profile using your plugin.
 * Sorry if I wasn’t clear. Thanks.
 *  Plugin Author [Bainternet](https://wordpress.org/support/users/bainternet/)
 * (@bainternet)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/looping-through-users/#post-5327540)
 * Well that is more clear 🙂
 * you can create copy the plugin method named `get_user_cat`
    which accepts a user
   ID and returns the category term ID (if one was selected for that user) or zero(
   if not).
 *     ```
       function get_user_cat($user_id = null){
       	if ($user_id === null){
       		global $current_user;
       		get_currentuserinfo();
       		$user_id = $current_user->ID;
       	}
       	$cat = get_user_meta($user_id,'_author_cat',true);
       	if (empty($cat) || count($cat) <= 0 || !is_array($cat))
       		return 0;
       	else
       		return $cat[0];
   
       }
       ```
   
 * as for looping over users take a look at the examples listed at:
    [http://codex.wordpress.org/Function_Reference/get_users#Examples](http://codex.wordpress.org/Function_Reference/get_users#Examples)
 *  Thread Starter [fishnyc22](https://wordpress.org/support/users/fishnyc22/)
 * (@fishnyc22)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/looping-through-users/#post-5327604)
 * Forgot to thank you for this tip. that function is just what I needed. Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Looping through users’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/author-category_ffffff.svg)
 * [Author Category](https://wordpress.org/plugins/author-category/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/author-category/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/author-category/)
 * [Active Topics](https://wordpress.org/support/plugin/author-category/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/author-category/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/author-category/reviews/)

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [users](https://wordpress.org/support/topic-tag/users/)

 * 4 replies
 * 2 participants
 * Last reply from: [fishnyc22](https://wordpress.org/support/users/fishnyc22/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/looping-through-users/#post-5327604)
 * Status: resolved