コード例 #1
0
ファイル: uploader.php プロジェクト: alihoseiny/Shek
/**
 * This function adds ticket-upload meta to wp_usermeta table.If that column of that row has value but newest date
 * Of is older than 1 day ago, value will UPDATE completely, But if has value and that's date is not  older than 1
 * day ago, new date will CONCAT;
 *If there is no data before, meta will  add;
 * @param int $user_id
 * @param array $meta_array
 * @return bool|int
 */
function meta_add($user_id, $meta_array)
{
    if ($meta_array) {
        $date_obj = date_create($meta_array[count($meta_array) - 2]);
        $date = date_format($date_obj, "Y/m/d H:i:s");
        if ($date < date("Y/m/d H:i:s", strtotime("-1 day"))) {
            return portal_update_user_meta($user_id, "ticket-upload", strval(date("Y/m/d H:i:s")) . "|");
        } else {
            return portal_concat_user_meta($user_id, "ticket-upload", strval(date("Y/m/d H:i:s")) . "|");
        }
    } else {
        return portal_add_user_meta($user_id, "ticket-upload", strval(date("Y/m/d H:i:s")) . "|");
    }
}
コード例 #2
0
ファイル: editmanagemnet.php プロジェクト: alihoseiny/Shek
/**
 * @param int $user_id
 * @param string $new_zipcode
 * @return bool|int
 */
function change_postal_code($user_id, $new_zipcode)
{
    if (portal_get_user_meta($user_id, "user_postalcode") !== false) {
        return portal_update_user_meta($user_id, "user_postalcode", $new_zipcode);
    }
    return portal_add_user_meta($user_id, "user_postalcode", $new_zipcode);
}