Skip to content
Luke C Hartman edited this page Mar 2, 2022 · 13 revisions

Create a new site in the Local app with these settings:

Web server: Apache
PHP version: 7.3.5
Database: MySQL 8.0.16
WordPress Version: 5.8.0 (or above)

Start the site.

In terminal cd into your new site's plugins repo (wp-content/plugins/), clone the repo and enter the plugin's folder:

git clone https://github.com/engagingnewsproject/engaging-quiz.git

cd engaging-quiz

Check node version:

node --version

Should be: v8.11.1

If not v8.11.1 use nvm(Volta for windows) to check which versions you have available:

nvm list

Output example:

v6.12.0
v6.14.4
v8.7.0
v8.11.1
v11.6.0
v13.0.0
v13.0.1
v14.0.0
v14.10.1
v14.11.0
v15.0.0-rc.4
->      v15.3.0
system
default -> node (-> v15.3.0)

Have nvm use the correct version:

nvm use 8.11.1

Recheck node version:

node --version

Should be: v8.11.1

Check npm version:

npm --version

Should be: 5.6.0

Check npx version:

npx --version

Should be: 9.7.1

If versions not installed correctly check here.

Install the gulp command line utility:

npm install --global gulp-cli

In the plugin root directory /plugins/engaging-quiz-master/ create a package.json file:

npm init

Press enter to use default npm setup & type yes at the end.

Next, you will need gulp local version @3.9.1:

npm install --save-dev [email protected]

Run gulp --version to check. Should be:

CLI version: 2.3.0
Local version: 3.9.1

Start your dev site:

gulp

Pretty much the same as Gulp's quick setup instructions. But Gulp v3.9.1 is needed.

If you get “cannot find module gulp-sass” on running gulp run npm install gulp-sass --save-dev. This installs and saves gulp-sass in package.json file for future use.

Bug Fix for Quiz Tool Preview

** make sure you are using the Apache server in the Local App.

Open the local folder you created, navigate to the file enp-quiz-config.php, and make the following changes:

Replace all instances of the words engaging-quiz-master with enp-quiz

Troubleshooting

  1. local URL might be incorrect in (.htaccess or enp-quiz-config.php)

  2. local app might be configured incorrectly

  3. .htaccess file misconfiguration

    • ex incorrect .htaccess file:
Redirect 301 /create-a-quiz/ localhost:10024/quiz-creator/


# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^quiz-embed/([0-9]+)?$ //Users/lukecarlhartman/Local Sites/cme-quiz/app/public/wp-content/plugins/enp-quiz/public/quiz-take/templates/quiz.php?quiz_id=$1 [QSA,L]
RewriteRule ^ab-embed/([0-9]+)?$ //Users/lukecarlhartman/Local Sites/cme-quiz/app/public/wp-content/plugins/enp-quiz/public/quiz-take/templates/ab-test.php?ab_test_id=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
  • correct .htaccess file (on a working local site)
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^quiz-embed/([0-9]+)?$ /wp-content/plugins/engaging-quiz/public/quiz-take/templates/quiz.php?quiz_id=$1 [QSA,L]
RewriteRule ^ab-embed/([0-9]+)?$ /wp-content/plugins/engaging-quiz/public/quiz-take/templates/ab-test.php?ab_test_id=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

A FIX?

  • rename your .htaccess file to something like .htaccess-1 or something, reopen WP Admin from the Local App. Your .htaccess file will be recreated & the site should work.

  • when activating the plugin your site's .htaccess file is altered by the quiz plugin. Compare the file paths in the .htaccess file with your website's file directory & make sure the directory paths are correct. Otherwise you will get a white screen when clicking the Quiz Creator menu item from WP Admin.