Collections functions
General functions
Render functions
Theme permission functions
Resource functions

send_user_message()

Description

Send a user to user(s) message

Parameters

ColumnTypeDefaultDescription
$users array Array of user IDs or usernames/groupnames from user select
$text string Message text

Return

bool|string True if sent ok or error message

Location

include/message_functions.php lines 847 to 865

Definition

 
function send_user_message($users,$text)
    {
    global 
$userref$lang;
    
$users=explode(",",resolve_userlist_groups($users));
    for(
$n=0;$n<count($users);$n++)
        {
        if(!
is_int_loose($users[$n]))
            {
            
$uref get_user_by_username(trim($users[$n]));
            if (!
$uref)
                {
                return 
$lang["error_invalid_user"];
                }
            
$users[$n] = $uref
            }
        }
    
message_add($users,$text,"",$userref,MESSAGE_ENUM_NOTIFICATION_TYPE_USER_MESSAGE MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN,30*24*60*60);
    return 
true;
    }

This article was last updated 12th August 2022 18:35 Europe/London time based on the source file dated 2nd August 2022 16:05 Europe/London time.