Given the amount of times I find myself using similar code to carry out user registrations in my convertor scripts and MODs, I've decided that it is worse abstracting this code. However, given the number of requests I see from people looking to carry out registration from pages on their website, I thought it worth getting opinions from other MOD Authors on what they think is required in a tool like this.
My initial thoughts are to implement this as an object, rather than a function to allow more extendability of the code.
The object will have:
- A creator method which will take the 3 pieces of essential data - username, password and email address
- A method to set any of the other user fields
- Specific methods to set some of the fields (eg signature) which will carry out any special processing on them
- A method to add the user to specified usergroups when it is inserted
- A method to actually insert the user into the database
I have now produced an initial version of this code which is available for download and look forward to any comments.
MOD DB thread
[Edited 20061014 - changed download links to point to MOD DB]