[solved] How to modify expiration date via FEU API

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
kendo451

[solved] How to modify expiration date via FEU API

Post 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?
Last edited by kendo451 on Mon Aug 10, 2009 6:30 pm, edited 1 time in total.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: How to modify expiration date via FEU API

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: How to modify expiration date via FEU API

Post by calguy1000 »

expiry date is not a user 'property'.

See the SetUser() method.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
kendo451

Re: How to modify expiration date via FEU API

Post 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.
Last edited by kendo451 on Mon Aug 10, 2009 6:22 pm, edited 1 time in total.
Locked

Return to “Modules/Add-Ons”