Contents
On this page

Hooks reference - Plugixa Exam

Around 60 filters and 25 actions, all prefixed plugixa_exam_. This page groups them by what you would be trying to do.

The five you are most likely to want

Hook Type What it changes
plugixa_exam_url_base filter The front-end base segment. Return assessments to serve /assessments/ instead of /exams/
plugixa_exam_question_types filter The type registry. This is how every type, free and premium, is contributed
plugixa_exam_user_can filter The permission answer, for wiring the plugin into an external authority
plugixa_exam_needs_frontend_assets filter Whether a page loads the front-end bundle. Needed for page builders that store shortcodes outside post content
plugixa_exam_attempt_submitted action Fires when a paper is handed in. The usual integration point

Attempt lifecycle

plugixa_exam_attempt_started      an attempt begins, paper already frozen
plugixa_exam_attempt_autosaved    answers saved as the candidate works
plugixa_exam_attempt_submitted    handed in
plugixa_exam_attempt_graded       marking finished (once per attempt)
plugixa_exam_attempt_regraded     a marker changed a finished result:
                                  ($attempt_id, $exam, $was_passed, $previous)
plugixa_exam_certificate_issued   a certificate was awarded

plugixa_exam_attempt_graded fires once, on the transition, so the examinee is not told twice. Anything that acts on the result - a course completion, a certificate, a gradebook, a webhook - also listens to plugixa_exam_attempt_regraded, whose $previous holds score, max_score, percent and passed from before the re-mark.

plugixa_exam_attempt_autosaved fires on the submit as well as on each autosave. The gap between the final autosave and the Submit button would otherwise be the one stretch of answers an integration never saw.

Grading and answers

Hook Use
plugixa_exam_grade_response Score one response yourself
plugixa_exam_answer_key Adjust an answer key before it is used
plugixa_exam_normalize_answer_key Normalise a key on save
plugixa_exam_sanitize_response Sanitise what a candidate submitted
plugixa_exam_validate_question Add your own validation rules
plugixa_exam_result_grade Change the grade band on a result
plugixa_exam_result_certificate Decide whether a result earns a certificate

Access and permissions

plugixa_exam_user_can              the permission answer
plugixa_exam_can_configure         who may reach configuration
plugixa_exam_access_override       settle identity: a refusal ends the gate; an
                                   admission skips the identity checks only, so
                                   resume, requirements and the attempt cap still
                                   apply (the LTI launch answers it)
plugixa_exam_access_requirements   what an exam requires to start
plugixa_exam_user_in_exam_access   cohort membership; this is the filter the
                                   Cohorts module answers
plugixa_exam_monitor_may           who may take a monitoring action
plugixa_exam_enrolment_status_changed  paid access started, stopped or moved
                                   ( $id, $from, $to, $row ), once per real change
plugixa_exam_enrolment_source_link where an enrolment came from, as a link

plugixa_exam_user_in_exam_access defaults to administrators only. An exam set to Restricted on a site with no module answering this filter denies everybody else, which is the safe direction.

Front end and routing

plugixa_exam_url_base              the base segment
plugixa_exam_url_languages         language prefixes
plugixa_exam_page_id               which page backs a route
plugixa_exam_frontend_url          a generated URL
plugixa_exam_needs_frontend_assets whether to load the bundle
plugixa_exam_frontend_entry        which bundle to load
plugixa_exam_document_title        the page title
plugixa_exam_landing_gate          after the exam page's Start area, with the verdict
plugixa_exam_card_facts            extra facts on a catalogue card

plugixa_exam_landing_gate and plugixa_exam_card_facts print into pages a cache may keep: what a listener prints for a signed-out visitor must be the same for every signed-out visitor. A theme that overrides parts/exam-body.php or parts/exam-card.php needs the do_action() line added to its copy.

Also plugixa_exam_frontend_catalogue, _exam, _start, _save, _answers, _attempt, _result, _gate for the payloads behind each front-end view, and plugixa_exam_exam_output, _question_output, _question_list_output, _filter_output for what the REST layer returns.

Content and rendering

plugixa_exam_allowed_html          what HTML survives sanitising
plugixa_exam_runner_question       a question as the runner renders it
plugixa_exam_question_options      the options on a question
plugixa_exam_paper_locale          the language a paper is presented in
plugixa_exam_certificate_values    the fields merged into a certificate
plugixa_exam_certificate_mpdf_config  the PDF engine's configuration

The paper and the runner

Hook Type What it is for
plugixa_exam_paper_questions filter The paper’s entries just before they are frozen, after any shuffle. An entry may gain keys, which are frozen with it. id, type, section_id and points must survive.
plugixa_exam_runner_paper filter What the runner is told about the paper as a whole. It reaches the page source of a live exam, so never add an answer or a private path.
plugixa_exam_runner_site_chrome filter Whether the runner shows the site’s header and footer, for one exam. True by default.
plugixa_exam_no_js_before_question action Print material above a question on the no-JavaScript paper.

plugixa_exam_review_item may also set a context_html key, shown above the question on the review page.

Notifications

plugixa_exam_email_templates          add or change templates
plugixa_exam_seeded_template_labels   rename the seeded ones
plugixa_exam_alert                    raise an in-app alert
plugixa_exam_alert_markers            the markers on the alerts feed

The Analytics module uses plugixa_exam_email_templates to add the scheduled report template, which is the pattern to copy for your own.

Data and lifecycle

plugixa_exam_before_insert / _before_update      every entity write
plugixa_exam_entity_created / _updated / _deleted / _restored / _purged
plugixa_exam_activated / _deactivated / _migrated / _uninstall
plugixa_exam_modules                             the module registry
plugixa_exam_import_parsers                      add an import format
plugixa_exam_settings_defaults / _sanitize_settings / _public_settings

Privacy

plugixa_exam_personal_data_providers   add an exporter or eraser
plugixa_exam_export_attempt_fields     add lines to one attempt's export
plugixa_exam_attempt_anonymised        an attempt was anonymised (id, email, reason)
plugixa_exam_erase_attempt_columns     which columns an erasure clears
plugixa_exam_erase_attempt_delete      whether an attempt is deleted outright
plugixa_exam_privacy_retention         the daily retention sweep (only while a period is set)
plugixa_exam_privacy_policy_paragraphs your paragraph in the suggested privacy policy
plugixa_exam_certificate_remark_may_reinstate  whether a re-mark may lift a withdrawal
plugixa_exam_uninstall_capabilities    what uninstall removes

plugixa_exam_attempt_anonymised passes a reason: request when the person asked to be erased, retention when the site’s retention period ran out. Data with a purpose of its own, like a certificate the holder relies on, should act on the first and survive the second.

Examples

Serve the front end under a different base:

add_filter( 'plugixa_exam_url_base', fn() => 'assessments' );

Load the front-end bundle on a page whose shortcode lives in a builder’s own storage:

add_filter( 'plugixa_exam_needs_frontend_assets', function ( $needed ) {
    return $needed || is_page( 'my-builder-page' );
} );

React to a submitted paper:

add_action( 'plugixa_exam_attempt_submitted', function ( $attempt_id, $exam, $reason ) {
    // $reason is why the paper closed: submitted, time_limit, idle or invigilator.
}, 10, 3 );

What to do next

Quick Links

Share