trig_supprimer_objets_lies

This pipeline is a trigger (returns no output) which is called when certain objects are deleted. It makes it possible to delete data stored in linkage tables at the same time as an object is deleted. It is passed an array of the various deletions to be made (containing the deleted object type and identifier).

pipeline('trig_supprimer_objets_lies', array(
		array('type'=>'mot', 'id'=>$id_mot)
));

This pipeline is called for deletion of a keyword and for a message.

Example

The "Forum" plugin uses this pipeline to delete links with forum messages that are associated with a deleted keyword or message (from the mailbox):

function forum_trig_supprimer_objets_lies($objets){
	foreach($objets as $objet){
		if ($objet['type']=='message')
			sql_delete("spip_forum", "id_message=" . sql_quote($objet['id']));
		if ($objet['type']=='mot')
			sql_delete("spip_mots_forum", "id_mot=" . intval($objet['id']));
	}
	return $objets;
}

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français