flojdm
Forum Replies Created
-
Forum: Plugins
In reply to: [Admin Columns] “OR” condition with filtersAfter searching a lot I’ve found a way to do it but encountering an issue with the meta query generation in the
query.php
file within theadmin-column-pro/Classes
directory. Despite my efforts to modify the code, I’m facing difficulties with combining multiple entity IDs in the meta query.<?php namespace ACP; use AC\Registerable; use ACP\Query\Bindings; use LogicException; abstract class Query implements Registerable { /** * @var Bindings[] */ protected $bindings; /** * @param Bindings[] $bindings */ public function __construct(array $bindings) { $this->bindings = $bindings; $this->validate_bindings(); } /** * @throws LogicException */ private function validate_bindings(): void { foreach ($this->bindings as $bindings) { if ( ! $bindings instanceof Bindings) { throw new LogicException('Expected Bindings object.'); } } } protected function get_meta_query(): array { $meta_query = []; $entities_ids = []; foreach ($this->bindings as $binding) { $args = $binding->get_meta_query(); if ($args["key"] == "entity_id") { $entity_id = (int) unserialize($args["value"]); $entities_ids[] = $entity_id; } else { $meta_query[] = $binding->get_meta_query(); } } $meta_query = array_filter($meta_query); if ($entities_ids) { $entity_meta_queries = []; foreach ($entities_ids as $entity_id) { $entity_meta_queries[] = [ 'key' => 'entity_id', 'value' => $entity_id, 'compare' => 'LIKE', ]; } $meta_query[] = [ 'relation' => 'OR', $entity_meta_queries, ]; } $meta_query[] = [ 'relation' => 'AND', ]; return $meta_query; } }
Then query :
array(3) { [0]=> array(4) { [“key”]=> string(6) “source” [“value”]=> string(6) “import” [“compare”]=> string(1) “=” [“type”]=> string(4) “CHAR” } [1]=> array(2) { [“relation”]=> string(2) “OR” [0]=> array(2) { [0]=> array(3) { [“key”]=> string(20) “entity_id” [“value”]=> int(3206) [“compare”]=> string(4) “LIKE” } [1]=> array(3) { [“key”]=> string(20) “entity_id” [“value”]=> int(2991) [“compare”]=> string(4) “LIKE” } } } [2]=> array(1) { [“relation”]=> string(3) “AND” } } array(1) { [0]=> array(1) { [“relation”]=> string(3) “AND” } }
While the meta query seems to be correct individually, it doesn’t work as expected when combining multiple entity IDs. However, it works fine when I only use one entity ID.
Any idea on how to fix this?Thank you for your attention to this matter.
- This reply was modified 6 months, 3 weeks ago by flojdm.
Forum: Plugins
In reply to: [Admin Columns] “OR” condition with filtersI just saw that someone had already asked this question and you said it wasn’t possible but please is there any way to do this ? Maybe with a filter for a specific column ?
Hi there,
I have quickly fix my problem by simply copied the contents of the CSS file generated in the root directory and pasted it into the “style.css” file of my child theme. In my case, the file was located at: “public_html/4575_6313cf3050e68233c2573fad6073dedd/css/style-4575.css”.I exhausted all possible solutions to fix the problem, including disabling themes and plugins, as well as clearing browser cache. Unfortunately, none of these actions proved successful in resolving the error.
Best regards,Forum: Plugins
In reply to: [Advanced Forms for ACF] Hide Field in FormForum: Plugins
In reply to: [Elementor Custom Skin] Sort by “Menu order” creates duplicates@dudaster Please, fix this problem for which you have not yet given a valid answer on any other post.