Forum Replies Created
-
AuthorPosts
-
Jeremy Carlson
ParticipantThanks Anh,
I tried doing that but saw the same results. Looking at the
wp_mb_relationshipstable 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...
Jeremy Carlson
ParticipantHi Anh,
Excited to see you've incorporated Reciprocal Relationships. I'm running into some problems with it, though — I'm getting duplicate relationships listed. Does this look right for registering the relationship?
MB_Relationships_API::register( array( 'id' => 'good_companions', 'reciprocal' => true, 'from' => array( 'object_type' => 'post', 'post_type' => 'plant', 'admin_column' => "after title", 'meta_box' => array( 'title' => esc_html__( 'Good Companions', 'gtt-text' ), ), ), 'to' => array( 'object_type' => 'post', 'post_type' => 'plant', 'meta_box' => array( 'hidden' => true, ), ), ) );This was working for me before, and I'd been able to create the reciprocal relationship using the
rwmb_after_save_fieldhook. I've removed that code, but now each time I save aplantpost, the list of good_companions gets larger - at first glance, it seems to be adding a new instance of all related plants to the list each time.For now, I'm rolling back to 1.10.10.
November 23, 2019 at 12:30 AM in reply to: ✅ArgumentCountError on RWMB_Taxonomy_Field with MB_Revision #17083Jeremy Carlson
ParticipantWell, that'll teach me to try and debug before checking the forum! Just updated my plugins, and it's working again. Awesome!
Jeremy Carlson
ParticipantYeah, I got as far as a single form on a front-facing page, saving the data in the custom table. (Incredibly straightforward, love this API.)
And I'm definitely expecting to code a custom page, so I can show a date's currently-scheduled events.
TBH I don't think they need to be multiple posts; that just seems simplest. But I've already noticed that I don't need any of the typical post information, only the custom field data. So it COULD be a bunch of meta info for one post. I mainly want to be sure I can query efficiently.
I may decide to only let the form input one at a time, and make sure it's done via AJAX so it's done fast enough that the user doesn't mind...
Jeremy Carlson
ParticipantHi there, I just wanted to check in — has anyone made progress on this concept? I'm working on a project where the relationship is very much reciprocal, and would love to use this.
In my case, the concept is plants which are "good companions" of each other. If tomatoes are good companions of basil, basil is automatically a good companion of a tomato.
I'm also considering implementing creating the reciprocal connection programmatically, but not quite sure how to go about that. New to MB.
Thanks for any input!
Jeremy -
AuthorPosts