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

system_notification()

Description

Send a system notification or email to the system administrators according to preference

Parameters

ColumnTypeDefaultDescription
$message string Message text
$url string "" Optional URL

Return

void

Location

include/message_functions.php lines 827 to 863

Definition

 
function system_notification($message$url="")
    {
    global 
$lang$applicationname;
    
$admin_notify_emails = array();
    
$admin_notify_users = array();
    
$notify_users=get_notification_users("SYSTEM_ADMIN");
    
$subject str_replace("[application_name]"$applicationname$lang["system_notification"]);
    foreach(
$notify_users as $notify_user)
        {
        
get_config_option($notify_user['ref'],'user_pref_system_management_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"]!="")
            {
            
$admin_notify_emails[] = $notify_user['email'];
            }
        else
            {
            
$admin_notify_users[]=$notify_user["ref"];
            }
        }
    foreach(
$admin_notify_emails as $admin_notify_email)
        {
        
$template "system_notification_email";
        
$templatevars = array("message"=>$message,"url"=>$url);
        
$messageplain $message "\n\n" $url;
        
send_mail($admin_notify_email,$subject,$messageplain,'','',$template,$templatevars);
        }

    if (
count($admin_notify_users)>0)
        {
        
message_add($admin_notify_users$message$url0);
        }
    }

This article was last updated 17th November 2024 15:05 Europe/London time based on the source file dated 1st July 2024 16:10 Europe/London time.