Sakamoto Kazuma
Sakamoto Kazuma

Reputation: 2579

Wordpress list of authors

How do I get an array or list of users in wordpress? I want to be able to store a new list of authors for permissions for a new plugin I'm working on.

Upvotes: 0

Views: 609

Answers (3)

Michael
Michael

Reputation: 507

This will get you an array with users


$blogusers = get_users_of_blog();
if ($blogusers) {
foreach ($blogusers as $bloguser) {
$user = get_userdata($bloguser->user_id);
}
}

Upvotes: 2

GmonC
GmonC

Reputation: 10980

Everytime you need to do something in Wordpress, is a good practice to check it's documentation, specially function and template tags references.

wp_list_authors is an example.

Displays a list of the blog's authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts. Optionally this tag displays each author's post count and RSS feed link.

Since you want to manipulate the values from a template tag, you can use the echo parameter set to 0.

<?php $authors_list = wp_list_authors('show_fullname=1&optioncount=1&echo=0');?> 

Upvotes: 3

gaustin
gaustin

Reputation: 278

This plugin selects from the users and usermeta tables. Looking at the source for it might be a good place to start.

Upvotes: 0

Related Questions