Forum Replies Created
-
AuthorPosts
-
December 6, 2023 at 10:24 PM in reply to: MB_Relationships_API::each_connected not working, need fix or alternative #44027
John Rood
ParticipantWill that have an impact on performance? This is for an archive page
December 6, 2023 at 5:32 AM in reply to: Displaying connected content on post archive not working anymore #44019John Rood
ParticipantWe are also having this same issue. Using
MB_Relationships_API::each_connected, $post->connected returns an empty array whenvar_dump'ed, even though the rest of the post info is there, and the posts are in fact connected in the back end.This is a huge disruption for us, as it renders a large chunk of our site useless.
John Rood
ParticipantFYI, it looks like this same fix has been applied to MB AIO 1.20.2, you can see it in the changelog. I have updated and everything is fine on me.
John Rood
ParticipantOur version of the Facet WP integration is in the Meta Box AIO plugin. Has this been updated as well?
John Rood
ParticipantYes, we weren't able to rollback FacetWP, so I just changed the MB file. My thinking was that this will probably require an update of the MetaBox plugin anyway, so when that happens, my patch will be overridden with the official one.
If we get any direction here, I'll probably revert those changes and go with whatever MB says to do.
John Rood
ParticipantWe are able to temporarily fix this by editing lines 15-22 in Scott's example to:
/** * Facet label. * * @var string * @since 1.0.0 */ public $label; //changed to public and removed type declaration /** * FacetWP Indexer. * * @var FacetWP_Indexer */ public $indexer; //changed to publicEverything appears to be working now, but not sure of the long term effects, so we are eagerly awaiting an official patch.
John Rood
ParticipantWe are experiencing the same issue.
John Rood
ParticipantI have just tested with the pastebin code I shared previously disabled. The issue still persists.
The only other thing I can think of is maybe it has something to do with the way I am using the shortcode?
Here's how I'm adding the form:
[mb_user_profile_register password_strength='medium' role="pending_dealer" id="default-fields, dealership-user-details,dealer-contact-information,dealer-consent" confirmation="We have received your account information and your account is currently pending. In the meantime, you may log in to your account to modify your profile details. Once your account is approved, you will receive a message with further instructions." ]The
default-fieldsbox is added via the pastebin code I shared earlier. The rest are added with the builder, but I just double checked and all of those are set to required within the builder.John Rood
ParticipantI have a screen recording of what I'm experiencing. Could it be because I have multiple metaboxes?
I am using custom code to modify the default fields. Could it be anything related to this.
John Rood
ParticipantThis is what we ended up doing. Thanks! This can be closed.
John Rood
ParticipantI also had to pass in the existing
meta_boxesvariable at the beginning of the function to include fields that I had previously added with the builder. Just in case anyone else is in a similar scenario. If you don't do that, this will be the only meta box that shows.add_filter( 'rwmb_meta_boxes', function($meta_boxes){ ...code goes hereinstead of
add_filter( 'rwmb_meta_boxes', function(){ ...code goes hereJohn Rood
ParticipantThis worked perfectly with some modifications for our use case. One thing to note if anyone else find this helpful is that I changed your loop from
while ( $connected->have_posts() ) : $connected->the_post();
to
if( $connected->have_posts()) : while( $connected->have_posts()) : $connected->the_post();
so that I could do anelsein the event that no posts were found. Thanks for your help, you can mark this resolved!John Rood
ParticipantI will try this out and report back once I know more, but I think this should do it. Thank you for the clarification. I hadn't thought about doing it this way.
John Rood
ParticipantIs the issue that I'm using a callback function in an HTML field then? We are only trying to show a list of related posts with a link to edit, however, when I use the following function as a callback, I get an empty array.
function ndig_get_accepted_offer_admin(){ $results = array(); global $post; $postID = $post->ID; $connected = new WP_Query( [ 'relationship' => [ 'id' => 'listing-to-offer-relationship', 'from' => $postID, // You can pass object ID or full object ], 'nopaging' => true, ] ); while ( $connected->have_posts() ) : $connected->the_post(); $results[] = '<a href="'.the_permalink().'">'.the_title().'</a>'; endwhile; //$pretty_results = implode(" ",$results); return var_dump($results); wp_reset_postdata(); }John Rood
ParticipantHere is a stripped-down example of what I did, it is untested, but it should work just the same.
This details how you would do the
after_submissionhook. The dynamic population feature is the first step, but how you implement that will depend on your project. All that matters is you need to get that ID in the hidden field before anything will work. -
AuthorPosts