Custom Fields
Re-Envisioned
Support MB Relationships Single metabox on Reciprocal Relationship

  • Creator
    Topic
  • #14412
    Resolved Content Pilot
    Participant

    Hi Ahn,

    Until now, I have been using this plugin to relate an object in post type A with an object in post type B. This works great b/c the plugin creates a to and from metabox on each post type edit screen. I am now being ask if we can have a reciprocal relationship between two objects in the same post type. From the initial testing and reading the docs, both the to and from meta are being created. is there any way or do you have an idea of how to get it down to a single metabox when performing this type of relationship. I would be willing to submit a PR on github if we can talk through how this could be accomplished.

    My initial thought was to add a flag in the metabox registration like reciprocal => true and then that disables the default metabox output. Then you can insert the single metabox which is a combination of the two and from objects mashed together somehow. Does that sound like a good approach? What do you think? This is a must have for the platform I am building btw. Really appreciate your time.

Viewing 11 replies (of 11 total)
  • Author
    Replies
  • #18198
    Jeremy Carlson
    Participant

    Thanks Anh,

    I tried doing that but saw the same results. Looking at the wp_mb_relationships table more closely, I see that all of my existing plants already have two rows for each relationship. So I suspected that was causing the duplication.

    Trying a new plant, I did not see the same duplication (using your registration code above, AIO v.1.10.16) but I did see another issue, which I perhaps should have mentioned earlier -- I'm seeing "Bad Companions" show up which are duplicates of the Good Companions.

    Yes, I have a second reciprocal relationship set up for plants <-> plants, as we also want to know what plants do not grow well together. The setup is similar.

    I'm exploring this further, as I'd like to be able to upgrade simply...

Viewing 11 replies (of 11 total)
  • You must be logged in to reply to this topic.