Example #1
0
 public static function put()
 {
     $data = self::get_data();
     // data massaging from frontend
     $data['birthday'] = sprintf('%4d-%02d-%02d', $data['birthday_year'], $data['birthday_month'], $data['birthday_day']);
     unset($data['birthday_year'], $data['birthday_month'], $data['birthday_day']);
     \lib\user_profile::set($data);
 }
Example #2
0
 public static function set($data)
 {
     $user_profile = \lib\user_profile::get($data['id']);
     foreach ($data as $key => $value) {
         if (!isset($user_profile[$key])) {
             // add it
             \lib\user_profile::add($data['id'], $key, $value);
         } else {
             if ($user_profile[$key] != $value) {
                 // change it
                 \lib\user_profile::update($data['id'], $key, $value);
             } else {
                 // do nothing
             }
         }
     }
 }