How exactly does the earning process in BadgeOS work? Well, its a somewhat elaborate process, but it’s very linear and logical. The very first thing that happens is that something triggers badgeos_maybe_award_achievement_to_user(). This could be a hook we’re listening for in badgeos_get_activity_triggers() – a filterable function – which we respond to using badgeos_trigger_event().
However we get there, badgeos_maybe_award_achievement_to_user() will then check if the user has access to the achievement using badgeos_user_has_access_to_achievement() – a filterable function – and, if they do, we run badgeos_check_achievement_completion_for_user() – another filterable function. If we both have access and have completed the achievement, we run badgeos_award_achievement_to_user() which then fires a couple of different do_action() calls, like badgeos_award_achievement. One of the core calls hooked to badgeos_award_achievement is badgeos_maybe_award_additional_achievements_to_user() which looks for other related things and starts the process over again with badgeos_maybe_awarad_achievement_to_user() for each related thing.
Retrieve the registered activity triggers (hooks).
Fires any time a registered activity trigger (hook) is called, runs maybe_award_achievement_to_user().
Check if a given user has access to, and has completed, a given achievement, and awards it if so.
Checks if the given user can access the given achievement. This can be extended/overridden via filters.
Checks if the given user has completed the given achievement. This can be extended/overridden via filters.
Awards the given achievement to the given user.
Checks if the awarded achievement is connected to any other achievements, then attempts to award each via badgeos_maybe_award_achievement_to_user.