New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use updated lesson data when updating quiz #2336

Merged
merged 2 commits into from Nov 22, 2018

Conversation

Projects
None yet
2 participants
@jom
Member

jom commented Nov 21, 2018

Using the $_POST data led to inconsistent results after updating to 5.0. This method is tied to save_post so the lesson data will be updated by the time it fires.

Testing

  1. Enable WP_DEBUG and error logging.
  2. Using WordPress 5.0 or the Gutenberg plugin, edit a lesson with a quiz.
  3. Give the lesson a new title.
  4. Verify the quiz post_title was updated on the quiz and no PHP errors are output or shown in log.

Before, this error would be given:

[21-Nov-2018 16:24:26 UTC] PHP Notice:  Undefined index: post_title in /var/www/html/wp-content/plugins/woothemes-sensei/includes/class-sensei-lesson.php on line 461
[21-Nov-2018 16:24:26 UTC] PHP Stack trace:
[21-Nov-2018 16:24:26 UTC] PHP   1. {main}() /var/www/html/wp-admin/post.php:0
[21-Nov-2018 16:24:26 UTC] PHP   2. edit_post() /var/www/html/wp-admin/post.php:199
[21-Nov-2018 16:24:26 UTC] PHP   3. wp_update_post() /var/www/html/wp-admin/includes/post.php:377
[21-Nov-2018 16:24:26 UTC] PHP   4. wp_insert_post() /var/www/html/wp-includes/post.php:3820
[21-Nov-2018 16:24:26 UTC] PHP   5. do_action() /var/www/html/wp-includes/post.php:3747
[21-Nov-2018 16:24:26 UTC] PHP   6. WP_Hook->do_action() /var/www/html/wp-includes/plugin.php:453
[21-Nov-2018 16:24:26 UTC] PHP   7. WP_Hook->apply_filters() /var/www/html/wp-includes/class-wp-hook.php:310
[21-Nov-2018 16:24:26 UTC] PHP   8. WooThemes_Sensei_Lesson->quiz_update() /var/www/html/wp-includes/class-wp-hook.php:288
Use live lesson data when updating quiz
Using the `$_POST` data led to inconsistent results after updating to 5.0. This method is tied to `save_post` so the lesson data will be updated by the time it fires.

@jom jom added this to the 1.12.2 milestone Nov 21, 2018

@jom jom requested review from alexsanford and donnapep Nov 21, 2018

@donnapep

Looks good. 👍
Confirmed the quiz gets a title and that I no longer see the error about post_author when adding a new question, but that the question does indeed have the author ID saved.

@donnapep donnapep merged commit 643e949 into master Nov 22, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@donnapep donnapep deleted the fix/lesson-fields-in-wp5 branch Nov 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment