Skip to content
Luke C Hartman edited this page Oct 18, 2023 · 7 revisions

Welcome to the engaging-quiz wiki!

Troubleshooting

Embed quizes are showing 404 (or other) errors

Reason:

  • Multiple versions of the plugin are installed (ex. /plugins/enp-quiz/ and /plugins/engaging-quiz/)
    • Solution 01:
      • Delete the /plugins/engaging-quiz/ plugin.

    • Solution 02:
      • Check the quiz related files that get created in the directory root (public/enp-quiz-database-config.php) and wp-content folder (wp-content/enp-quiz-config.php). There may be duplicates or incorrect paths. Compare with your file structure to make sure the paths are correct.

      • If they’re messed up, use one of the staging or dev sites as an example for the file paths that need updating. The .htaccess file can sometimes be an issue there as well.

WP Engine .htaccess depreciation

In WP Engine dashboard:

Redirect rules:

quiz-embed:

Redirect name: quiz-embed Domain: mediaengagement.org Source: ^/quiz-embed/([0-9]+)?$ Destination: /wp-content/plugins/enp-quiz/public/quiz-take/templates/quiz.php?quiz_id=$1 Advanced settings/Rewrite type: break

ab-embed:

Redirect name: ab-embed Domain: mediaengagement.org Source: ^/ab-embed/([0-9]+)?$ Destination: /wp-content/plugins/enp-quiz/public/quiz-take/templates/ab-test.php?ab_test_id=$1 Advanced settings/Rewrite type: break

Web Rules/Rewrite rules:

quiz-embed:

  • Add rule
  • Action: Permanent redirect
  • Source: ^quiz-embed/([0-9]+)?$
  • Destination: /wp-content/plugins/enp-quiz/public/quiz-take/templates/quiz.php?quiz_id=$1
  • Keep or discard original query string: Discard

ab-embed:

  • Add rule
  • Action: Permanent redirect
  • Source: ^ab-embed/([0-9]+)?$
  • Destination: /wp-content/plugins/enp-quiz/public/quiz-take/templates/ab-test.php?ab_test_id=$1
  • Keep or discard original query string: Discard

Look at the data:

http://data.mediaengagement.org/quiz-creator/#/sites

Local Working Env Details

These are the details for a working version. In case you local env wont work in general or if the quiz embed pages are returning a 404:

  • Web server: Apache
  • PHP Version: ^8.0.0
  • MySQL 8.0.16
  • WordPress v6.3.2
  • Theme: should work on any theme, but the working version was on GeneratePress Version: 3.3.1

JSON

This class defines all code for processing and saving quizzes:

database/class-enp_quiz_save_quiz.php function sanitize_array sanitizes all keys and values of the quiz array.

  • Validate the json returned:

Trigger the action that makes the AJAX request, and you'll see the request and response details. Look for the response content in the "Response" tab, and it should indicate whether the response is valid JSON or not.