WordPress.org

Ready to get started?Download WordPress

Forums

custom list of authors (9 posts)

  1. thecoup
    Member
    Posted 5 years ago #

    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.

    thanks!!!!!

  2. MichaelH
    Member
    Posted 5 years ago #

    http://wordpress.org/extend/plugins/list-authors-plus/ allows you to 'exclude roles'. Maybe something in that plugin you can 'learn from'.

  3. thecoup
    Member
    Posted 5 years ago #

    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.

  4. Shane G
    Member
    Posted 5 years ago #

    Hi,

    You can check with author tags to accomplish your requirement..

    http://codex.wordpress.org/Template_Tags#Author_tags

    [moderated spam URL]

  5. thecoup
    Member
    Posted 5 years ago #

    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.

  6. talgalili
    Member
    Posted 5 years ago #

    Hi thecoup.
    Anouther place you might want to look is this article:
    http://justintadlock.com/archives/2008/06/09/doing-more-with-gravatars-authors-template-page

    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...

  7. thecoup
    Member
    Posted 5 years ago #

    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.

    thanks again...

  8. talgalili
    Member
    Posted 5 years ago #

    You're welcome thecoup :)

  9. Zeal Murapa
    Member
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic