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.

For Those Who Do "Private Posts"

July 19, 2007 2:46am

Subscribe [3]
  • #1 / Jul 19, 2007 2:46am

    HSOMGF

    13 posts

    Hey you all..quick question, here.  If you have your EE site setup so you can do “private” posts, how do you show a default message to those who can’t see the posts?

    I’ve seen other EE sites that have a short message to non-members (and others, if applicable) that the post is private, thanks for your understanding, etc.

    How do I do that?

    TIA

  • #2 / Jul 19, 2007 7:02am

    Daniel Walton

    553 posts

    You can’t do private ‘posts’ as such (that I am aware of) but you can make a private forum. Meaning users can browse topics but not read them as a guest/particular member group. Make sense?

  • #3 / Jul 19, 2007 10:23am

    PXLated

    1800 posts

    You can’t do private ‘posts’ as such (that I am aware of) but you can make a private forum. Meaning users can browse topics but not read them as a guest/particular member group. Make sense?

    Are we talking forum or weblog post here?
    If it’s standard weblog one can use a conditional to check if one is logged in and a member of a group, if so, show posts, if not, show message.

  • #4 / Jul 19, 2007 1:35pm

    HSOMGF

    13 posts

    Butcher, yes you can do private posts.  It involves creating a weblog for that purpose, and coding your index template to bring those posts in.  But that wasn’t my question.

    PXLated, yes, it is a weblog, not a forum. (Sorry, should have been more clear) I already have a conditional in place to show the private posts to the appropriate member group, and I know I need another conditional to show the alternate message, but I’m not quite sure how to go about it.

    The current conditional is..

    {if (member_group == '1' OR member_group == '6' ) && weblog_id == '2'}{privatebody}{/if}

    That brings in the private weblog posts and shows them to the appropriate crowd. The only drawback is that people who are either logged out or not in the right group will see a blank space under the title, because the post is hidden from them.  I want to put a message there for those people.  I just need help with the conditional.

    Hope that clarifies things, and I’m sorry for being vague before.  Should not write posts late at night, LOL.

  • #5 / Jul 19, 2007 1:39pm

    Lisa Wess

    20502 posts

    I don’t show a message, people won’t see the post exists at all if they do not have permission.  I have a tutorial here on how I personally handled it.

    You could always use {if:else} to show a message if your conditions aren’t met, as well.

  • #6 / Jul 19, 2007 1:41pm

    HSOMGF

    13 posts

    I’d like to do {if:else}..how would I go about that, based on the code I provided?

  • #7 / Jul 19, 2007 1:43pm

    Lisa Wess

    20502 posts

    {if (member_group == '1' OR member_group == '6' ) && weblog_id == '2'}
    {privatebody}
    {if:else}
    Private, shoo!!!
    {/if}

    docs on advanced conditionals.

  • #8 / Jul 19, 2007 2:14pm

    HSOMGF

    13 posts

    Didn’t work right.  It worked fine for the private post, but also shows the message on all posts that aren’t private.  Not exactly the desired effect.  😛

    Suggestions?

  • #9 / Jul 20, 2007 7:16am

    Daniel Walton

    553 posts

    I misinterpreted ‘Posts’ as belonging to the forum, and assumed that is what you were talking about. Perhaps ‘Entries’ would have been a better phrase?

    I prefer not to use advanced conditionals (if:else). I would do something like:

    {if member_group == '1' OR member_group == '6' && weblog_id == '2'}
    {privatebody}
    {/if}
    {if member_group != '1' AND member_group != '6' && weblog_id == '2'}
    Private, shoo!!!
    {/if}

    Edit: Lisa’s logic failed because any post not in weblog_id 2 would get “Private, shoo!!!”, even if the member group was 1 or 6.

  • #10 / Jul 20, 2007 8:47am

    PXLated

    1800 posts

    Just kind of curious why you don’t prefer advanced conditionals?

  • #11 / Jul 20, 2007 9:06am

    Daniel Walton

    553 posts

    For two reasons; You can easily spot simple logic problems using simple conditionals as exampled above and they are slightly less process intensive for ee to parse.

  • #12 / Jul 20, 2007 12:39pm

    I’m not sure I’d agree that

    {if (this)}
    
     one thing
    
    {/if} 
    
    {if not (this)}
    
     another thing
    
    {/if}

    is easier to parse from a human perspective than

    {if (this)}
    
      one thing
    
    {if:else}
    
      another thing
    
    {/if}

    It also seems like calling the conditional routines twice rather than one more intensive run wouldn’t necessarily be less process intensive in the long run, either.

  • #13 / Jul 20, 2007 3:07pm

    Riverboy

    2993 posts

    What private entries in weblogs. Why not using one weblog what is only for “your and your friend eyes”?
    Thats what i have made up. new usergroup who only has access to that secret weblog and

    {if logged_in}
    <WHAT EVER> 
    
    
    
    {if group_id == '7'}
    
    <a href="http://{path=template_group/template}">Special page</a>
    {/if}
    
    {/if}

    to show up the link when logged in.

    Well its different but i handle it this way 😊

  • #14 / Jul 20, 2007 3:19pm

    PXLated

    1800 posts

    Why not using one weblog what is only for “your and your friend eyes”?

    Well, there may be public and private aspects to a weblog and it would be a lot more work keeping them as two. For instance…
    I have a min-site for an old band I played in back in the 60s, it has a public (friends/family) side and a private (band members only). Using the gallery as an example, band members can upload old pics with captions but there are two caption fields, the public one, the one you’ll let your mother read, and a private one where we can leave something a little more earthy or unique just for us band members. The bandmembers can also leave comments on the private side that only we can see. It’s all using one weblog and then using conditionals in the templates.

    Edit-Add: I also used custom statuses (public/private) so some pics/posts can be band members only.

  • #15 / Jul 20, 2007 3:40pm

    Riverboy

    2993 posts

    well well. damn now im starting to think what all i can do with these secret posts. but dunno how they work so have to wait until i have time to put my head to this side of EE 😝

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

ExpressionEngine News!

#eecms, #events, #releases