JustGiving API for Webforms

Component ID

2202035

Component name

JustGiving API for Webforms

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

This module utilises the JustGiving API with Webforms and Webform Validation, allowing creation of JustGiving pages and, if needed, JustGiving account.

The module ties to a form where users fill out their personal details. After validation has passed, it checks to see if a user has a JustGiving account using the API, setting a flag in the session which can be used for custom templating of the the thank you page for that form. The module also ties to another webform that is used to create a JustGiving page. This will validate the users URL against the JustGiving database and return an appropriate error if the URL has already been taken. Depending on the flag set by the previous form (whether the user has a JG account or not) the user will be prompted to enter their username and password, or create an account by inputting their email and password.

All settings and submission data linked to this module will be available through the global variable $_justgiving_helper.

  global $_justgiving_helper;

  //Access the settings for the JG module
  $_justgiving_helper->settings;

  //Access the session data for the module
  $_justgiving_helper->session;
  // The account create flag
  $_justgiving_helper->session['create_account'];
  // The submitted data from forms
  $_justgiving_helper->session['submitted'];

Hardcoded Limitations
On the JG page creation form, there must be a fieldset with the field key "jg_login" and 2 fields inside that fields set, one for the username with the field key "justgiving_username" and a password field "justgiving_password".

Because webforms doesn't support password fields, the password field in the jg_login fieldset will be switched out for an actual password field.

JustGiving PHP SDK

In order to use the JustGiving for Webforms module, you will need to acquire the JustGiving PHP SDK from https://github.com/JustGiving/JustGiving.Api.Sdk (pull the contents of the PHP folder and place in sites/all/libraries/justgiving). This is required for the module to work.