Collections functions
General functions
Render functions
Theme permission 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 478 to 492

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);}
    
$parameters = array("i"$remote_activity);
    
$parameters array_merge($parametersps_param_fill($remote_refs,"i"));

    
$relatedmessages ps_array("select ref value from message where related_activity = ? and related_ref in (" ps_param_insert(count($remote_refs)) . ");"$parameters"");
    if(
count($relatedmessages)>0)
        {
        
$parameters ps_param_fill($relatedmessages,"i");
        
ps_query("DELETE FROM message WHERE ref in (" ps_param_insert(count($relatedmessages)) . ");"$parameters);
        
ps_query("DELETE FROM user_message WHERE message in (" ps_param_insert(count($relatedmessages)) . ");"$parameters);
        }
    }

This article was last updated 24th May 2022 19:35 Europe/London time based on the source file dated 26th January 2022 11:10 Europe/London time.