Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

remove_resource_from_collection()

Description

Remove resource $resource from collection $collection

Parameters

ColumnTypeDefaultDescription
$resource integer
$collection integer
$smartadd boolean false
$size string ""

Return

boolean

Location

include/collections_functions.php lines 344 to 374

Definition

 
function remove_resource_from_collection($resource,$collection,$smartadd=false,$size="")
    {
    if((string)(int)
$collection != (string)$collection || (string)(int)$resource != (string)$resource)
        {
        return 
false;
        }

    if (
collection_writeable($collection)||$smartadd)
        {    
        
hook("Removefromcollectionsuccess""", array( "resourceId" => $resource"collectionId" => $collection ) );
        
        if(!
hook("removefromcollectionsql""", array( $resource,$collection$size)))
            {
            
sql_query("delete from collection_resource where resource='" escape_check($resource) . "' and collection='" escape_check($collection) . "'");
            
sql_query("delete from external_access_keys where resource='" escape_check($resource) . "' and collection='" escape_check($collection) . "'");
            }
        
        
// log this
        
collection_log($collection,"r",$resource);

        
// Clear theme image cache
        
clear_query_cache("themeimage");

        return 
true;
        }
    else
        {
        
hook("Removefromcollectionfail""", array( "resourceId" => $resource"collectionId" => $collection ) );
        return 
false;
        }
    }

This article was last updated 10th July 2020 22:35 Europe/London time based on the source file dated 9th July 2020 17:22 Europe/London time.