/**
  * update user package data after post an ad
  * @param string $pakage the package sku
  * @param int $user_id the user id
  *
  * @return null
  * @author  Dakachi
  */
 public static function update_package_data($package, $user_id = 0)
 {
     if (!$user_id) {
         global $user_ID;
         $user_id = $user_ID;
     }
     $used_package = self::get_package_data($user_id);
     if (!isset($used_package[$package])) {
         return;
     }
     $qty = (int) ($used_package[$package]['qty'] - 1);
     if ($qty == 0) {
         // remove user current order for the package
         $group = AE_Payment::get_current_order($user_id);
         unset($group[$package]);
         AE_Payment::set_current_order($user_id, $group);
     }
     $used_package[$package]['qty'] = $qty;
     self::set_package_data($user_id, $used_package);
 }