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

notify_resource_change()

Parameters

ColumnTypeDefaultDescription
$resource

Location

include/resource_functions.php lines 8399 to 8422

Definition

 
function notify_resource_change($resource)
    {
    
debug("notify_resource_change " $resource);
    global 
$notify_on_resource_change_days$baseurl;
    
// Check to see if we need to notify users of this change
    
if($notify_on_resource_change_days==|| !is_int($notify_on_resource_change_days))
        {
        return 
false;
        }

    
debug("notify_resource_change - checking for users that have downloaded this resource " $resource);
    
$download_users=ps_query("SELECT DISTINCT u.ref, u.email FROM resource_log rl LEFT JOIN user u ON rl.user=u.ref WHERE rl.type='d' AND rl.resource=? AND DATEDIFF(NOW(),date)<?",["i",$resource,"i",$notify_on_resource_change_days],"");
    if(
count($download_users)>0)
        {
        
$notifymessage = new ResourceSpaceUserNotification();
        
$notifymessage->set_subject("lang_notify_resource_change_email_subject");
        
$notifymessage->set_text("lang_notify_resource_change_email",["[days]","[url]"],[$notify_on_resource_change_days,$baseurl "/?r=" $resource]);
        
$notifymessage->user_preference "user_pref_resource_notifications";
        
$notifymessage->url $baseurl "/?r=" $resource;
        
$notifymessage->template 'notify_resource_change_email';
        
$notifymessage->templatevars = ["days"=>$notify_on_resource_change_days,"url"=>$baseurl "/?r=" $resource];
        
send_user_notification($download_users,$notifymessage);
        }
    }

This article was last updated 13th November 2024 20:35 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.