Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Registered User Expiry


Reply


8 Posts   1267 Views

Avatar
Blackdog

Community Member, 156 Posts

6 March 2008 at 2:30am

Edited: 06/03/2008 2:52am

How would we go about setting a certain user having a defined expiry date?

Surely the date could be set in the registration process and then checked with a daily cron job.

cheers
BD

Avatar
Blackdog

Community Member, 156 Posts

7 March 2008 at 6:10pm

anybody?

Avatar
saimo

Community Member, 67 Posts

8 March 2008 at 5:40am

I have read that there is a way to have code run periodically using silverstripe (kind of emulating cron jobs). Then you could simply (or not so simple..?) make a query that deletes accounts older than a certain date. Though I don't know how to do this. Someone will have to fill in the details. I don't know if it's possible to deactivate an account without deleting it.

Avatar
Fuzz10

Community Member, 787 Posts

8 March 2008 at 5:56am

Instead of deleting the user I'd just add the expiry-date to the user-class and check it on runtime. Or something along those lines.

Avatar
saimo

Community Member, 67 Posts

8 March 2008 at 11:16pm

That's a way better way to do that... :)
I've looked a little at the Member class (located in sapphire/security/Member.php). It has a LastVisited field which could definately be used for this. Now it's just a matter of overriding the login form.
http://doc.silverstripe.com/doku.php?id=recipes:overriding-loginform&do=diff1204760891
has some information, but I think you should overload performLogin() instead of dologin(). You'll have to read the docs about the MemberLoginForm class and maybe look at the source.

Avatar
Blackdog

Community Member, 156 Posts

10 March 2008 at 12:17am

great, thanks guys. It will definitely give me somewhere to start.

My initial thoughts are to set a user up and allocate them a membership period ( ie 1 year ).
All users will be setup manually after they have had their application reviewed.

I could then use a date field to nominate their expiry date. At each login the system could review their account and check if it is still valid. At this point they could either renew or remove the account.

There would also need to be some automated clean up which deleted old account with no activity.

Avatar
saimo

Community Member, 67 Posts

10 March 2008 at 1:43am

To create the automated cleaning, have a look at my suggestion from my first post. The classes to extend resides in /sapphire/cli/. This is exactly the kind of thing where they are useful. I don't know how to use them though.

Avatar
Blackdog

Community Member, 156 Posts

10 March 2008 at 2:13am

thanks Saimo, will do.