Embed the leaderboard
The leaderboard is available as a dedicated page, but you can also embed it directly anywhere on your site using a shortcode. This is useful when you want learners to see the leaderboard without leaving the course page.
Prerequisites
To use shortcodes, the Shortcodes filter plugin must be installed and enabled on your Moodle site.
How to embed the leaderboard
- Go to the leaderboard page.
- Click Embed leaderboard in the page menu.
- Copy the shortcode from the modal that appears.
- Paste the shortcode into any Moodle text editor, such as a course section description, a block content, or a page resource.
The shortcode will look something like this:
[xpladder ctx=123 secret=abcd1234]
The ctx and secret parameters are generated automatically and tie the shortcode to the correct context. We recommend copying the shortcode from the modal rather than writing it by hand.
Options
You can customise how the leaderboard is displayed by adding arguments to the shortcode:
topdisplays the top students instead of those surrounding the current user. You can optionally specify a number, e.g.top=10.hidelinkhides the link to the full leaderboard page.withprogressadds a progress bar column, if progress is enabled in the leaderboard settings.
For example:
[xpladder ctx=123 secret=abcd1234 top=10 hidelink]
See the shortcodes reference for the full list of options.
Team leaderboard
If you are using the team leaderboard, you can embed it the same way using the [xpteamladder] shortcode. The Embed leaderboard option in the page menu on the team leaderboard page will generate the correct shortcode for you.