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.

Limiting channel entries to one

February 14, 2011 3:42pm

Subscribe [3]
  • #1 / Feb 14, 2011 3:42pm

    kellysims

    123 posts

    Not sure if this is the right forum section for this, since it relates to Safecracker.

    I am trying to limit safecracker posts in a channel to one per user. Here’s what I’m doing.

    I have a channel with entries, call it Channel A. I then have another channel, Channel B, that users can post to. Channel B has two custom fields, one is a number and one is a relationship field to Channel A.

    I have the safecracker saef set up so that it shows on a single entry page for Channel A only. It prepopulates the relationship field with the current Channel A entry, so the user only enters a number. Simple enough, and working fine.

    I need some way to stop showing the safecracker form when a user has already posted to Channel B once, related to that Channel A entry.

    Any ideas? (Goodness, this sounds like a hairy mess now typing it all out)

  • #2 / Feb 14, 2011 4:18pm

    kellysims

    123 posts

    I think what I’ll need here is a query. Trying to wrap my head around how to build it, not very good at using the Query module.

  • #3 / Feb 17, 2011 3:58pm

    adamwiggall

    178 posts

    So you want to run a check on Channel B to determine if any entries are related to the member.

    If they are you know they’ve posted so don’t show the form.

    So you could use the if_no_results (no relationships) tag pair to out put the form, otherwise, put a “You can’t post again” type message.

    Is that right?

  • #4 / Feb 17, 2011 4:02pm

    kellysims

    123 posts

    Checking Channel B for both author_id as well as the relationship to the Channel A current entry, now showing on the same page.

    There will be future posts in Channel B that relate to future posts in Channel A, so the check for the relationship has to be there, right? (I confuse myself just thinking about it.)

  • #5 / Feb 17, 2011 4:06pm

    adamwiggall

    178 posts

    What type of relationship are we talking about here? Channel A has one or many Entries in Channel B or vica versa? Or a many to many, or a one to one?

  • #6 / Feb 17, 2011 4:08pm

    kellysims

    123 posts

    Channel A has it’s own entries. Each Channel B entry relates to a Channel A entry, and also has a single number field.

  • #7 / Feb 17, 2011 4:14pm

    adamwiggall

    178 posts

    Skype me: adamwiggall

  • #8 / Feb 17, 2011 4:16pm

    kellysims

    123 posts

    Will do, lunch break then I’ll hit you up. Thanks Adam!

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

ExpressionEngine News!

#eecms, #events, #releases