Revision [19930]

This is an old revision of URModuleHowTo made by BrianKoontz on 2008-05-13 22:46:06.

 

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 callbacks set up 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 will outline the steps I took to convert YodaHome's excellent FreeCap anti-spam captcha code to a UR module. I modified the original code for 1.1.7, but since the UR framework has not yet been ported to trunk, this example will use a clean checkout of the 1.1.6.4 version (the release tarball/zipfile will work as well). Setting up a working 1.1.6.4 Wikka instance is an exercise left for the reader, and is a prerequisite for continuing with the tutorial.

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, although I will probably favor "folders" because it's shorter to type (UNIX users, please stand down -- I'm on your side). 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.

Action steps will be set apart from comments using left-justified grey float boxes.

Setting up a new module (URCaptchaModule)


Modules must reside in the libs/UR/ folder. Start by creating a new folder:

mkdir libs/UR/URCaptchaModule
cd libs/UR/URCaptchaModule
 


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 URCapthcaModule
 


Since UR modules are intended to be self-contained, all module-related files should be contained within the module folder. This module utilizes the FreeCap library, so we'll unzip the FreeCap file into our module folder:

 


Even though
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki