hey folks, using WP 2.7, but that’s not an option in the forum yet.
I’d like to setup a page that lists all users given a specific role. WP lets you customize author.php for individual bios. But wp_list_authors() can only produce a simple html list.
There’s no built in way to access all users in a customer page template and then loop through them, to display their name, url, bio, etc, in a custom format.
Can any recommend a plugin??
Or can you detail how I might get the info directly from the database? If I grab an array of usernames or IDs, how would I then call for a field in their table?
If I get that working, how would I limit the array to users set as authors or subscribers?
This post stems from a more basic discussion about author lists.
http://wordpress.org/extend/plugins/list-authors-plus/ allows you to ‘exclude roles’. Maybe something in that plugin you can ‘learn from’.
Thanks Michael for the response. I hadn’t seen that particular plugin.
I looked it and a few others. But as Robert Tsai points out in the details for his plugin WP Authors, doing anything thing like this “will require either hacking the WP core or directly embedding SQL queries into the plugin. Both strategies subject the plugin to breakage with each WordPress release.”
I might do it anyhow. But it’d be nice if authors and their related details could be accessed like posts.
Thanks again for the link.
You can check with author tags to accomplish your requirement..
[moderated spam URL]
Thanks Shane, but those tags only work when displaying a single author. They cannot be used to list authors.
I’m betting my best solution is to create a Category called Authors, create a post for each author, and then loop those posts with author information included.
Anouther place you might want to look is this article:
It doesn’t talk about restriction per role, but it DOES talk about how to list users with more information.
And once you find an answer, I’d be curious to know it…
thanks talgalili, that link was very helpful. I was able to build and customize a page that lists my authors. Although drawing from the database instead of using WP tags might break when upgrading, it seems like a better way to go than using a plugin that might not have any support in a few months. It also uses gravatar.com, which is an easy way to manage uniform user thumbnails.
There is a line in the code that you can use to choose a paritcular role:
if($curauth->user_level > 0 || $curauth->user_login == 'admin') :
You could set
if($curauth->user_level = 7) :to show Editors only. I’m not sure why he also includes admin, since they are level 10, definitely greater than 0.
If you use the plugin called role manager, you can change these roles and levels.
- The topic ‘custom list of authors’ is closed to new replies.