Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

notify_user_contributed_unsubmitted()

Description

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

Parameters

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

Return

boolean

Location

include/resource_functions.php lines 4204 to 4282

Definition

 
function notify_user_contributed_unsubmitted($refs,$collection=0)
    {
    
// Send notifications when resources are moved from "User Contributed - Pending Review"    to "User Contributed - Pending Submission"
    
global $notify_user_contributed_unsubmitted,$applicationname,$email_notify,$baseurl,$lang,$use_phpmailer;
    if (!
$notify_user_contributed_unsubmitted) {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++)
            {
            
$url="";    
            
$url=$baseurl "/?r=" $refs[$n];
            
            if (
$use_phpmailer){$url="<a href=\"$url\">$url</a>";}
            
            
$list.=$htmlbreak $url "\n\n";
            }
        }
    else
        {
        
$url="";    
        
$url=$baseurl "/?r=" $refs;
        if (
$use_phpmailer){$url="<a href=\"$url\">$url</a>";}
        
$list.=$htmlbreak $url "\n\n";
        }
    
    
$list.=$htmlbreak;        
    
$templatevars['list']=$list;
    
    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=-2";
        }
        
    
$message=$lang["userresourcesunsubmitted"]."\n\n"$templatevars['list'] . $lang["viewall"] . "\n\n" $templatevars['url'];

    
$notificationmessage=$lang["userresourcesunsubmittednotification"];
    
$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-2"],$message,"","","emailnotifyresourcesunsubmitted",$templatevars);
                }        
            else
                {
                
$message_users[]=$notify_user["ref"];
                }
            }
    if (
count($message_users)>0)
        {
        global 
$userref;
        
message_add($message_users,$notificationmessage,$templatevars['url']);
        }
    
    
# Clear any outstanding notifications relating to submission of these resources
    
message_remove_related(SUBMITTED_RESOURCE,$refs);
    if(
$collection!=0)
        {
        
message_remove_related(SUBMITTED_COLLECTION,$collection);
        }
    }        

This article was last updated 16th July 2020 01:05 Europe/London time based on the source file dated 15th July 2020 16:26 Europe/London time.