Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Registered User Expiry

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

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

Page: 1
Go to End
Author Topic: 1164 Views
  • Blackdog
    Avatar
    Community Member
    156 Posts

    Registered User Expiry Link to this post

    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

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Registered User Expiry Link to this post

    anybody?

  • saimo
    Avatar
    Community Member
    67 Posts

    Re: Registered User Expiry Link to this post

    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.

  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: Registered User Expiry Link to this post

    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.

  • saimo
    Avatar
    Community Member
    67 Posts

    Re: Registered User Expiry Link to this post

    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.

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Registered User Expiry Link to this post

    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.

  • saimo
    Avatar
    Community Member
    67 Posts

    Re: Registered User Expiry Link to this post

    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.

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Registered User Expiry Link to this post

    thanks Saimo, will do.

    1164 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.