Manually authenticating a MediaWiki user e-mail id

While testing with emails and user accounts, you will probably hit with a scenario when you have to create a fake account and make the Wiki send e-mails to it – so that you can analyse the results. Something similar turned up to me today, and thanks to Legoktm & Hoo, here we go:
* Scenario:
You have to manually confirm e-mail id of user ‘FooBar’
* Solution:

$ cd mediawiki/maintenance/
$ php eval.php 
> $user = User::newFromName('FooBar');
> $user->confirmEmail();
> $user->saveSettings();

You’re done! Navigate to Specail:Preferences to make sure the email id is authenticated !
What you did ? You created a User object corresponding to the User Name = ‘FooBar’. You can even user User::newFromId(123); if you know the user id ( You can get it from the ‘user’ table of your wiki )
Happy Hacking!

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s