Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

notify_user_contributed_submitted()

Description

Send notifications when resources are moved from "User Contributed - Pending Submission" to "User Contributed - Pending Review"

Parameters

ColumnTypeDefaultDescription
$refs array|int ID of resource(s)
$collection int 0 ID of collection

Return

boolean|void

Location

include/resource_functions.php lines 4648 to 4715

Definition

 
function notify_user_contributed_submitted($refs,$collection=0)
    {
    global 
$notify_user_contributed_submitted,$applicationname,$email_notify,$baseurl,$lang,$use_phpmailer,$userref;
    if (!
$notify_user_contributed_submitted) {return false;} # Only if configured.
    
$htmlbreak="\r\n";
    if (
$use_phpmailer){$htmlbreak="<br /><br />";}
    
    
$list="";
    if(
is_array($refs))
        {
        for (
$n=0;$n<count($refs);$n++)
            {
            
$list .= process_notify_user_contributed_submitted($refs[$n],$htmlbreak);
            }
        }
    else
        {
        
$list=process_notify_user_contributed_submitted($refs,$htmlbreak);
        }
        
    
$list.=$htmlbreak;    
    
    if(
$collection != 0
        {
        
$templatevars['url'] = $baseurl "/pages/search.php?search=!collection" $collection;
        }
    elseif(
is_array($refs) && count($refs) < 200)
        {
        
$templatevars['url'] = $baseurl "/pages/search.php?search=!list" implode(":",$refs);
        }
    else
        {
        
$templatevars['url'] = $baseurl "/pages/search.php?search=!contributions" $userref "&archive=-1";
        }
    
    
$templatevars['list']=$list;
    
$message=$lang["userresourcessubmitted"] . "\n\n"$templatevars['list'] . "\n\n" $lang["viewall"] . "\n\n" $templatevars['url'];
    
$notificationmessage=$lang["userresourcessubmittednotification"];
    
$notify_users=get_notification_users(array("e-1","e0")); 
    
$message_users=array();
    foreach(
$notify_users as $notify_user)
            {
            
get_config_option($notify_user['ref'],'user_pref_resource_notifications'$send_message);          
            if(
$send_message==false){continue;}        
            
            
get_config_option($notify_user['ref'],'email_user_notifications'$send_email);    
            if(
$send_email && $notify_user["email"]!="")
                {
                
send_mail($notify_user["email"],$applicationname ": " $lang["status-1"],$message,"","","emailnotifyresourcessubmitted",$templatevars);
                }        
            else
                {
                
$message_users[]=$notify_user["ref"];
                }
            }
    if (
count($message_users)>0)
        {
        global 
$userref;
        if(
$collection!=0)
            {
            
message_add($message_users,$notificationmessage,$templatevars['url'],$userref,MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN,MESSAGE_DEFAULT_TTL_SECONDS,SUBMITTED_COLLECTION,$collection);
            }
        else
            {
            
message_add($message_users,$notificationmessage,$templatevars['url'],$userref,MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN,MESSAGE_DEFAULT_TTL_SECONDS,SUBMITTED_RESOURCE,(is_array($refs)?$refs[0]:$refs));
            }
        }
    }

This article was last updated 26th January 2022 11:05 Europe/London time based on the source file dated 25th January 2022 13:30 Europe/London time.