function bppp_get_total_points()
{
    $total = 0;
    foreach ((array) BuddyPress_Profile_Progression()->query->points as $item) {
        $total += $item['points'];
    }
    return $total;
}
function bppp_get_user_progression_for_field()
{
    //get current item
    $point_item = BuddyPress_Profile_Progression()->query->point;
    $field_id = $point_item['args']['field-id'];
    if (!$field_id) {
        return false;
    }
    //get field value
    $user_id = bppp_get_user_id($user_id);
    $value = bp_get_profile_field_data(array('field' => $field_id, 'user_id' => $user_id));
    return (bool) $value;
    //return TRUE
}
 public static function modify_plugin_action_links($links, $file)
 {
     // Return normal links
     if (plugin_basename(BuddyPress_Profile_Progression()->file) != $file) {
         return $links;
     }
     // Add a few links
     return array_merge($links, array('settings' => '<a href="' . bppp_get_admin_options_link() . '">' . esc_html__('Settings', 'bppp') . '</a>'));
 }
function bppp_get_user_progression_percent($user_id = false)
{
    $user_id = bppp_get_user_id($user_id);
    if (!$user_id) {
        return false;
    }
    if (!bppp_has_point_items()) {
        return false;
    }
    while (BuddyPress_Profile_Progression()->have_points()) {
        BuddyPress_Profile_Progression()->the_point();
        $item = BuddyPress_Profile_Progression()->query->point;
        $potential_points += $item['points'];
        $item_points = BuddyPress_Profile_Progression()->query->point['callback']();
        if ($item_points === true) {
            //returned TRUE, wich means 100% of potential points
            $item_points = 100;
        }
        //balance points
        $add_points = $item_points / 100 * $item['points'];
        $user_points += $add_points;
    }
    //calculate total
    if (!empty($potential_points)) {
        $percent = round($user_points / $potential_points * 100);
    }
    return (int) $percent;
}