Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed By Shortcode or Template URL? #23

Closed
HelloLudger opened this issue Feb 3, 2023 · 1 comment
Closed

Embed By Shortcode or Template URL? #23

HelloLudger opened this issue Feb 3, 2023 · 1 comment

Comments

@HelloLudger
Copy link

Hello,

I would like to create pages with many embedded questions. Those pages would be created by a generator (e.g. combining all questions of a specific topic). Is it possible to use some kind of shortcode, like {{embedquestion:2:question123}}, paste this into the html and I am done?

Or would it be possible to have an URL like .../freefloatingquestion.php?course=2&question=question123, which shows the question123 from category 2? Similar to the "preview question" page in the question bank?

This would be very helpful!

@timhunt
Copy link
Member

timhunt commented Feb 3, 2023

If you look at what happens when you embed a question using Moodle's HTML, you will see this is exactly how it works internally.

However, there has to be some security built in, to stop, for example, students trying to guess the ids of the questions in the final exam, and so embed them in forum posts to each other.

So, the embed code had to contain a hash of various things, and a secret known only to the server (See code ehre: https://github.com/moodleou/moodle-filter_embedquestion/blob/main/classes/token.php#L28).

There is a web service (used to the HTML editor plugin) to get that secure code, so in your generator, either call that service, or replicate the logic to compute the has.

I don't think this requires any changes to this plugin, so I will close this.

@timhunt timhunt closed this as completed Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants