[Mediawiki-l] Possible to block users from using a specific email service?

Clayton ccornell at openoffice.org
Thu Dec 9 16:40:47 UTC 2010


On 12/04/2010 12:39 AM, Platonides wrote:
[snip]
>>> Is there any practical way of blocking new users from using specific
>>> services like Mailinator?  Is there a better way of dealing with
>>> situations like this?
[snip]
> $wgHooks['AbortNewAccount'][] = 'noMailinator';
>
> function noMailinator( $user,&$message ) {
>     if( !preg_match( '/@(mailinator|binkmail).com$/', $user->getEmail() ) {
>       $message = 'No mailinator emails, please';
>       return false;
>     }
>     return true;
> }
>
>
> Another option would be the isValidEmailAddr hook.

Sorry for the late reply.  I've just had a chance to look at this again 
- prompted by yet another spammer using mailinator to authenticate their 
account.

I took a quick look at the $wgHooks docs here: 
http://www.mediawiki.org/wiki/Manual:Hooks and 
http://www.mediawiki.org/wiki/Manual:Hooks/AbortNewAccount

Seems straight forward, so I added the code (with and without the & in 
front of the $message variable) to my LocalSettings.php... and it didn't 
work so well.  According to my error log it had a "PHP Parse Error: 
syntax error, unexpected '{'" at the end of the first line of the if 
statement.  Funny thing is... I don't see a syntax error there though 
(granted I'm not a php guru... still learning, so I might be missing 
something).

I tried a few variations on the function code (including the suggestion 
from OQ) with the same results.... an unexpected '{'.

So at this point I'm a little puzzled... any suggestions on where the 
problem is?

C.



More information about the MediaWiki-l mailing list