Contents

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
plugixa_exam_certificate_issued   a certificate was awarded

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       override the access gate
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_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

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

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_erase_attempt_columns     which columns an erasure clears
plugixa_exam_erase_attempt_delete      whether an attempt is deleted outright
plugixa_exam_uninstall_capabilities    what uninstall removes

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, $input ) {
    // $attempt carries the exam, the candidate and the frozen paper.
}, 10, 2 );

What to do next

Quick Links