CE Module

HOW IT WORKS:

Creating a CE Quiz

1. WP Administrator creates a quiz using Gravity Forms

2. Set up quiz question fields and any additional data fields to collect.
– Quiz content can either be embedded in an HTML field in the form or reside separately on regular page.
– Be certain to include the following **hidden** fields and set default data as they are necessary to pass data to the certificate generator.

Field NameDefault ValuePopulate Dynamically Parameter
Member First Namemember_firstname
Member Last Namemember_lastname
ADA #member_ada_number
Member Email Addressmember_email
Formatset unique value per form
Subjectset unique value per form
Titleset unique value per form
Creditsset unique value per form
Instructorset unique value per form
Certificate Titleset unique value per form

 

3. Add [oda_quiz_results] shortcode to BOTH quiz confirmation fields; Map fields created in previous step appropriately using provided GF merge tags. Note: All these fields are required except for ‘certificate_filename’ which is not necessary for the failed quiz confirmation but does not matter if it is included. Field IDs may change per form so be certain merge tags are correctly mapped. Example shortcode:


[oda_quiz_results
quiz_id="{form_id}"
quiz_date="{date_mdy}"
entry_id="{entry_id}"
member_first_name="{Member First Name:4}"
member_last_name="{Member Last Name:5}"
member_ada_number="{ADA #:6}"
member_email_address="{Member Email Address:7}"
quiz_percent="{quiz_percent}"
quiz_passfail="{quiz_passfail}"
quiz_score="{quiz_score}"
user_ip="{ip}"
format="{Format:8}"
subject="{Subject:9}"
title="{Title:10}"
instructor="{Instructor:11}"
credits="{Credits:12}"
certificate_title="{Certificate Title:14}"]

4. Embed Quiz form into page content using the `[oda_ce_quiz]` shortcode. Be certain to include the id parameter.

[oda_ce_quiz id="24"]

Note: You must use this shortcode instead of the standard Gravity Forms shortcode. Only the `[oda_ce_quiz]` shortcode will check if the user has previously passed the quiz.

Taking a CE Quiz

  1. User navigates to URL with embedded form. Reviews course material. Takes and submits quiz.
  2. `gform_after_submission` hook captures quiz data and stores in separate table `oda_ce_gf` for easier retrieval later.
  3. The confirmation message runs the `[oda_quiz_results]` shortcode which determines whether to show ‘Pass’ or ‘Fail’ message. The ‘Pass’ status content includes a button to generate a CE certificate on demand. The button is actually just a submit button in a form of hidden fields which will pass $_POST data to the certificate generator.
  4. The certificate generator checks to make sure the user is logged and post data is set, or deauthorizes the script.
  5. Authorized user can download certificate as PDF or print via system/browser dialog.

Developer Information

FILES USED:

  • wp-content\themes\oda\inc\gravity_forms_quiz.php
  • wp-content\themes\oda\inc\gravity_forms_certificate.php
  • wp-content\themes\oda\inc\gravity_forms.php
  • wp-content\themes\oda\functions.php
  • wp-content\themes\oda\assets\scss\theme\_forms.scss
  • wp-content\themes\oda\assets\scss\theme\_gf_ce.scss
  • wp-content\themes\oda\assets\img\ADA-CERP-logo-color.png

oda_ce_gf SQL TABLE:

Form submissions are stored in the oda_ce_gf table. It contains all test results and everything needed to generate a certificate. Some test details like format, subject, etc. are stored to record them as they were at the time of the test. Other details for the certificate, such as address and name, can be pulled dynaically at runtime using either ADA# or email address as the user identifier.

GENERATE CERTIFICATE FUNCTIONALITY

Pass following fields via $POST method to ‘wp-content\themes\oda\inc\gravity_forms_certificate.php’:

  • quiz_date
  • member_first_name
  • member_last_name
  • member_address_1
  • member_address_2
  • member_address_city
  • member_address_state
  • member_address_zip
  • format
  • subject
  • title
  • instructor
  • credits
  • certificate_filename