Petitions using SPIP

A how-to guide for setting up an on-line petition, possibly multilingual, using a SPIP template and its special criteria, and monitoring the collection of signatures thanks to SPIP’s RSS feed, its search engine applied to signatures, its statistics in various formats which can also be used for navigation etc.

Being able to associate a petition with an article is a possibility that SPIP has offered since its very earliest versions. SPIP 2.0 improves enormously on this functionality which practically hasn’t changed at all since it was first introduced, despite the overall impact of the new compiler in SPIP 1.8, 1.8.1 which had considerably reduced the time for opening up the signatures page.

Petitions as seen from the private zone

To activate a petition, you first need to write an article that introduces the text of the petition. Using the internal page for that article, there is a forum and petition panel available in the left-hand column which allows you to activate the petition and confirm your decision, and then to finally publish your new article. On the public site, the article will appear as per normal, but followed by a signature form and another form for navigating through the list of signatures.

That little panel also makes it possible to enter a short supplementary text which is not actually a part of the petition itself (it could perhaps be an invitation to sign). It likewise makes it possible to specify if you want to use the options for a single signature per email address or a single signature per Web site, with one or the other of these being recommended as a standard practice. It also allows us to require a reference to the Web site, and to offer the signing visitor the chance to writing a supportive message.

When the signatures start to arrive, this panel will indicate how many there are, and will supply a link to the administration page for the petition, which lists all of the signatures in blocks of 15 at a time. That administration page is also available by clicking on the word petition that appears beside the title of the article in the panel that lists the articles published in a section, in the panel that lists articles for a given author, etc. Finally, an overall administration page for all of the petitions is available to site administrators by moving the mouse cursor over the Forum button in the main header of the private zone. All of these petition administration pages have an RSS feed that enable you to be notified when new signatures arrive, either for all of the petitions or just a single one as you choose. In the scenario of a single one, there is also a link made available to the statistics page for that article.

The statistics page for the article associated with a petition contains two additional graphic images, providing the number of signatures per day and per month, making it easy to monitor the petitions success curve. This page also supplies a button used to generate a CSV-format file containing the list of signatures sorted alphabetically that you can easily use in a spreadsheet programme. This list is generated by the dist/prive/transmettre/signatures_article.html template file, which can be used as inspiration for coding the list in another manner (e.g. in chronological order). And lastly, clicking on a column in one of these graphs will link to the administration page for that petition, but position you exactly in the 15-entry block range for the date that you selected when you clicked.

In order to avoid identity "theft", the signer of a petition receives an email requesting the confirmation of that signature by using a specific URL on the site. It is only upon accessing that specific URL that the signature is validated for the petition.

Because of this differentiation, there are two tabs on the administration page for a petition, one for confirmed signatures and a second page for those that have not been confirmed. In this second tag, each signature is accompanied by a reminder button: if that signature had been originally made some time ago, then it is likely that the confirmation email has been either lost or misunderstood by the signing visitor, and this button allows you to resend that confirmation request email message.

On both tabs, each signature has a button for deleting the signature, in the event that a signature is considered as unacceptable (a manifestly false identity, for example).

Petitions as seen from the public zone

The #FORMULAIRE_SIGNATURE tag is used to insert into a template file a signature form for the petition associated with the article specified by the tag’s current context. That form is itself generated by the formulaire/signature.html template, which can be easily replaced, with the tag having control over data entry independently of how the form is presented.

The #PETITION tag supplies the catch phrase text which was the question posed at the start of that article.

SPIP allows the selection of articles having a petition catch phrase with certain characteristics by using the petition criterion. In particular, the {petition==".*"} criterion for an ARTICLES loop will list all of the articles that have a petition, even if their catch phrase is empty. Obviously you can use an SQL RegExp here to be more selective if you so wish. As is normally the case, the syntax {petition} indicates that we are comparing values with the argument of the same name supplied by the context, specifically including the URL parameter: petition.

To list the signatures, you can use The SIGNATURES loop.

The template supplied as standard lists the signatures in groups of 15, the default pagination value that you are at liberty to specify in the URL. These groups of 15 are presented inside a table that also shows the date and visitor’s name. Clicking on the first line of one of these two columns allows you to re-display the signatures in the order of the column that you clicked on. Clicking on the entry in the last displayed line does the same, but in the inverse order. This template also offers a signature search form within the petition in question, which works quite independently from the normal general search which may also be visible on that page.

Author Mark Published : Updated : 26/10/12

Translations : català, English, français, Nederlands