Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_user_message()

Description

Gets the user message for the given ref


False if user has no access or the requested message doesn't exist,

Parameters

ColumnTypeDefaultDescription
$ref int Message ID
$checkaccess bool true Check if user can see the given message?

Return

array|bool Array with two elements: 'message' => message text,'url'=> message URL and 'owner' => message owner

Location

include/message_functions.php lines 1056 to 1070

Definition

 
function get_user_message(int $refbool $checkaccess=true)
    {
    global 
$userref;
    if(
$checkaccess)
        {
        
$validmessages ps_array("SELECT ref value FROM user_message WHERE user = ?",["i",$userref]);
        if(!
in_array($ref,$validmessages))
            {
            return 
false;
            }
        }
    
$message ps_query("SELECT message, url, owner FROM message WHERE ref = ?",["i",$ref]);
    
    return 
$message ? ["message"=>$message[0]["message"],"url"=>$message[0]["url"],"owner"=>$message[0]["owner"]] : false;    
    }

This article was last updated 2nd December 2022 19:05 Europe/London time based on the source file dated 15th November 2022 21:30 Europe/London time.