Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

get_filter_rules()

Description

Get filter rules for use in search

Parameters

ColumnTypeDefaultDescription
$filterid int ID of filter (from usergroup search_filter_id or user search_filter_oid)

Return

array

Location

include/search_functions.php lines 2505 to 2531

Definition

 
function get_filter_rules($filterid)
    {
    
$filter_rule_nodes  sql_query("SELECT fr.ref as rule, frn.node_condition, frn.node FROM filter_rule fr LEFT JOIN filter_rule_node frn ON frn.filter_rule=fr.ref WHERE fr.filter='" escape_check($filterid) . "'"); 
        
    
// Convert results into useful array    
    
$rules = array();
    foreach(
$filter_rule_nodes as $filter_rule_node)
        {
        
$rule $filter_rule_node["rule"];
        if(!isset(
$rules[$filter_rule_node["rule"]]))
            {
            
$rules[$rule] = array();
            
$rules[$rule]["nodes_on"] = array();
            
$rules[$rule]["nodes_off"] = array();
            }
        if(
$filter_rule_node["node_condition"] == 1)
            {
            
$rules[$rule]["nodes_on"][] = $filter_rule_node["node"];
            }
        else
            {
            
$rules[$rule]["nodes_off"][] = $filter_rule_node["node"];
            }
        }
        
    return 
$rules;
    }

This article was last updated 30th November 2020 16:35 Europe/London time based on the source file dated 26th November 2020 14:30 Europe/London time.