Support Forum ยป User Profile

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • Stephen WalkerStephen Walker
    Participant

    The workaround

    /**
     * Plugin Name: Meta Box and WP Grid Builder relationship compatibility
     * Description: Automatically restores registered Meta Box relationship sources in copied WP Grid Builder post queries, including AND/OR combinations.
     * Version: 0.2.0
     */
    defined('ABSPATH') || exit;
    
    final class MB_WPGB_Relationship_Compat {
        /** Repair only normalized clauses belonging to registered relationships. */
        public static function restore_clause($args) {
            if (!is_array($args) || !is_string($args['id'] ?? null)) return $args;
            // Preserve fresh arguments, including explicitly supplied source IDs.
            if (isset($args['from']) || isset($args['to'])) return $args;
            $direction = $args['direction'] ?? '';
            if (!in_array($direction, ['from', 'to'], true) || !isset($args['items']) || !is_array($args['items'])) return $args;
            $relationship = MB_Relationships_API::get_relationship($args['id']);
            if (!$relationship || ($args['id_field'] ?? null) !== $relationship->get_db_field($direction)) return $args;
            $args[$direction] = $args['items'];
            return $args;
        }
    
        /** Meta Box 1.14.0 supports a single clause or one flat AND/OR group. */
        public static function restore($args) {
            if (!class_exists('MB_Relationships_API') || !is_array($args)) return $args;
            if (!isset($args['relation'])) return self::restore_clause($args);
            if (!in_array($args['relation'], ['AND', 'OR'], true)) return $args;
            foreach ($args as $key => $clause) {
                if ($key !== 'relation') $args[$key] = self::restore_clause($clause);
            }
            return $args;
        }
    
        public static function repair_query(WP_Query $query) {
            if (!class_exists('MB_Relationships_API')) return;
            // WPGB removes wp_grid_builder after filtering but retains wpgb_inject
            // when copying the query to calculate facet choices and counts.
            $grid = $query->get('wp_grid_builder') ?: $query->get('wpgb_inject');
            if (!is_scalar($grid) || empty($grid)) return;
            $args = $query->get('relationship');
            $restored = self::restore($args);
            if ($restored !== $args) $query->set('relationship', $restored);
        }
    }
    
    // MB Relationships 1.14.0 parses post queries at priority 20.
    add_action('parse_query', [MB_WPGB_Relationship_Compat::class, 'repair_query'], 19);
    in reply to: WYSIWYG code view is not visible #48322
    Stephen WalkerStephen Walker
    Participant

    At this point (AIO 2.2.1), no. I am not sure why it started happening. The only other item I know that uses the legacy editor in these sites is Bricks Builder for the Rich Text element, but there are no problems with that.

    Stephen WalkerStephen Walker
    Participant

    I just installed the so-called fix (2.1.1), and now the tab panels do not show. The display:none is not removed when the tab is active.

    Stephen WalkerStephen Walker
    Participant

    Is this still being developed?

    in reply to: โœ…Restrict file type with File Upload field #43984
    Stephen WalkerStephen Walker
    Participant

    Any plans to add this functionality? It seems essential for any field that allows you to upload to the server. Your primary competitor has had it for at least five years, and this may force me to go to that product (just saying).

    in reply to: โœ…Impossible to preview posts #43817
    Stephen WalkerStephen Walker
    Participant

    Just chiming in that this is impacting multiple sites for me as well. Looking forward to a fix.

    in reply to: โœ…In Multisite, Admin role cannot access Meta Box #41871
    Stephen WalkerStephen Walker
    Participant

    Thank you for the information. The setting within the network section was the key.

Viewing 7 posts - 1 through 7 (of 7 total)