Skip to main content

Drops

This feature requires Level Up XP+.

Drops are code snippets that award points when Moodle displays specified course content to a learner.

You can put drops in activity descriptions, quiz feedback, lesson pages, and other course content.

For example, you can use a drop to award points when a learner views feedback for an incorrect answer.

Learners cannot see drops. Each drop awards its points only once to each learner.

info

Why is it called a drop? In video games, some characters can drop items or experience points for the player to collect. These items and points are called drops.

Creating drops

To create a drop:

  1. In the XP settings, select Points > Drops.
  2. Select the button to add a drop.
  3. Enter a name. The name helps you identify the drop. Learners cannot see it.
  4. Enter the number of points to award. Each learner receives the points the first time that they view content that contains the drop.
  5. Disable the drop if you do not want it to award points.
  6. Save the page.

When you preview content that contains the drop, Moodle shows the name to you.

Placing the drop

After you create a drop, copy its code snippet to course content.

  1. In the XP settings, select Points > Drops.
  2. Select the name of the drop. A dialog shows a code snippet, such as [xpdrop secret=abc123 id=123].
  3. Copy the snippet to your clipboard.
A code snippet for a drop.

To test your first drop, put the snippet in a section description on the course page:

  1. Open the course page and turn editing on.
  2. Open the menu next to a section name and edit the section.
  3. Put the snippet in the section description.
  4. Save the section.

When you return to the course page, Moodle shows the drop name to you. Each learner receives the points the first time that they open the course page.

warning

Do not share the code snippet with learners.

tip

You can put the snippet inside the shortcode [xpiflevel] to award points only at specified levels. The following example awards the drop points only if the learner's level is less than 5. For more information, see the xpiflevel reference.

[xpiflevel <5][xpdrop secret=abc123 id=123][/xpiflevel]

Backup and restore

note

This section applies only to drops and backups from a version earlier than XP+ 1.16.

Before XP+ 1.16, you could not back up and restore drops on the same site. The drop snippet did not contain a unique identifier. In XP+ 1.16 and later, the drop shortcode contains both the secret and id values. These values let you restore a backup on the same site.

Update all old drop shortcodes to include both values before you create a backup.

Troubleshooting

If a drop does not work, do these checks in order:

  1. Confirm that the drop is enabled in its settings.
  2. Confirm that the code snippet is correct.
  3. Open the content as an instructor and confirm that Moodle shows the drop name. If Moodle does not show the name, do these checks:
    • Confirm that you installed and enabled the Shortcodes plugin.
    • Confirm that the Shortcodes filter is enabled in the applicable context.
    • Confirm that the content supports Moodle filters.
  4. Confirm that the test learner did not receive the drop before. If you are not sure, create a new drop or use a different test account.
  5. Check the XP logs to confirm that the learner received the points.
  6. If the learner did not receive the points, confirm that the learner has the block/xp:earnxp permission.