latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

How to get the EOT in a s2member php script ?

Home Forums Community Forum How to get the EOT in a s2member php script ?

This topic contains 13 replies, has 3 voices. Last updated by  Raam Dev 4 years, 8 months ago.

Topic Author Topic
Posted: Tuesday Apr 17th, 2012 at 10:21 am #11000
Nicolas
Username: nicolassacre

Hello,

I need to get the EOT date value in a php script called by the s2member script paypal-checkout-in.inc.php. Is there a kind of global User array containing that value ? The get_user_field (“s2member_auto_eot_time”) method (who works fine in a wordpress page) doesn’t work in the paypal-checkout-in.inc.php script.

Any idea ?

Sincerely

  • This topic was modified 4 years, 8 months ago by  Nicolas.

List Of Topic Replies

Viewing 13 replies - 1 through 13 (of 13 total)
Author Replies
Author Replies
Posted: Wednesday Apr 18th, 2012 at 4:27 am #11081

I need to get the EOT date value in a php script called by the s2member script paypal-checkout-in.inc.php.

I’m not sure I understand this. Could you explain a bit more, please?

Does the user have an EOT time in his profile? The EOT time field could be empty too.

Posted: Wednesday Apr 18th, 2012 at 9:00 am #11107
Nicolas
Username: nicolassacre

Thank you for your answer.

Yes the user is logged, he has a current subscription and he has a EOT time field filled with a date.

When I use the get_user_field (“s2member_auto_eot_time”) method in a wordpress page (using php tags) it works well but when I use it in a paypal module php script I’m not able to get the value (but no error)). Do I have to put a require() or include() to have access to the the get_user_field() method ?

I use the instruction below and the shown result is “No value for eot”:

if ($s2member_auto_eot_time = get_user_field (“s2member_auto_eot_time”) )
{
echo “EOT : “.date(“F j, Y”, $s2member_auto_eot_time).””;
}
else
{
echo “No value for eot”;
}

Posted: Thursday Apr 19th, 2012 at 12:16 am #11189

When you say “a paypal module php script”, then you’re talking about a script ouside WordPress, right? Well, then you’ll not have the get_user_field function available to you if it’s not defined in your script.

That’s a function s2Member adds, and that happens in WordPress. You’d either have to include WP to your script or query the WP db directly from your script.

I hope that helps. :)

Posted: Thursday Apr 19th, 2012 at 4:51 am #11207
Nicolas
Username: nicolassacre

Thank you for your answer.

When you say “to include WP to your script” do you think of an include() instruction ? How to use the wp api outside of wordpress scripts ?

Sincerely

Posted: Saturday Apr 21st, 2012 at 7:08 am #11489
Posted: Monday Apr 23rd, 2012 at 11:33 am #11604
Nicolas
Username: nicolassacre

Hello,

Thank you for your answer.

I still get an empty value for $eot = get_user_field (“s2member_auto_eot_time”)
when I add a require to the “wp-load.php” file.

But I think I’m taking a too complex way for my purpose because I simply need to catch a post paid event and acquire the new automatically calculated End Of Term value. I guess I’m not the first needing that…

I think the API “Payment notifications” could be the best solution for me, but in the availables variables in the [s2Member > API / Notifications > Payment Notifications] section I don’t see any %%EOT%% variable.

How to get that value ?

Sincerely

Posted: Monday Apr 23rd, 2012 at 1:52 pm #11623
Raam Dev
Username: Raam
Staff Member

Hello,

s2Member does not calculate or set the Automatic EOT time for subscriptions upon payment. For subscriptions, s2Member will wait until it receives an IPN message from the payment gateway indicating that an EOT has occurred and only then will it calculate and set the Automatic EOT time.

If you’re using Buy Now transactions and not Subscriptions, then yes, s2Member will calculate and set the Automatic EOT time.

Can you tell us which one you’re using?

Posted: Tuesday Apr 24th, 2012 at 2:49 am #11658
Nicolas
Username: nicolassacre

I think we are using the subscription method because the IPN configuration has been made and
the user is created in wordpress before going to paypal.

Then I guess I need a trigger when coming back from paypal, when the new EOT has been calculated ?

Posted: Tuesday Apr 24th, 2012 at 2:52 pm #11727
Raam Dev
Username: Raam
Staff Member

The EOT time will not be calculated upon return from PayPal after making a payment. For subscriptions, it’s only calculated when the subscription ends.

So let’s say you have someone sign up for a recurring monthly subscription. There will be no Automatic EOT time recored by s2Member at this time. Let’s say after 5 months, the user cancels their PayPal subscription. s2Member will then receive an IPN message from PayPal and calculate the Automatic EOT time. As long as their recurring subscription is active, s2Member will not calculate an Automatic EOT time.

Posted: Wednesday Apr 25th, 2012 at 4:07 am #11808
Nicolas
Username: nicolassacre

Hello,

Thank you for your answer.

We don’t allow recurrent payment. Currently I get the EOT value directly from the database when the payment is done, adding personal code in the “paypal-checkout-in.inc.php” script. I use the table “wp_usermeta”, column “meta_key” with value “wp_s2member_auto_eot_time” for the current user_id and it works fine.

To be safe beside s2member future upgrades I would like to get this value without going directly to the database. I plan also to replace that code insertion (in “paypal-checkout-in.inc.php”) by an API Notification in the future, but I didn’t see any %%eot%% variable available in the documentation.

How to acquire the post-paid EOT time using the API Notification standard s2member mecanism ?

Sincerely,
Guillaume

Posted: Wednesday Apr 25th, 2012 at 9:55 pm #11882
Raam Dev
Username: Raam
Staff Member

Hi Guillaume,

The EOT Time is not an available variable when using the API Notification. We recommend obtaining the value from the database as you’re currently doing.

Posted: Thursday Apr 26th, 2012 at 11:45 am #11952
Nicolas
Username: nicolassacre

Hi Raam,

Thank you for the answer, I’m happy to know I did well…

Do you plan to add the %%eot%% variable in the futur or is there an impossibility or a contradiction to give it by the API ? If you plan to add it I’ll be back in a few months…

Regards,
Guillaume

Posted: Thursday Apr 26th, 2012 at 7:25 pm #12001
Raam Dev
Username: Raam
Staff Member

Hi Guillaume,

That’s certainly a possibility and we will consider making it available in the next major release of s2Member.

Viewing 13 replies - 1 through 13 (of 13 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.