Documentation: Quiz Notifications for LearnDash

Shortcode Descriptions

Notifications Shortcode

[elc_ldquiz_notifications]

Notifications shortcode is to be used only in ‘quiz related notifications’, created with ‘LearnDash LMS Notifications’ addon. The shortcode enables to output additional information that is not supported by ‘LearnDash LMS Notifications’. In addition to ‘questions and answers’ the shortcode can output other information described in Quiz Results Display LearnDash documentation. 

Example:
[elc_ldquiz_notifications show="questions_answers" question_cat="true" show_essay]

For description of attributes and values refer to Common Shortcode Attributes section.

Above example will generate the html output of questions and user answers, including indication of correct/incorrect, points scored, question category.
The essay text is included – refer to show_essay attribute documentation for limitations.
Because the requirement is to generate html for the email, the CSS and JS scripts cannot be used. The output uses inline CSS styles for decorations. 

Last Quiz shortcode

[elc_last_quiz]

Last Quiz shortcode – added by popular demand.

The ‘last quiz’ shortcode can be inserted into the content of any post (with exception of the LearnDash LMS Notifications).
As per name ‘last quiz’, the shortcode will output quiz results for the last attempt taken by the user.
The shortcode does query results from LearnDash statistics within the scope of LearnDash course, lesson, topic and/or global scope. 

The ‘last quiz’ provides the same functionality as ‘notifications shortcodes’.
Because the shortcode is to generate html for site pages, it provides extra functionality.
The html tags have ‘class’ attribute to allow use of the CSS stylesheets for decorations.
In addition the shortcode output can be collapsible and printed by itself rather than printing the entire page (see print_button attribute). 

Because the ‘last quiz’ shortcode is executed after the quiz has been completed by the user, it does not require the LearnDash LMS Notifications addon. Instead we did provide the attributes (course, lesson, topic and quiz ID) in order to create adequate scope using the same logic as creating notification in LearnDash LMS Notifications addon. Refer to: Notifications Add-On – LearnDash Support, Email Trigger
If the shortcode is inserted in LearnDash course, lesson, topic and/or quiz it is not necessary to use course_id, lesson_id, topic_id or quiz_id attributes. The scope will be defined by the context of the post where the shortcode is inserted. 

The user ID is assumed to be the ID of the currently logged-in user. For security and privacy reasons we do not include the attribute for the user ID. 

Example:
[elc_last_quiz show=”questions_answers” question_cat=”true” show_essay collapsible]

For shortcode attributes, description and values refer to Common Shortcode Attributes and Additional Attributes: Last Quiz Shortcode section. (use anchor)

Last Quiz Print Shortcode

[elc_last_quiz_print] … [/elc_last_quiz_print]

Last Quiz Print shortcode – a helper shortcode to facilitate printing a part of the post (quiz results) rather than entire post or page. This shortcode is an alternative to print_button attribute.

The shortcode can be used on any page or post (with exception of the LearnDash LMS Notifications).

The shortcode inserts a printer icon. Clicking the icon opens browser print dialog. Only content between opening and closing shortcode will be printed.

Example:
[elc_last_quiz_print] The text and or shortcode(s) to be printed [/elc_last_quiz_print]

This shortcode has no attributes.   

Shortcode Attributes

Common Shortcode Attributes

The attributes supported in both [elc_ldquiz_notifications] and [elc_last_quiz] shortcode: 

  • show (required)
    This attribute must be set to one of following values: 
    • custom_fields
      Custom Fields are set in quiz settings. See LeadnDash documentation: Quiz Custom Fields
    • overall_score
      Overall Score – message displayed at quiz results after user clicks ‘Finish Quiz’ button,
      e.g.: You have reached 10 of 20 point(s), (50%)
      See LeadnDash documentation: Custom Results Display
    • result_message
      Result Message(s) are configured in quiz settings.
      See LeadnDash documentation: Quiz Result Message(s)
    • cat_score
      Category Score is configured at quiz settings.
      See LeadnDash documentation: Custom Results Display
    • timespent
      Time Spent by user while taking the quiz.
      See LeadnDash documentation: Custom Results Display
    • questions_answers
      Itemized list of questions and user answers.
  • show_essay (default false)
    This attribute takes effect when using show=”questions_answers”.
    By default the essay responses entered by the user are not added, instead the ‘view’ link to the post with user response will be included. If show_essay attribute is present the essay test will be included if the essay question is set to type of Text Box’,
    See LeadnDash documentation: Essay / Open Answer
  • show_correct (default true)
    This attribute takes effect when using show=”questions_answers”. By default the user answers will be marked as correct or incorrect (wherever applicable). If show_correct attribute is included and is set to false or 0, the indication of correct/incorrect will not be visible.
    For reference see: Correct / Incorrect Answer Marks
  • show_points (default true)
    This attribute takes effect when using show=”questions_answers”. By default the ‘Points %, Points scored’ will be included under every question and answer. If the show_points attribute is included and is set to false or 0, the ‘Points %, Points scored’ will not be visible.
  • question_cat (default false)
    This attribute takes effect when using show=”questions_answers”. If a attribute is present then the question category will be visible.

Additional Attributes: Last Quiz Shortcode

The attributes supported only in [elc_last_quiz] shortcode.

  • course_id (default 0)
    Sets or overrides the course ID for the scope. Value must be a valid course post ID. If not present or value is 0 ‘all courses’ will be included in the scope.
  • lesson_id (default 0)
    Sets or overrides the lesson ID for the scope. Value must be a valid lesson post ID. If not present or value is 0 ‘all lessons’ will be included in the scope.
  • topic_id (default 0)
    Sets or overrides the topic ID for the scope. Value must be a valid topic post ID. If not present or value is 0 ‘all topics’ will be included in the scope.
  • quiz_id (default 0)
    Sets or overrides the quiz ID for the scope. Value must be a valid quiz post ID. If not present or value is 0 ‘all quizzes’ will be included in the scope.
  • collapsible (default false)
    Wrap the shortcode output in a collapsible element ‘<details>’.
    Refer to: W3Schools HTML details Tag
    If present the shortcode content will be collapsible. The default label for visible heading ‘<summary>’ of the collapsible element is: View Quiz Statistics. You can specify different label by setting the attribute value, e.g.:
    collapsible=”Click to expand”
  • show
    • breadcrumbs
      This value is supported only in [elc_last_quiz] shortcode.
      Output path to the ‘last quiz’ in the form of breadcrumbs.
    • quiz_title
      This value is supported only in [elc_last_quiz] shortcode.
      Output the quiz title.

      Note:
      When using the [elc_last_quiz] shortcode the ‘show’ attribute value can be comma (,) delimited list of any combination of allowed values. The list must be enclosed in double-quote characters (“). The sequence of the values will order output vertically (top-to-bottom).

      Example:
      [elc_last_quiz show=”breadcrumbs, timespent, overall_score, questions_answers”]
Shopping Cart
  • Your cart is empty.