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 852 to 870

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 28th November 2022 04:35 Europe/London time based on the source file dated 15th November 2022 21:30 Europe/London time.