Page 1 of 1

[solved] How to modify expiration date via FEU API

Posted: Thu Aug 06, 2009 6:53 pm
by kendo451
I've got a UDT that needs to update a User's expiration date based on a subscription payment.  The property I want to change is the actual FEU expiration date, not a user property.

I add the length of the subscription in seconds to the current time:

Code: Select all

$subscription_length = $years * 31557600;  // seconds in a year

$date = time()+$subscription_length;

$result = $feuser->SetUserProperty('exipires',$date) 
This doesn't throw an error, but it doesn't change the expiration date either.

What is a clean method of changing the user expiration date for subscription accounts?  Anybody?

Re: How to modify expiration date via FEU API

Posted: Thu Aug 06, 2009 8:05 pm
by jmcgin51
kendo451 wrote: $subscription_length = $years * 31557600;  // seconds in a year

$date = time()+$subscription_length;

$result = $feuser->SetUserProperty('exipires',$date)
Is this typo (bold above) also in your actual code, or just in this post?  Not sure if that would change your outcome.

Re: How to modify expiration date via FEU API

Posted: Thu Aug 06, 2009 11:56 pm
by calguy1000
expiry date is not a user 'property'.

See the SetUser() method.

Re: How to modify expiration date via FEU API

Posted: Fri Aug 07, 2009 4:06 pm
by kendo451
Thanks Calguy.  I had looked at SetUser, but it appears to require the password.

$feusers->SetUser( $uid, $username, $password, $expires = false )

I'll try it without the password and see what happens.

.... Did that.

Here's what works:

Code: Select all

$expires = time() + $seconds_to_expiration;
$uid = the uid of the user in question;
$username = the $username of the user in question;
$password = '';
$feusers->SetUser( $uid, $username, $password, $expires );
I didn't realize that if you put empty string in for the password that it skips that.