Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

save_collection_resource_comment()

Description

Save a comment and/or rating for the instance of a resource in a collection.

Parameters

ColumnTypeDefaultDescription
$resource integer
$collection integer
$comment string
$rating integer

Return

boolean

Location

include/collections_functions.php lines 2117 to 2127

Definition

 
function save_collection_resource_comment($resource,$collection,$comment,$rating)
    {
    
# get data before update so that changes can be logged.    
    
$data=sql_query("select comment,rating from collection_resource where resource='" escape_check($resource) . "' and collection='" escape_check($collection) . "'");
    
sql_query("update collection_resource set comment='" escape_check($comment) . "',rating=" . (($rating!="")?"'" escape_check($rating) . "'":"null") . ",use_as_theme_thumbnail='" . (getval("use_as_theme_thumbnail","")==""?0:1) . "' where resource='" escape_check($resource) . "' and collection='" escape_check($collection) . "'");
    
    
# log changes
    
if ($comment!=$data[0]['comment']){collection_log($collection,"m",$resource);}
    if (
$rating!=$data[0]['rating']){collection_log($collection,"*",$resource);}
    return 
true;
    }

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