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.

Help me find a good solution for this.

September 13, 2011 4:55pm

Subscribe [3]
  • #1 / Sep 13, 2011 4:55pm

    insomnie

    56 posts

    Trying to figure out how to make an entry form for user which he/she can only submit once. This could go to a channel. But the idea is to only enable the user to submit that data once.

    I’ll roughly describe what I need.

    Imagine there is some gameplay that all users can be part of. It’s based on predicting a certain outcome. Lets say for each game a user can submit 5 numbers. There will be multiple games each day but then can only enter each one once.

    I am trying to figure out a way to do this most efficiently. Any suggestion will be welcome.

  • #2 / Sep 13, 2011 5:01pm

    W3 | 84ideas

    22 posts

    If a user submits an entry, the entry will be stored related to a particular game I suppose.
    So now if we query on game_id and member_id, we get either records, or no records.

    If you check that before allowing the member to submit the form, you could check if he already has a record, if so you don’t allow him to do this again.

    Cheers,
    Mike

  • #3 / Sep 13, 2011 5:19pm

    LMO

    203 posts

    Another idea that may work is to use the default channel entries loop. If you have each game set to a channel and a member can only see the form if he has no entry in the channel.

    {exp:channel:entries
        channel="game_name"
        author_id="CURRENT_USER"
    }
        {if no_results}
            -- FORM HERE --
        {/if}
        
    {/exp:channel:entries}
  • #4 / Sep 13, 2011 5:38pm

    W3 | 84ideas

    22 posts

    Hi VIM,

    That’s exactly what I meant, thanks for the code example!

    Mike

  • #5 / Sep 13, 2011 5:42pm

    insomnie

    56 posts

    Brilliant! Thank you guys!

  • #6 / Sep 13, 2011 5:46pm

    LMO

    203 posts

    No problem! Any time.

  • #7 / Sep 13, 2011 6:02pm

    W3 | 84ideas

    22 posts

    Welcome!

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

ExpressionEngine News!

#eecms, #events, #releases