Coding with SPIP 3.0
SPIP3.0 Technical Documentation

> > > > trig_supprimer_objets_lies

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).

  1. pipeline('trig_supprimer_objets_lies', array(
  2. array('type'=>'mot', 'id'=>$id_mot)
  3. ));

Download

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):

  1. function forum_trig_supprimer_objets_lies($objets){
  2. foreach($objets as $objet){
  3. if ($objet['type']=='message')
  4. sql_delete("spip_forum", "id_message=" . sql_quote($objet['id']));
  5. if ($objet['type']=='mot')
  6. sql_delete("spip_mots_forum", "id_mot=" . intval($objet['id']));
  7. }
  8. return $objets;
  9. }

Download

  • Author :
  • Published :
  • Updated : 29/05/10
  • Translations : English, français