Post Types

Post Types are how Word Press and BadgeOS have negotiated with each other on how to interpret the Posts that constitute Badges and the Steps that are required to achieve badges.

The storage within BadgeOS/WordPress database is poor: Many of the achievement records are stored within a single string that itself is a set of records. There is little possibility (or benefit) of using the relational operators of the database to retrieve the records. This complicates the awarding of badges in a few ways:

  • To retrieve the records for a given user, one reads a string from the ‘meta_value` column of the `wp_usermeta` table where the `user_id` and `meta_key` fields match, and then parse this string into the achievement records. This is done inside the `achievement` package of the server code.
  • There is currently no mechanism to notify the server application when the BadgeOS application has awarded a badge. We must refresh a user’s achievements whenever we make a change. (Using a separate thread and an special event probably makes sense; there is discussion (tick tick) regarding using the SSE to add an "Award Badge" event).
  • When creating a new Badge that requires a new Post Type, it must be manually added to the places that recognize the badges. The list is below.

List of Post Types

Query to list the Post Types recognized by WordPress:

SELECT distinct post_type FROM `wp_posts`;
 
post_type
achievement-type
attachment
badgeos-log-entry
bp-email
custom_css
example-use-case
guide
nav_menu_item
nomination
page
post
revision
seeker
seekers
step
sub-achievement
submission
theme-close-ended

Query to select just the Achievement Types

This link takes you to the achievement_type view defined on the wp-cr DB instance: https://phpmyadmin.jettmarks.com/sql.php?server=1&db=wp-cr&table=achievement_type&pos=0.

The achievement types are listed in the next sections.

Badges

Also see Badge Expectations.

  • seeker
  • guide
  • theme-close-ended
  • sub-achievement ??

Achievements

  • step

Issues

  • Why is there a 'seeker' and a 'seekers' ?

It appears the post type seekers is a grouping of the seeker badges. Selecting all the posts with post type 'seekers' retrieves two rows, both of them represent levels of the post type 'seeker'.

Except I don't see the post 'Aware Seeker'. Find this.

Impacted Logic

  • WordPress Code to display the Badge pages without the dominating featured image (header.php at this time).
  • Server API Code to recognize the list of badges for a given user (parsing of Achievement records).
  • (Near future) Notification via SSE of awarded badges (perhaps play down minor steps, emphasize badges)

References

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License