Я использую плагин WordPress для Wordpress S2, который дает пользователям дату EOT (окончание срока). В базе данных значения устанавливаются в качестве метки времени, т.е. 1417564800Wordpress php/strtotime issue
В на WordPress профилях пользователей, это отображение будет как «Ср Дек 3, 2014 12:00 утра UTC»
я добавил код, который работает, когда был произведен успешный платеж. В верхней части кода у меня есть следующие функции:
$end = strtotime('+1 years', $timestamp);
$timestamp = $wp_s2member_auto_eot_time;
Немного дальше в этом коде, я хочу, чтобы вытащить новую дату через так:
"s2member_auto_eot_time" => "$end",
Однако, это тянет в следующую дату «Ср. 3 декабря 6000 12:00 UTC», а не на год раньше текущей даты.
Любые советы очень ценятся.
спасибо.
Вот участок кода в entirity:
<?php
$end = mktime(date('h', $timestamp), date('i', $timestamp), date('s', $timestamp), $date('m', $timestamp), date('d', $timestamp), date('Y', $timestamp) + 1);
$timestamp = $wp_s2member_auto_eot_time;
$op["op"] = "create_user"; // The Remote Operation.
$op["api_key"] = "f4a01f73836f0385f6996a70b372dca3"; // Check your Dashboard for this value.
// See: `s2Member -› API/Scripting -› Remote Operations API -› API Key`
$op["data"] = array(
"user_login" => $my_cookie_variable["username"], // Required. A unique Username. Lowercase alphanumerics/underscores.
"user_email" => $my_cookie_variable["email"], // Required. A valid/unique Email Address for the new User.
// These additional details are 100% completely optional.
"modify_if_login_exists" => "1", // Optional. Update/modify if ``user_login`` value already exists in the database?
// A non-zero value tells s2Member to update/modify an existing account with the details you provide, if this Username already exists.
"user_pass" => "", // Optional. Plain text Password. If empty, this will be auto-generated.
"first_name" => $my_cookie_variable["first"], // Optional. First Name for the new User.
"last_name" => $my_cookie_variable["last"], // Optional. Last Name for the new User.
"s2member_level" => "2", // Optional. Defaults to Level 0 (a Free Subscriber).
"s2member_ccaps" => "", // Optional. Comma-delimited list of Custom Capabilities.
"s2member_registration_ip" => "", // Optional. User's IP Address. If empty, s2Member will fill this upon first login.
"s2member_subscr_gateway" => "", // Optional. User's Paid Subscr. Gateway Code. One of: (paypal|alipay|authnet|ccbill|clickbank|google).
"s2member_subscr_id" => "", // Optional. User's Paid Subscr. ID. For PayPal®, use their Subscription ID, or Recurring Profile ID.
"s2member_custom" => "www.website.com", // Optional. If provided, should always start with your installation domain name (i.e. $_SERVER["HTTP_HOST"]).
"s2member_auto_eot_time" => "$end",
"custom_fields" => array(
"title" => $my_cookie_variable["title"],
"giftaid" => "No",
"membership_number" => "",
"tel" => $my_cookie_variable["telephone"],
"address" => $my_cookie_variable["address1"],
"towncity" => $my_cookie_variable["city"],
"county" => $my_cookie_variable["state"],
"postcode" => $my_cookie_variable["postcode"],
"country" => $my_cookie_variable["countryshort"],
"region" => $my_cookie_variable["region"]
), // Optional. An array of Custom Registration/Profile Field ID's, with associative values.
"s2member_notes" => "Administrative notation. Created this User via API call.", // Optional. Administrative notations.
"opt_in" => "1", // Optional. A non-zero value tells s2Member to attempt to process any List Servers you've configured in the Dashboard area.
// This may result in your mailing list provider sending the User/Member a subscription confirmation email (i.e. ... please confirm your subscription).
"notification" => "1" // Optional. A non-zero value tells s2Member to email the new User/Member their Username/Password.
// The "notification" parameter also tells s2Member to notify the site Administrator about this new account.
);
$post_data = stream_context_create(array(
"http" => array(
"method" => "POST",
"header" => "Content-type: application/x-www-form-urlencoded",
"content" => "s2member_pro_remote_op=" . urlencode(serialize($op))
)
));
$result = trim(file_get_contents("http://www.website.com/?s2member_pro_remote_op=1", false, $post_data));
if (!empty($result) && !preg_match("/^Error\:/i", $result) && is_array($user = @unserialize($result)))
echo "Payment Success - Thank you.";
else
echo "API error reads: " . $result;
?>
Возможно, первые две строки кода переключаются друг на друга? PLS опубликовать больше кода, поскольку это очень сложно понять, что происходит –
Вы используете '$ timestamp', прежде чем вы установите его ... – ceejayoz