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.

Making Comments on Private Entries not Visible

July 19, 2009 6:25pm

Subscribe [2]
  • #16 / Jul 20, 2009 6:59pm

    DRUMZ

    75 posts

    Better yet, if groups 1 and 8 can view any private post and comments, then scrap all the php stuff and just do this for your comments:

    {if (member_group == 1) OR (member_group == 8)}
    <div id="comments">
    ...rest of comment display code
    {if:else}
    You cannot view comments on private entries(or whatever you want to say)
    {/if}

    Should save hassle. You probably won’t need to check to see if the post was private if those groups can see private posts. Headin out to lunch. Check back later for progress…

    D

  • #17 / Jul 20, 2009 7:07pm

    Nevermore

    14 posts

    Okay.  The error went away, but now the comments are missing again.  :O!

  • #18 / Jul 20, 2009 7:08pm

    DRUMZ

    75 posts

    With the new code without php I put above they’re missing? Completely? I tested it on one of my blogs and it worked fine. Hrmmm…

  • #19 / Jul 20, 2009 7:10pm

    Nevermore

    14 posts

    Oh!  I missed that.  I just - how will that affect the comments people in all groups will see?

  • #20 / Jul 20, 2009 7:18pm

    Nevermore

    14 posts

    Yeah.  That’s what I thought.  It worked….
    But…

    Now you can only see the comments if you are in those two specific groups…..

  • #21 / Jul 20, 2009 8:37pm

    DRUMZ

    75 posts

    Yeah. That would wouldn’t it…ok then. I just realized your comment tag is coming outside of your weblog:entries tag. If you put it inside your weblog:entries tag, you will then have access to that {status} variable again. So your comment tag would then check that first, and display the denial message first:

    {if (status == "Private" AND member_group != 1 AND member_group != 8)}
    You cannot view comments on private entries(or whatever you want to say)
    {if:else}
    <div id="comments">
    ...rest of comment display code
    {/if}

    That way, if the post is private, and the user is NOT in the member group, they get the denial message. If the post is not private, they will see comments regardless of the member group.

    I tried it and it worked for me 🙄

    Here’s hopin it works for you. Just remember to put your whole comment tag INSIDE your weblog entries tag. This will be okay because on this template you are only pulling one entry, so it will only pull the one entries comments.

  • #22 / Jul 20, 2009 8:56pm

    Nevermore

    14 posts

    OMG!  :D

    I <3 you so hard core right now! :D
    Thank you so much.  <3!!!!!!!!!!!!!

  • #23 / Jul 20, 2009 9:04pm

    DRUMZ

    75 posts

    So….I take it it works ❓

    If so, glad to hear it!

    D

  • #24 / Jul 20, 2009 9:19pm

    Nevermore

    14 posts

    Yes, it works. XD

    Sorry.  :D

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

ExpressionEngine News!

#eecms, #events, #releases