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

can_delete_featured_collection()

Description

Verify if a featured collection can be deleted. To be deleted, it MUST not have any resources or children (if category).

Parameters

ColumnTypeDefaultDescription
$ref integer Collection ID

Return

boolean Returns TRUE if the featured collection can be deleted, FALSE otherwise

Location

include/collections_functions.php lines 5241 to 5258

Definition

 
function can_delete_featured_collection(int $ref)
    {
    
$sql sprintf(
          
"SELECT DISTINCT c.ref AS `value`
             FROM collection AS c
        LEFT JOIN collection AS cc ON c.ref = cc.parent
        LEFT JOIN collection_resource AS cr ON c.ref = cr.collection
            WHERE c.`type` = %s
              AND c.ref = '%s'
         GROUP BY c.ref
           HAVING count(DISTINCT cr.resource) = 0
              AND count(DISTINCT cc.ref) = 0"
,
        
COLLECTION_TYPE_FEATURED,
        
escape_check($ref)
    );

    return (
sql_value($sql0) > 0);
    }

This article was last updated 21st April 2021 17:05 Europe/London time based on the source file dated 19th April 2021 16:50 Europe/London time.