Revision [19942]
This is an old revision of URModuleHowTo made by BrianKoontz on 2008-05-17 21:29:20.
Writing a UR (User Registration) Module
This page outlines the steps that can be used to write a UR (user registration) module. UR modules are pluggable, standalone modules that are used to interface with the UR validation framework introduced in 1.1.6.4.
Basically, a UR module contains all the logic necessary for alternative methods of user registration validation, and utilizes method hooks in the framework to display registration fields and text, retrieve user input, approve/disapprove registration requests, and display appropriate confirmation and error messages. Designing a UR module should never require modification to the Wikka core code libraries and routines.
About this tutorial
This tutorial outlines the development of the URInviteCodeModule, a simple module that prompts for a predetermined code before a registration request is processed. The module ships with Wikka 1.1.6.4, and can be found in the <wikka-dir>/libs/UR directory. If you are following thee tutorial, you might want to move/rename the URInviteCodeModule directory so you have the original to compare with if you run into problems.
Conventions
All file references will be with respect to your top-level installation directory (the directory which contains the folders/subdirectories 3rdparty, actions, handlers, etc.). The term "folders" and "subdirectories" are used interchangeably. As an example, the UR folder that is located in the top-level libs folder will be shown as libs/UR/.
I develop on a Mac iBook using the UNIX command line, so you might have to modify your commands accordingly for other platforms.
Setting up a new module (URInviteCodeModule)
Modules must reside in the libs/UR/ folder. Start by creating a new folder:
mkdir libs/UR/URInviteCodeModule
Make libs/UR/URInivteCodeModule your current directory. From this point on, the tutorial will make the assumption that you've done this step.
cd libs/UR/URInviteCodeModule
We'll use the URDummyModule as a template, so let's copy that into our new module folder from the libs/UR/URDummyModule folder:
cp ../URDummyModule/URDummyModule.php URInviteCodeModule
All modules must extend the URAuthTmpl class. So the first step is to change the class declaration to reflect the name of your new class. Change this line:
class URDummyModule extends URAuthTmpl
to this:
class URInviteCodeModule extends URAuthTmpl
The constructor function will also need to be changed to reflect the new name you've given your class...so modify the constructor:
function URDummyModule(&$wakka) { ... }
to:
function URInviteCodeModule(&$wakka) { ... }