joncampbell
Forum Replies Created
-
@dericleeyy
I installed Twenty Twenty-Five and Health Check and did the troubleshooting.
I then went to the Students area of the admin and Reset Progress on a user and it causes a fatal error still:
[15-Jan-2025 20:03:18 UTC] PHP Fatal error: Uncaught ValueError: array_rand(): Argument #1 ($array) cannot be empty in /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-lesson.php:3832
Stack trace: 0 /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-lesson.php(3832): array_rand(Array, 0) 1 /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-utils.php(733): Sensei_Lesson->lesson_quiz_questions(‘10055172’) 2 /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-utils.php(811): Sensei_Utils::sensei_get_quiz_questions(10055172) 3 /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-utils.php(660): Sensei_Utils::sensei_delete_quiz_answers(10055172, 3405) 4 /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-utils.php(706): Sensei_Utils::sensei_remove_user_from_lesson(10055171, 3405, true) 5 /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-utils.php(2818): Sensei_Utils::sensei_remove_user_from_course(85579, 3405) 6 /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/rest-api/class-sensei-rest-api-course-progress-controller.php(81): Sensei_Utils::reset_course_for_user(85579, 3405) 7 /wp-includes/rest-api/class-wp-rest-server.php(1292): Sensei_REST_API_Course_Progress_Controller->batch_delete_items(Object(WP_REST_Request)) 8 /wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request(Object(WP_REST_Request), ‘/sensei-interna…’, Array, NULL) 9 /wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request)) 10 /wp-includes/rest-api.php(449): WP_REST_Server->serve_request(‘/sensei-interna…’) 11 /wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP)) 12 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array) 13 /wp-includes/plugin.php(565): WP_Hook->do_action(Array) 14 /wp-includes/class-wp.php(418): do_action_ref_array(‘parse_request’, Array) 15 /wp-includes/class-wp.php(813): WP->parse_request(”) 16 /wp-includes/functions.php(1336): WP->main(”) 17 /wp-blog-header.php(16): wp() 18 /index.php(17): require(‘/Users/jon…..’) 19 {main}thrown in /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-lesson.php on line 3832
- This reply was modified 1 year, 3 months ago by joncampbell.
On our site when we remove a user from a course, here is the relevant stack trace:
class-sensei-lesson.php(3832): array_rand(Array, 0)
class-sensei-utils.php(733): Sensei_Lesson->lesson_quiz_questions(‘10055172’)
class-sensei-utils.php(811): Sensei_Utils::sensei_get_quiz_questions(10055172)
class-sensei-utils.php(660): Sensei_Utils::sensei_delete_quiz_answers(10055172, 3405)
class-sensei-utils.php(706): Sensei_Utils::sensei_remove_user_from_lesson(10055171, 3405, true)
class-sensei-utils.php(2818): Sensei_Utils::sensei_remove_user_from_course(85579, 3405)
Seems like to remove the user from the course it wants to delete their quiz answers but to do that it gets the lesson_quiz_questions but in our case the $questions_array used in this code is empty:$selected_questions = array_rand(
$questions_array,
$show_questions > $questions_count ? $questions_count : $show_questions
);
And it errors out because it can’t randomize an empty array.Forum: Plugins
In reply to: [Custom Product Tabs for WooCommerce] Automatic jumping to first tab@trose1189,
no, we have just stuck to the older version of Woo for now.Forum: Plugins
In reply to: [Custom Product Tabs for WooCommerce] Automatic jumping to first tabTo add some more context, in WooCommerce 8.2.2 this was not a problem, it is only since WooCommerce 8.3.x.
A few years ago they changed the plugin so that the VALUE of select fields is set to the LABEL of the select fields. This will break the role field that is outputted by teams because the plugin filters those fields.
This change doesn’t just affect custom fields created by their plugin, but it breaks other fields created by WooCommerce itself or other plugins. It’s terrible. You may have to manually fix the file and use your own fork of the plugin if you want to have the two work nicely together.
Where they made the change:
https://plugins.trac.wordpress.org/changeset/2276797/woocommerce-checkout-manager/trunk/includes/view/frontend/class-wooccm-fields-filters.phpA few related threads:
https://wordpress.org/support/topic/error-in-class-wooccm-fields-filters-php/
https://wordpress.org/support/topic/incompatibility-with-other-plugins-8/Hey @wppunk
They broke this a year and a half ago by changing the value of <option> elements to be the text label instead of the value:They don’t seem to care to fix it, even though it breaks <select> fields that are outside of Checkout Manager.
I gave up on trying to get them to fix it and changed my local copy of the plugin to work properly and then increased the version number so it doesn’t get updated to a broken version again.
The plugin has been updated multiple times but this very, very, clear error is still not fixed.
- This reply was modified 5 years, 10 months ago by joncampbell.
Likely related to this thread as well: https://wordpress.org/support/topic/error-in-class-wooccm-fields-filters-php/
Agreed, and for the sake of stability, maybe this plugin should not be messing with default WooCommerce field handling and only should apply to fields it generates.
Forum: Plugins
In reply to: [WP Search with Algolia] Dealing with HTML Entities@richaber It looks like the post titles is something we can fix in our content.
But the categories it seems like WordPress saves those to the database with the full html entity, instead of just the ampersand.Maybe that is something that could be fixed in the plugin for everyone.
Forum: Plugins
In reply to: [WP Search with Algolia] Dealing with HTML EntitiesCool cool cool.
My titles and terms have the html entities stored in the WordPress database.
I’ll just go have a good cry and then ask my client why we are doing that.Forum: Plugins
In reply to: [WP Search with Algolia] Dealing with HTML EntitiesEven using the default instantsearch.php template it does it.
So post_title looks like this:
{{{ data._highlightResult.post_title.value }}}
and {{ data.post_title }} where it is used.Forum: Plugins
In reply to: [Send Emails with Mandrill] Plugin causing 404 errors@cornel,
Any chance you can send me the fixed files?Forum: Plugins
In reply to: [Order Export for WooCommerce] Plugin doesn’t work anymore with Enfold themeI think it’s related to lines 9-11 in /order-export-and-more-for-woocommerce/js/main.js
Jquery is bugging out in the admin because of that event handler for clicks on .asd
Forum: Plugins
In reply to: [Autoptimize] Can’t exclude css fileI think I know what the problem is. The css is imported into style.css
Style.css in the theme actually imports 7 other css files.