Hello Erin,
I don't know if it will help but i've juste wrote something similar...
My extension check if the user which wants to edit a page belonging
to a special namespace is the same person who
edited it in first.
Well the code speaks for himself (sorry for the french comments) :
------------------------------------------------------------------------
-----
<?PHP
$wgExtensionFunctions[] = 'Wikinsa_Hooks';
function Wikinsa_Hooks() {
global $wgHooks;
$wgHooks['userCan'][] = 'verifDroitsUsers';
}
function verifDroitsUsers(&$title, &$user, $action, &$result) {
//--------------------------------------------------------
//
// Vérifie si il s'agit d'une requête d'EDITION
// et si l'utilisateur n'est pas un SYSOP
//
//--------------------------------------------------------
if($action == 'edit' && !$user->isSysop())
{
// ------------------------ //
// --- Page UTILISATEUR --- //
// ------------------------ //
if($title->getNamespace() == NS_USER)
{
// --- Compare les noms -- //
if ($user->getName() != $title->getText() ) {
$result = false;
}
}
// --------------------------- //
// --- Expérience de Stage --- //
// --------------------------- //
if ($title->getNamespace() == 100) {
// --- connexion au SGBD --- //
$dbw =& wfGetDB( DB_MASTER );
// --- titre de la page --- //
$titre_page = $title->getText();
$titre_page = str_replace(" ","_", $titre_page);
// --- les tables de la base --- //
$table_1 = $dbw->tableName( 'page' );
$table_2 = $dbw->tableName( 'revision' );
// --- 1ère requête : id de la page --- //
$res1 = $dbw->query("SELECT page_id FROM $table_1 WHERE
page_title=\"$titre_page\";");
$ligne = mysql_fetch_row($res1);
$id_page = $ligne[0];
// ---- 2ème requête : nom de l'utilisateur ---/
$res2 = $dbw->query("SELECT rev_user_text FROM $table_2 WHERE
rev_page = \"$id_page\" LIMIT 1;");
$ligne = mysql_fetch_row($res2);
$nom_user = $ligne[0];
// --- Compare le nom du créateur et du visiteur --- /
if($user->getName() != $nom_user && $nom_user != null)
$result = false;
}
}
}
?>
------------------------------------------------------------------------
-----
Christophe