Thread:Project:Support desk/Help with code in Extension to only allow editing of Subpages/reply (4)

And I think I've got it, plus removed the name space part since I want it to match across name spaces. Would appreciate someone to look over it though, since I'm a total hack at programming.

$wgHooks['userCan'][] = 'efExtensionBlockSubpages'; function efExtensionBlockSubpages($title, $user, $action, $result) { global $egRegexMatch; global $wgUser; if ($action == 'edit') { $egRegexMatch = Array ("!^(.+/.+/.*)$!"); $pageTitle = $title->getText; foreach ($egRegexMatch as $pattern) { if ((preg_match($pattern, $pageTitle) === 0) && !in_array('sysop', $wgUser->getGroups))	{ $result = true; return false; }			}		}	}	   return true; }