Koha How-To

Automatically Delete Self-Registered Patrons

Recent events have lead a lot of libraries to start allowing patrons to self-register for cards via the OPAC. Donna wrote a great blog post about setting that up, which you can see here. But self-registration often leads to users who create cards and then never verify them, which leaves libraries looking for a way to automatically delete those unverified accounts. Koha has two mechanisms for that, based on how you want that verification to work.

Option 1: Verify Manually

The first option assumes that every self-registered patron will eventually talk to someone at the library in order to verify their card. Here's that workflow in broad strokes:

  • Patron fills out the self-registration form
  • Koha creates an account in the self-registered patron category (as defined in the PatronSelfRegistrationDefaultCategory system preference)
  • Patron talks to a librarian, who confirms that they're eligible for a card
  • Librarian changes the patron from the self-registered patron category to whatever regular patron category they belong in

That third step, where the patron talks to the library, could rely on the patron to call or visit the library or could involve the library actively contacting self-registered patrons.

If you're following this model, you can use the system preference PatronSelfRegistrationExpireTemporaryAccountsDelay. This system preference asks for a number of days. Any patron still in the self-registered patron category that many days after their account was created will be automatically deleted. This system preference just passes a number of days to the cleanup_database cronjob. If that cron isn't running with the flag "--del-exp-selfreg," then the system preference has no effect. Even though the system preference and cron both use the term "expire," this doesn't have anything to do with the patron's expiration date.

Option 2: Verify by Email

This option assumes that every self-registered patron will provide an email address and use that email address to receive and click a verification link. To make that email send, turn on the system preference PatronSelfRegistrationVerifyByEmail. This message will send even if you've disabled your process_message_queue cronjob. Here's the workflow around verification by email:

  • Patron fills out the self-registration form
  • Koha temporarily stores the patron's information and sends a verification email to the address provided
  • Patron receives that email and clicks the verification link
  • Koha creates an account in the self-registered patron category (as defined in the PatronSelfRegistrationDefaultCategory system preference)

If you're following this model, you can set up your cleanup_database cron to delete that temporarily stored information if the email link hasn't been clicked after a given number of days. That number of days is set in the cronjob. For example, to delete the information of self-registered patrons who have not clicked the verification link within 2 days of submitting their form, you'd put "--del-unv-selfreg 2" in your cronjob. This method does not required any direct action from the library.

Combining The Two

This options can both be used, but they don't really interact. The email verification from Option 2 doesn't move someone out of the self-registered patron category, so it doesn't prevent them from being deleted by the cronjob for the first option. In practice, most libraries pick one of these two options. If you want to use both, your workflow would be:

  • Patron fills out the self-registration form
  • Koha temporarily stores the patron's information and sends a verification email to the address provided
  • Patron receives that email and clicks the verification link
  • Koha creates an account in the self-registered patron category (as defined in the PatronSelfRegistrationDefaultCategory system preference)
  • Patron talks to a librarian, who confirms that they're eligible for a card
  • Librarian changes the patron from the self-registered patron category to whatever regular patron category they belong in

The patron's account will be deleted after the second step if they never click the link or will be deleted after the fourth step if they never talk to the library and get their category changed.

Read more by Andrew Fuerste-Henry

Tags