17488 Posts in 4473 Topics by 1978 members
|Go to End|
6 March 2008 at 2:30am Last edited: 6 March 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.
7 March 2008 at 6:10pm
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.
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.
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.
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.
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.
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.
10 March 2008 at 2:13am
thanks Saimo, will do.
|Go to Top|