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.

Comment conditional

December 01, 2011 10:58am

Subscribe [2]
  • #1 / Dec 01, 2011 10:58am

    Jerseyjones

    19 posts

    I’m looking to only allow 1 comment per member for each entry. Is there a way to write a conditional, or perhaps a way to format that comment module tags to make is so a member who has already commented on the entry is restricted to do so again. something liek:

    If Already commented
    “You have already reviewed this entry”
    If:else
    “Please review this entry”
    /if

    Pardon the shorthand

  • #2 / Dec 02, 2011 1:20pm

    Kevin Smith

    4784 posts

    Hi Jerseyjones,

    Thanks for the question! Sadly, there’s not a native conditional for this sort of thing. I couldn’t find anything that might do that listed on Devot://ee, but might be a really helpful plugin to write if you’ve got any development chops.

    Is there anything else I can help you with?

  • #3 / Dec 06, 2011 1:28pm

    Jerseyjones

    19 posts

    Alright So I think I can do this with the Query Module.

    I would love some advice on how to improve on this.

    {exp:channel:entries channel="beer" status="open" limit="1"}
    
    {exp:query sql="SELECT count(*) name FROM exp_comments WHERE author_id='{member_id}'AND entry_id='{entry_id}'"}
    {if "{name}" != "0"}
    Has Commented
    {if:else}
    Has Not Commented
    {/if}
    {/exp:query}
    
    {/exp:channel:entries}
  • #4 / Dec 07, 2011 10:03am

    Kevin Smith

    4784 posts

    Hey Jerseyjones,

    While we’re not set up to help with queries in the Query module, I’d be more than happy to move this thread over to Community Help so that others in our community could help you come up with a solid solution. Would you like me to do that?

  • #5 / Dec 07, 2011 10:32am

    Jerseyjones

    19 posts

    Yes please move

  • #6 / Dec 08, 2011 3:24pm

    Kevin Smith

    4784 posts

    Sure thing. I’ve moved this thread over to Community Help.

    Best of luck!

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

ExpressionEngine News!

#eecms, #events, #releases