Badge OS User data manipulation programmatically

There are a couple different ways you can interact with the user-related data created by BadgeOS. The first and most obvious is to use the provided helper functions, but if you choose you can also interact with the data directly using the user meta keys referenced below.

Functions:
badgeos_get_user_achievements()
Usage:
$args = array(
'user_id' => 0,
'site_id' => 1,
'achievement_id' => false,
'achievement_type' => false,
'since' => 0,
);
badgeos_get_user_achievements( $args )

Returns an array of a user’s earned achievements for the given site.

badgeos_update_user_achievements()
Usage:
$args = array(
'user_id' => 0,
'site_id' => 1,
'all_achievements' => false,
'new_achievements' => false,
)
badgeos_update_user_achievements( $args )

Updates the user’s earned achievements array. We can either replace the achievement’s array, or append new achievements to it.

badgeos_get_users_points( $user_id )
Return a user’s total earned points.

badgeos_update_users_points( $user_id, $new_points, $admin_id, $achievement_id )

Updates the user’s points total and posts a log entry. If an $admin_id is specified the admin will be credited with the point alteration and the $new_points value is assumed to be the user’s altered total.

badgeos_get_user_triggers( $user_id, $site_id )
Returns an array of a given user’s array of sprung triggers. On a multisite network $site_id can be specified to limit results to a given site (default is site 1).

badgeos_get_user_trigger_count( $user_id, $trigger, $site_id )
Get the count for the number of times a given user has triggered a particular trigger. On a multisite network $site_id can be specified to limit results to a given site (default is site 1).

badgeos_update_user_trigger_count( $user_id, $trigger, $side_id )
Reset a user’s trigger count for a given trigger to 0, or reset ALL triggers. On a multisite network $site_id can be specified to limit edits to a given site (default is site 1).

badgeos_update_user_trigger_count( $user_id, $trigger, $site_id )
Update the user’s trigger count for a given trigger by 1. On a multisite network $site_id can be specified to limit edits to a given site (default is site 1).