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.

sorting entries by current user

May 17, 2012 11:26am

Subscribe [1]
  • #1 / May 17, 2012 11:26am

    pmerritt

    24 posts

    I am trying to find a way to only show entries pertaining to the current user. Could I do this either by status or a channel field?

    I’ve tried creating a separate status for each client and using the parameter status=“CURRENT_USER” but couldn’t get it to work.

    I also tried creating a channel field for each client, but I couldn’t figure out how to sort the entries by the content of the channel field.

    Any suggestions?

    Thanks,
    Phillip

  • #2 / May 18, 2012 1:17pm

    Dan Decker

    7338 posts

    Hi Phillip,

    Thank you for posting your question to the forums!

    Sure thing!

    {exp:channel:entries channel="news" author_id="CURRENT_USER"}

    That will only fetch entries with an Author ID of the logged in user. Then you set the channel entry’s Author to the member. Or you can use SafeCracker to let the members make their own entries and be set as the author automatically.

    I look forward to your reply!

    Cheers,

     

  • #3 / May 18, 2012 1:53pm

    pmerritt

    24 posts

    I think that would work, though I would prefer that the author actually was the name of the person in the office who posted the entry for the client (clients aren’t posting entries themselves). I guess if there’s no way to use a variable with a status or channel field I’ll have to use the author_id. Maybe I could then use the status to indicate the author…

    Thanks for your suggestion!

  • #4 / May 22, 2012 4:42pm

    Dan Decker

    7338 posts

    Hi Phillip,

    Ahhh… OK… The CURRENT_USER is going to be an ID number and not a name, so for any of that to be relevant outside of the author_id context you would have to use the member ID as the value.

    Does that explanation help?

    You might look at using a specific field type like VZ Members that can make a list of members and can be used in Channels.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases