Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > alertes_auteur

alertes_auteur

SPIP can send warning messages for various events that may be more or less considered as being urgent:

  • A database crash
  • A plugin crash
  • A plugin activation error
  • A notification that there is a message in the mailbox

This pipeline, called in ecrire/inc/commencer_page.php by the alertes_auteur() function, is used to populate the table containing such warnings.

  1. $alertes = pipeline('alertes_auteur', array(
  2. 'args' => array(
  3. 'id_auteur' => $id_auteur,
  4. 'exec' => _request('exec'),
  5. ),
  6. 'data' => $alertes
  7. )
  8. );

Download

It receives an array as a parameter.

  • data: contains an array of the various warnings,
  • args contains an array with:
    • id_auteur being the currently logged-in author,
    • exec is the name of the displayed page.

Example

Suppose that there is a plugin called "Watch out for llamas", which tells people that they are at risk of encountering a fearsome llama, then we could provide this as follows:

  1. function llamas_alertes_auteur($flux){
  2. $alertes = $flux['data'];
  3.  
  4. // If there is a llama in front of this author
  5. if (tester_llama($flux['args']['id_auteur'])) {
  6. // We add a warning
  7. $alertes[] = "<strong>Watch out! There's a llama!</strong>";
  8. }
  9.  
  10. // We return the table of warnings
  11. return $alertes;
  12. }

Download

A most fortuitous and beneficent plugin indeed!

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