Executing the processes

Whenever the verification function doesn’t return an error, the form then moves on to the traiter() (processing) function. It is in this function that the desired operations should be performed with the data from the form (send an email, update the database, etc.).

The function must return an associative table:

function formulaires_nom_traiter(){
	// Execute the processes
	// Return values
	return array(
		'message_ok' => 'Excellent !', // or perhaps
		'message_erreur' => 'Sorry, an error has occurred.'

Important values

Here are some of the values frequently returned:

  • message_ok is used to return a pleasant message to the user indicating that everything processed normally.
  • message_erreur, on the other hand, is used to return an error message when the processing didn’t work correctly.
  • editable, as for loading, this is used to display or hide the editable portion of the form. By default it is set to false, but you may assign it a value of true if your form can be used several times in a row.
  • redirect is a URL which is used to tell SPIP which page it should redirect to after processing the form. By default, the page will loop back to itself.

The formulaire_traiter (form_process) pipeline

Once the formulaires_nom_traiter function has completed, the formulaire_traiter pipeline is executed, thereby enabling other plugins to complete the processes for this form.

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

Translations : English, français