davelester / WPBadger

A lightweight badge issuing platform built using WordPress
Other
43 stars 13 forks source link

Generate JSON Assertion for Awarded Badges #2

Closed davelester closed 12 years ago

davelester commented 12 years ago

JSON assertions need to be generated for awarded badges, following the openbadges documentation.

davelester commented 12 years ago

Should these assertion files be static, or can they be dynamic? How often does the OBI check that they exist? (seems like they need to always be there.. at least in the current version of the infrastructure)

My concern is that over time, data that is dynamically fed to a badge may change. I have taken some initial steps to not make this easy, like not allowing badge data to be edited once it is created, but overall WPBadger settings could still be changed and affect the output.

If a dynamic approach is taken, some modifications may need to be made for how data is stored in WPBadger in order to protect against these problems.

davelester commented 12 years ago

The JSON file is created by a file /includes/awards_json.php. No static file for each assertion file exists; rather, a custom route is created which appends /json/ to each unique award, and generates the JSON file dynamically. WordPress has its own caching mechanism that is leveraged since I've used custom post types, so the database is not hit every time the JSON assertion is accessed.