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.

Relationships are hard, this one in particular.

May 04, 2010 12:05pm

Subscribe [2]
  • #1 / May 04, 2010 12:05pm

    Wade Sakundiak

    7 posts

    Hey folks. I’ve got an issue. I’m building a site that involves relationships. Urgh. Basically, what I need to do is relate one entry to another from a SAEF, invisibly, and limit it to one.

    For example, User One enters some information about themselves from a SAEF into one weblog. User Two comes along and sees that User One has put some information about themselves up there. User Two is User One’s brother and he sees a button that says “I’m Related!” located below his brother’s profile. He clicks it (can you feel the excitement?). User Two is then presented with the same SAEF his brother filled out but linked to another weblog. He fills the form, submits and the page reloads and displays User One and User Two’s information. Rejoice! Now, if User One and User Two have another brother, that Brother is just SOL because this relationship is limited to one. Way to go User Two, you totally just snaked your other brother. Any number of other Users may come along and repeat this exercise but it remains that each initially entry can only be tied to one other entry.

    My initial thinking for building this type of thing would be to just use one weblog and add fields to the comment form that matched the fields for the weblog, limit it to display one comment and use conditionals to remove the link if one comment existed. But drat! You can’t create custom comment fields. So, you know, that totally ruined my day.

    Is there a way any of you can think of that would be the easiest way to approach this and solve my dilemma? Am I making sense even? I bet it’s totally obvious and I’m just blanking out. Any help you can provide would be greatly appreciated.

  • #2 / May 04, 2010 12:11pm

    Carl W Crawley

    136 posts

    I would recommend that you simply use related_entries and reverse_related_entries and do a conditional on the weblog entry? If the weblog contains a reverse_related_entry, don’t show the “I’m related” tab and vice versa.

    Make Sense?

    C.

  • #3 / May 04, 2010 12:27pm

    Wade Sakundiak

    7 posts

    Urghhh. Yep. Totally makes sense. Thank you for jarring my brain. Do you know how difficult it is to type “relationships” and “related” and not think of Related Entries? It’s pretty hard. Thanks again for giving my brain the kick in the butt it needed this morning.

  • #4 / May 04, 2010 12:32pm

    Carl W Crawley

    136 posts

    Heh! No worries, we all have days where the logic just doesn’t make sense! thats why the EE community is so good! 😊

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

ExpressionEngine News!

#eecms, #events, #releases