Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

save_filter()

Description

Save filter, will return existing filter ID if text matches already migrated

Parameters

ColumnTypeDefaultDescription
$filter int - ID of filter
$filter_name int - Name of filter
$filter_condition int - One of RS_FILTER_ALL,RS_FILTER_NONE,RS_FILTER_ANY

Return

boolean | integer - false, or ID of filter

Location

include/search_functions.php lines 2857 to 2879

Definition

 
function save_filter($filter,$filter_name,$filter_condition)
    {
    if(!
in_array($filter_condition, array(RS_FILTER_ALL,RS_FILTER_NONE,RS_FILTER_ANY)))
        {
        return 
false;
        }
        
    if(
$filter != 0)
        {    
        if(!
is_numeric($filter))
            {
            return 
false;    
            }
        
ps_query("UPDATE filter SET name=?, filter_condition=? WHERE ref = ?",array("s",$filter_name,"s",$filter_condition,"i",$filter));
        }
    else
        {
        
ps_query("INSERT INTO filter (name, filter_condition) VALUES (?,?)",array("s",$filter_name,"s",$filter_condition));
        return 
sql_insert_id();
        }

    return 
$filter;
    }

This article was last updated 19th March 2024 04:05 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.