Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

message_get()

Description

Gets messages for a given user (returns true if there are messages, false if not)
Note that messages are passed by reference.

Parameters

ColumnTypeDefaultDescription
&$messages
$user int User ID
$get_all bool false Retrieve all messages? Setting to TRUE will include all seen and expired messages
$sort_desc bool false Sort by message ID in descending order? False = Ascending
$messages array Array that will be populated by messages. Passed by reference

Return

bool Flag to indicate if any messages exist

Location

include/message_functions.php lines 13 to 24

Definition

 
function message_get(&$messages,$user,$get_all=false,$sort_desc=false)
    {
    
$messages=sql_query("SELECT user_message.ref, user.username AS owner, user_message.seen, message.created, message.expires, message.message, message.url " .
        
"FROM `user_message`
        INNER JOIN `message` ON user_message.message=message.ref " 
.
        
"LEFT OUTER JOIN `user` ON message.owner=user.ref " .
        
"WHERE user_message.user='{$user}'" .
        (
$get_all " " " AND message.expires > NOW()") .
        (
$get_all " " " AND user_message.seen='0'") .
        
" ORDER BY user_message.ref " . ($sort_desc "DESC" "ASC"));
    return(
count($messages) > 0);
    }

This article was last updated 30th November 2020 20:35 Europe/London time based on the source file dated 4th August 2020 08:55 Europe/London time.