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.

Top Authors

January 30, 2011 1:22pm

Subscribe [3]
  • #1 / Jan 30, 2011 1:22pm

    koko.pelli

    176 posts

    This question may be related to a resolved thread.

    From the above post I was able to output the channel authors in my sidebar, but I can’t work out how to then link the author names to a page which lists the channel entries by that author.

    Is there a way to do that?

    What I was thinking was this (but didn’t work)

    {exp:top_authors channel="blog" limit="10"}
        <li><a href="http://{path=id={name}">{name}</a></li>
    {/exp:top_authors}

    *EDIT - Weird, it won’t let me output the <li> line as I have it in my code, I must have it well and truly wrong!

    Any help much appreciated 😊

  • #2 / Jan 31, 2011 10:31am

    Sue Crocker

    26054 posts

    Hi, koko.pelli.

    The plugin returns {author_id}, which you could use to build other kinds of links. Does that help?

  • #3 / Jan 31, 2011 10:54am

    koko.pelli

    176 posts

    Hi Sue,

    Thank you for coming back to me.

    I am still unsure how to list the authors, and then make each author a link to a page which displays posts by them!

    At the moment I have this code to list the author/link to an authorsposts page:

    <h3>Authors</h3>
    <p><ul><br />
        {exp:top_authors channel="blog" limit="10"}<br />
        <li><a href="http://{path=blog/authorposts}">{name}</a></li><br />
        {/exp:top_authors}  <br />
    </ul>

    This is linking to a page which just lists all pages by author… I’m not sure how to parse the author name into the “authorposts” template to only list posts by this author.

  • #4 / Feb 01, 2011 4:17am

    John Henry Donovan

    12339 posts

    koko.pelli,

    Use the following

    <h3>Authors</h3>
    <p><ul><br />
        {exp:top_authors channel="blog" limit="10"}<br />
        <li><a href="http://{path=blog/authorposts}/{author_id}">{name}</a></li><br />
        {/exp:top_authors}  <br />
    </ul>

    Then in your listing template add the parameter author_id=”{segment_3}” to your channel:entries tag


    Does that help?

  • #5 / Feb 01, 2011 6:23am

    koko.pelli

    176 posts

    Hi John,

    I have done that and it takes me to the following URL structure: /index.php/blog/authorposts/2

    But it pulls in no content :S

    This is what the link is now:

    {exp:top_authors channel="blog" limit="10"}
    <li><a href="http://{path=blog/authorposts}/{author_id}">{name}</a></li>
    {/exp:top_authors}

    And this is what I have for pulling in the content on the authorposts page:

    
    									
  • #6 / Feb 01, 2011 6:25am

    John Henry Donovan

    12339 posts

    koko.pelli,


    Try adding a dynamic=“no” parameter to you channel:entries tag

    {exp:channel:entries channel="blog" limit="15" author_id="{segment_3}" dynamic="no"}

    Moving to CodeShare Corner as more appropriate there

  • #7 / Feb 01, 2011 6:27am

    koko.pelli

    176 posts

    Fantastic, that did pull the content in 😊 However, in the content the author_id is the id number, not the name.

    For example, it should read:

    /index.php/blog/authorposts/joebloggs
    Articles by Joe Bloggs

    But instead reads:

    /index.php/blog/authorposts/2
    Articles by 2

    Is there a way to force it to use the name?

    Many thanks for all your help 😊

  • #8 / Feb 01, 2011 6:29am

    John Henry Donovan

    12339 posts

    EE Docs : {author}


    <h1>Articles by {author}</h1>

  • #9 / Feb 01, 2011 6:32am

    koko.pelli

    176 posts

    Thanks so much, sorry that is really obvious isn’t it.

    IS there a way to make it use author in segment_3 of the URL?

  • #10 / Feb 01, 2011 6:36am

    John Henry Donovan

    12339 posts

    koko.pelli,

    there is no author name parameter for the channel_entries tag so you would have to do some more work to find the id associated with the name in the URL and then pass that to the author_id= parameter

  • #11 / Feb 01, 2011 6:37am

    koko.pelli

    176 posts

    Ahh ok.

    Thank you very much for all your help 😊

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

ExpressionEngine News!

#eecms, #events, #releases