I've taken this example and tried to adapt it to
my code. But when I
call the function I've created that uses it, I get:
Fatal error: Call to a member function ucfirst() on a non-object in
/usr/share/mediawiki/includes/User.php on line 653
My attempts at debugging seem to indicate that this happens when I
call:
$username = "TestUser";
$u = User::newFromName($username);
I looked at User.php, this is the section in question:
650 static function getCanonicalName( $name, $validate = 'valid'
) {
651 # Force usernames to capital
652 global $wgContLang;
653 $name = $wgContLang->ucfirst( $name );
I don't really know where to go from here...
If you just need the part for creating the users, I know that the LDAP
plugin's auto-authentication code does this properly (well, properly
enough not to break). See the attemptAddUser function in:
http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/LdapAuthenticati…
V/r,
Ryan Lane