ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Displaying List of all Authors in a Channel

December 12, 2010 10:33pm

Subscribe [2]
  • #1 / Dec 12, 2010 10:33pm

    Eric Nance

    25 posts

    I’m trying to display a list of all authors in a channel on a sidebar. Currently, I’m using the author variable but it creates duplicate listings of authors. For example, if there are five entries in the “blog” channel and John Doe authored three of them, then Jane Doe authored the other two, it would list as:

    Jane Doe
    Jane Doe
    John Doe
    John Doe
    John Doe

    How do I strip out the duplicates? I tried using the Query tag but I’m a SQL noob so my eyes glazed over and I got the shakes. Not good. Any advice? For the author display, not the shakes…

  • #2 / Dec 27, 2010 2:12pm

    Eric Nance

    25 posts

    Bump.

    Anyone have an idea for how to strip out duplicate display of authors? If there are two authors and they each have written three entries, it will list each author three times for a total of six. How do I just display each author only once?

  • #3 / Jan 05, 2011 8:55am

    e-man

    1816 posts

    If it’s just the names, this should get you close, set php to output in your templates.

    {exp:channel:entries channel="blog" disable="categories|trackbacks|pagination"}
    <?php
    $authors[] = "{author}"; //loop through articles and load authors in array
    ?>
    {/exp:channel:entries}
    
    <?php
    $output = array_unique($authors); //remove duplicates
    ?>
    <ul>
    <?php
    foreach ($output as $name) {
        echo "<li>".$name."</li>"; //output unique names
    }
    ?>
    </ul>
  • #4 / Jan 05, 2011 10:24am

    Eric Nance

    25 posts

    Alright, this definitely helps. Thanks very much e-man.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases