, versions 3.5 and up. It calls no functions or * code, only reads from the database. Example lines to put in * LocalSettings.php: * * $wgExternalAuthType = 'vB'; * $wgExternalAuthConf = array( * 'server' => 'localhost', * 'username' => 'forum', * 'password' => 'udE,jSqDJ<""p=fI.K9', * 'dbname' => 'forum', * 'tableprefix' => '' * ); */ class ExternalUser_vB extends ExternalUser { private $mDb, $mRow; protected function initFromName( $name ) { return $this->initFromCond( array( 'username' => $name ) ); } protected function initFromId( $id ) { return $this->initFromCond( array( 'userid' => $id ) ); } # initFromCookie() not yet implemented private function initFromCond( $cond ) { global $wgExternalAuthConf; $this->mDb = new Database( $wgExternalAuthConf['server'], $wgExternalAuthConf['username'], $wgExternalAuthConf['password'], $wgExternalAuthConf['dbname'], false, 0, $wgExternalAuthConf['tableprefix'] ); $row = $this->mDb->selectRow( 'user', array( 'userid', 'username', 'password', 'salt', 'email', 'usergroupid', 'membergroupids' ), $cond, __METHOD__ ); if ( !$row ) { return false; } $this->mRow = $row; return true; } public function getId() { return $this->mRow->userid; } public function getName() { return $this->mRow->username; } public function authenticate( $password ) { return $this->mRow->password == md5( md5( $password ) . $this->mRow->salt ); } public function getPref( $pref ) { if ( $pref == 'emailaddress' && $this->mRow->email ) { # TODO: only return if validated? return $this->mRow->email; } return null; } public function getGroups() { $groups = array( $this->mRow->usergroupid ); $groups = array_merge( $groups, explode( ',', $this->mRow->membergroupids ) ); $groups = array_unique( $groups ); return $groups; } }