Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 946 to 964

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 24th May 2024 11:05 Europe/London time based on the source file dated 20th May 2024 10:55 Europe/London time.