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.

Showing EDIT link only to author

May 09, 2008 8:08pm

Subscribe [2]
  • #1 / May 09, 2008 8:08pm

    Thought Nozzle

    28 posts

    UPDATED BELOW IN REPLY

    Hi, kids…

    I’m trying to display an “Edit Entry” link only to the author, and it’s turned out to be tricky.

    I also want to use a conditional that will display the entry if 1) the author has marked it for Sharing, or 2) the logged in member is the author.

    I’ve read about this problem.

    author_id=={member_id}

    doesn’t work within entries pairs. I’ve also read about the Alternate Syntax, and I’ve tried conditionals involving author_id, member_id, logged_in_member_id, CURRENT_USER, etc., but no joy so far… The link appears for every member. And it looks like the entry will appear to everyone whether Shared or not.

    Below,

    field_id_92
    is the “Share Entry” custom field, and
    field_id_93

    is the contents being displayed.

    Here’s the non-functioning code (although the if field_id_92==“Yes” part does apparently work):

    {exp:weblog:entries weblog="weblog_name" show_expired="yes" rdf="off" limit="1"} 
    
    {if field_id_92=="Yes" OR author_id=={member_id}}Site Title : 
    
    {exp:member:custom_profile_data}{first_name} {last_name}
    
    {/exp:member:custom_profile_data}  Page title
    
    
    {if author_id=={member_id}}  [ EDIT this Entry ]
    
    {/if}
    
    (Field description):
    {field_id_93} (Entry contents)
    
    
    {if:else}This member has not chosen to make this entry public.{/if}{/exp:weblog:entries}

    Incidentally, if I replace member_id with logged_in_member_id, I get a blank page. Otherwise, everything displays to all members.

    Anyone?

    TIA as always!

  • #2 / May 09, 2008 8:33pm

    Thought Nozzle

    28 posts

    Sorry… Wasn’t searching properly in the Wiki. Looks like I found it!

    {if logged_in_member_id == "{member_id}"}
            <a href="/admin.php?C=edit&M=edit_entry&weblog_id={weblog_id}&entry_id={entry_id}">Edit</a>
        {/if}

    I’ll try this and get back to ya…

  • #3 / May 11, 2008 10:27am

    Robin Sowell

    13255 posts

    Good searching- let us know if that does the trick.  It should.

  • #4 / May 11, 2008 1:35pm

    Thought Nozzle

    28 posts

    Did indeed…

    I was doing it backwards:

    {if member_id == "{logged_in_member_id}"}

    I’m sure I’ll eventually grasp why that doesn’t work but the wiki version does.  😊

    Thanks, Robin!

  • #5 / May 12, 2008 12:12pm

    Robin Sowell

    13255 posts

    Hm- I’m not dead sure why it wouldn’t work in either order myself.  But- glad you did get it squared away!

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

ExpressionEngine News!

#eecms, #events, #releases