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.

Show entries by author

July 30, 2007 6:46am

Subscribe [6]
  • #1 / Jul 30, 2007 6:46am

    Ian Ebden

    312 posts

    I have a weblog with multiple authors. When I click down to a full article template I want to also show a linked list of other entries by the same author. Had a quick hunt around and can’t find a solution for this. Anyone done this before?

    Many thanks

  • #2 / Jul 30, 2007 8:22am

    Lisa Wess

    20502 posts

    I would create a link passing the authorname into a segment, then use username=”{segment_x}” where x is the appropriate segment.  That’s how I’ve done this on many sites. =)

  • #3 / Jul 30, 2007 8:24am

    Ian Ebden

    312 posts

    Sounds good. Thanks Lisa.

  • #4 / Jul 30, 2007 12:01pm

    Sean C. Smith

    3818 posts

    I would create a link passing the authorname into a segment, then use username=”{segment_x}” where x is the appropriate segment.  That’s how I’ve done this on many sites. =)

    how do you pass the author name into a segment?

  • #5 / Jul 30, 2007 12:05pm

    Lisa Wess

    20502 posts

    In the weblog entries tag, something like:

    <a href="http://{path=">{author}</a>

    Then use:

    {exp:weblog:entries weblog="default_site" username="{segment_3}" dynamic="off" limit="15"}
    {title}
    
    {/exp:weblog:entries}
  • #6 / Aug 13, 2007 9:51am

    Mark Huot

    587 posts

    Is there a way to get the user id of the currently logged in user?  something like {user_id}?

  • #7 / Aug 13, 2007 9:52am

    Mark Huot

    587 posts

    whoops, would this work? `username=”{username}”`

  • #8 / Aug 13, 2007 9:57am

    Mark Huot

    587 posts

    ok, username=”{username}” doesn’t work, but hard coding my username does: username=“markhuot”.  any idea why?  or what i can do to get the var to work?

  • #9 / Aug 13, 2007 12:15pm

    Lisa Wess

    20502 posts

    Look at the docs again for username=“CURRENT_USER” =)

  • #10 / Aug 13, 2007 12:26pm

    Mark Huot

    587 posts

    Ok, so some confusion then:

    1. http://expressionengine.com/docs/templates/globals/single_variables.html#var_username
    Says you can just use {username} as it’s a global variable.

    2. http://expressionengine.com/docs/templates/globals/single_variables.html#alternative_syntax
    Says you may want to use {logged_in_username} if you’re in a loop

    3. http://expressionengine.com/docs/modules/weblog/parameters.html#par_username
    Finally it’s listed on the weblog entries page to use the uppercase, ‘constant’ form of the variable.

    Could I make a feature request to have username=”{username}” work as it’s probably the most obvious choice?  If not, could we at least link the first page I mentioned to the page, so searching for {username} directs you back to the entries docs page?  Thanks!

  • #11 / Aug 13, 2007 12:38pm

    Lisa Wess

    20502 posts

    Hi, Mark -

    I think the documentation change you’re suggestion would be best as a user comment; that feature is fantastic, I hope that you’ll make use of it. 

    But if you just want entries for the currently logged in user, then CURRENT_USER is a special case scenario, and it is listed here.

    Lastly, you don’t need permission to make feature requests, as you know, so go ahead and post it in the appropriate forum.  I don’t want to move this thread simply because I’m not entirely clear on how CURRENT_USER fails for you, so the feature request would be good to explain how they differ, to help us understand. =)

  • #12 / Aug 13, 2007 12:45pm

    Mark Huot

    587 posts

    Thanks Lisa, I’ve made the docs post (first time!).  I guess the only reason I saw it as a feature request is because the {username} variable works correctly (outputs the current user’s username when placed directly before and after and entries tag block.  The only place it does not work on the page is when placed within the opening entries tag declaration.

  • #13 / Aug 13, 2007 12:47pm

    Lisa Wess

    20502 posts

    I haven’t explored why it doesn’t work to be honest, but if I had to guess, it’d be a simple parse order issue =)

  • #14 / Aug 13, 2007 12:57pm

    Mark Huot

    587 posts

    that was my dorky guess too.  i was just hoping it could be reworked somewhat so that the member variables were also available to plugins and the like.  anyway, nothing a quick mod to path.php won’t fix.

  • #15 / Aug 13, 2007 1:00pm

    Lisa Wess

    20502 posts

    Go ahead and put in a feature request if it’s more broad than just weblog entries.  =)  Or you could add that as a parameter for your plugins, too.

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

ExpressionEngine News!

#eecms, #events, #releases