Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

remove_keyword_from_resource()

Parameters

ColumnTypeDefaultDescription
$ref
$keyword
$resource_type_field
$optional_column ''
$optional_value ''
$normalized false
$position ''

Location

include/resource_functions.php lines 2064 to 2088

Definition

 
function remove_keyword_from_resource($ref,$keyword,$resource_type_field,$optional_column='',$optional_value='',$normalized=false$position='')
    {
    if(!
$normalized)
        {
        global 
$unnormalized_index;
        
$kworig=$keyword;
        
$keyword=normalize_keyword($keyword);
        if(
$keyword!=$kworig && $unnormalized_index)
            {
            
// $keyword has been changed by normalizing, also remove the original value
            
remove_keyword_from_resource($ref,$kworig,$resource_type_field,$optional_column='',$optional_value='',true);
            }
        }        
    
        
$keyref=resolve_keyword($keyword,truefalse);
    if (
$optional_column<>'' && $optional_value<>'')    # Check if any optional column value passed and include this condition
        
{
        
sql_query("delete from resource_keyword where resource='$ref' and keyword='$keyref' and resource_type_field='$resource_type_field'" . (($position!="")?" and position='" $position ."'":"") . " and $optional_column$optional_value");
        }
    else{
        
sql_query("delete from resource_keyword where resource='$ref' and keyword='$keyref' and resource_type_field='$resource_type_field'" . (($position!="")?" and position='" $position ."'":""));
        }
    
ps_query("update keyword set hit_count=hit_count-1 where ref=? limit 1",array("i",$keyref));
            
    }

This article was last updated 28th June 2022 15:05 Europe/London time based on the source file dated 27th June 2022 12:50 Europe/London time.