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

message_remove_related()

Description

Remove all messages related to a certain activity (e.g. resource request or resource submission)
matching the given ref(s)

Parameters

ColumnTypeDefaultDescription
$remote_activity int 0 ID of related activity type - see SYSTEM NOTIFICATION TYPES section in definitions.php
$remote_refs mixed array Related activity ID or array of IDs

Return

void

Location

include/message_functions.php lines 381 to 391

Definition

 
function message_remove_related($remote_activity=0,$remote_refs=array())
    {
    if(
$remote_activity==|| $remote_refs==|| (is_array($remote_refs) && count($remote_refs)==0) ){return false;}
    if(!
is_array($remote_refs)){$remote_refs=array($remote_refs);}
    
$relatedmessages sql_array("select ref value from message where related_activity='$remote_activity' and related_ref in (" implode(',',$remote_refs) . ");","");
    if(
count($relatedmessages)>0)
        {            
        
sql_query("DELETE FROM message WHERE ref in (" implode(',',$relatedmessages) . ");");
        
sql_query("DELETE FROM user_message WHERE message in (" implode(',',$relatedmessages) . ");");
        }
    }

This article was last updated 3rd December 2020 13:05 Europe/London time based on the source file dated 4th August 2020 08:55 Europe/London time.