Browse: Home / Classes / WpProQuiz_Helper_QuestionOrder /

WpProQuiz_Helper_QuestionOrder::order_by_saved_pro_ids

WpProQuiz_Helper_QuestionOrder::order_by_saved_pro_ids( WpProQuiz_Model_Question[] $questions,  int[] $saved_pro_ids )

Reorders a set of questions to match a saved list of question pro IDs (the resume “randomOrder”), skipping any saved ID that no longer resolves to a question in the set.


Description #

Used when resuming a quiz that has random questions and/or a question subset enabled: the saved order can reference a question that has since been deleted, updated (new pro ID), or dropped from the rendered subset. Those are skipped so the resumed attempt keeps its valid progress instead of dereferencing a missing question.


Parameters #

$questions

(WpProQuiz_Model_Question[]) (Required) Questions to reorder. May be keyed by question post ID or numerically indexed.

$saved_pro_ids

(int[]) (Required) Saved order of question pro IDs (resume "randomOrder").


Return #

(WpProQuiz_Model_Question[]) Questions in saved order, with unresolvable saved IDs skipped, as a sequential list.


Source #

File: includes/lib/wp-pro-quiz/lib/helper/WpProQuiz_Helper_QuestionOrder.php


Changelog #

Changelog
Version Description
5.1.6 Introduced.