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

delete_resource_nodes()

Description

Delete nodes in array from resource

Parameters

ColumnTypeDefaultDescription
$resourceid integer Resource ID to add nodes to
$nodes array array Array of node IDs to remove
$logthis boolean true Log this? Log entries are ideally added when more data on all changes made is available to make reverts easier.

Return

void

Location

include/node_functions.php lines 1338 to 1363

Definition

 
function delete_resource_nodes($resourceid,$nodes=array(),$logthis=true)
    {
    if(!
is_array($nodes))
        {
        
$nodes = array($nodes);
        }

    
$nodes array_filter($nodes"is_numeric");

    
sql_query("DELETE FROM resource_node WHERE resource = '" escape_check($resourceid) . "' AND node IN ('" implode("', '"escape_check_array_values($nodes)) . "')"); 

    if(
$logthis)
        {
        
$field_nodes_arr = array();
        foreach (
$nodes as $node)
            {
            
$nodedata = array();
            
get_node($node$nodedata);
            
$field_nodes_arr[$nodedata["resource_type_field"]][] = $nodedata["name"];
            }
        foreach (
$field_nodes_arr as $key => $value)
            {
            
resource_log($resourceid,"e",$key,"","," implode(",",$value),'');
            }
        }
    }

This article was last updated 30th November 2020 17:05 Europe/London time based on the source file dated 30th November 2020 09:45 Europe/London time.