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_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 4725 to 4803

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 26th January 2022 11:05 Europe/London time based on the source file dated 25th January 2022 13:30 Europe/London time.