开发者

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 fo开发者_开发知识库r a new plugin I'm working on.


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');?> 


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);
}
}


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜