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.

$alertes = pipeline('alertes_auteur', array(
		 'args' => array(
			 'id_auteur' => $id_auteur,
			'exec' => _request('exec'),
		),
		 'data' => $alertes
	)
);

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:

function llamas_alertes_auteur($flux){
	$alertes = $flux['data'];
	
	// If there is a llama in front of this author
	if (tester_llama($flux['args']['id_auteur'])) {
		// We add a warning
		$alertes[] = "<strong>Watch out! There's a llama!</strong>";
	}
	
	// We return the table of warnings
	return $alertes;
}

A most fortuitous and beneficent plugin indeed!

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

Translations : English, français