Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion admin/class-h5p-content-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,23 @@ public function __construct($fields, $offset = NULL, $limit = NULL, $order_by =
if (!isset($filter[0]) || !isset($filter[1])) {
throw new Exception('Missing filter options.');
}


// Additional search in field 'parameters'
if ($filter[0] === 'title' && ( !isset($filter[2]) || $filter[2] === 'LIKE' )) {
// Search in title OR in parameters
$this->where .= ($this->where ? ' AND ' : ' WHERE ')
. '('
. "hc.title" . $this->valid_operators['LIKE']
. " OR hc.parameters" . $this->valid_operators['LIKE']
. ')';

// Add both terms
$this->where_args[] = $filter[1];
$this->where_args[] = preg_quote(substr(json_encode($filter[1]), 1, -1));

continue;
}

$field = $this->get_valid_field($filter[0]);

// Add join
Expand Down