Difference between revisions of "Extension:ConfirmAccount"

From Organic Design wiki
(Adjust code to notify an admin of requests: (not required as of MW1.21))
(Change source-code blocks to standard format)
 
Line 2: Line 2:
  
 
It's important to install the version of the extension that matches the MediaWiki version. I find the easiest way to do this is to use [[SVN|Subversion]] to ''checkout'' a specific release of the extension code, e.g.
 
It's important to install the version of the extension that matches the MediaWiki version. I find the easiest way to do this is to use [[SVN|Subversion]] to ''checkout'' a specific release of the extension code, e.g.
{{code|<bash>svn co http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_16/extensions/ConfirmAccount</bash>}}
+
<source lang="bash">
 +
svn co http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_16/extensions/ConfirmAccount
 +
</source>
  
 
This extension also requires some SQL tables to be added. This is easily done by piping the ''ConfirmAccount.sql'' into your database from shell. But not that the SQL script will need to be edited in two locations if you use a table-prefix in your wiki.
 
This extension also requires some SQL tables to be added. This is easily done by piping the ''ConfirmAccount.sql'' into your database from shell. But not that the SQL script will need to be edited in two locations if you use a table-prefix in your wiki.
Line 8: Line 10:
 
== 1.19 issues ==
 
== 1.19 issues ==
 
After I upgraded the site to 1.19.2, the ConfirmAccount extension broke. I tried updating the code to the latest version with git using:
 
After I upgraded the site to 1.19.2, the ConfirmAccount extension broke. I tried updating the code to the latest version with git using:
{{code|<bash>git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ConfirmAccount.git</bash>}}
+
<source lang="bash">
 +
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ConfirmAccount.git
 +
</source>
 
but the new SQL would not import correctly giving [[MW:Extension_talk:ConfirmAccount#SQL_Error_1170:_BLOB.2FTEXT_column_.27acr_email.27_used_in_key_specification_without_a_key_length_.28localhost.29|this error]]. The solution provided at that link worked, which was to move the definition of the ''acr_email'' index to the end after the ''acr_type_del_reg'' index definition in the ''ConfirmAccount.sql'' file. Note that the ''account_requests'' and ''account_credentials'' tables had to be dropped before importing the SQL (and since I had outstanding account requests, I had to first export the data and then re-import after creating the tables from the new schema.
 
but the new SQL would not import correctly giving [[MW:Extension_talk:ConfirmAccount#SQL_Error_1170:_BLOB.2FTEXT_column_.27acr_email.27_used_in_key_specification_without_a_key_length_.28localhost.29|this error]]. The solution provided at that link worked, which was to move the definition of the ''acr_email'' index to the end after the ''acr_type_del_reg'' index definition in the ''ConfirmAccount.sql'' file. Note that the ''account_requests'' and ''account_credentials'' tables had to be dropped before importing the SQL (and since I had outstanding account requests, I had to first export the data and then re-import after creating the tables from the new schema.
  
Line 15: Line 19:
 
== LocalSettings ==
 
== LocalSettings ==
 
These are the settings we use for the ''ConfirmAccount'' extension on this wiki.
 
These are the settings we use for the ''ConfirmAccount'' extension on this wiki.
{{code|<php>$wgMakeUserPageFromBio = false;
+
<source lang="php">
 +
$wgMakeUserPageFromBio = false;
 
$wgUseRealNamesOnly = false;
 
$wgUseRealNamesOnly = false;
 
$wgAccountRequestMinWords = 0;
 
$wgAccountRequestMinWords = 0;
Line 23: Line 28:
 
$wgConfirmAccountCaptchas = false;
 
$wgConfirmAccountCaptchas = false;
 
$wgAllowAccountRequestFiles = false;
 
$wgAllowAccountRequestFiles = false;
$wgConfirmAccountNotice = true;</php>}}
+
$wgConfirmAccountNotice = true;
 +
</source>
  
 
== System messages ==
 
== System messages ==
Line 33: Line 39:
 
== Adjust code to notify an admin of requests (not required as of MW1.21) ==
 
== Adjust code to notify an admin of requests (not required as of MW1.21) ==
 
The ''ConfirmAccount'' extension does not provide an email notification to administrators when a user requests a new account. There are also no hooks in the user main system allowing an administrator confirmation to be gracefully added, so unfortunately a code-base hack was required to implement this. It has been done by changing line '''583''' of '''RequestAccount_body.php''' which has the following content:
 
The ''ConfirmAccount'' extension does not provide an email notification to administrators when a user requests a new account. There are also no hooks in the user main system allowing an administrator confirmation to be gracefully added, so unfortunately a code-base hack was required to implement this. It has been done by changing line '''583''' of '''RequestAccount_body.php''' which has the following content:
{{code|<php>return $user->sendMail(
+
<source lang="php">
 +
return $user->sendMail(
 
wfMsg( 'requestaccount-email-subj' ),
 
wfMsg( 'requestaccount-email-subj' ),
 
wfMsg( 'requestaccount-email-body',
 
wfMsg( 'requestaccount-email-body',
Line 43: Line 50:
 
$wgContLang->time( $expiration, false )
 
$wgContLang->time( $expiration, false )
 
)
 
)
);</php>}}
+
);
 +
</source>
  
  
 
Insert the following before the return statement to send a message to ad admin first.
 
Insert the following before the return statement to send a message to ad admin first.
{{code|<php>User::newFromName( 'ADMIN-USER-NAME' )->sendMail(
+
<source lang="php">
 +
User::newFromName( 'ADMIN-USER-NAME' )->sendMail(
 
         "A new user \"" . $user->getName() . "\" has requested an account on OrganicDesign",
 
         "A new user \"" . $user->getName() . "\" has requested an account on OrganicDesign",
 
         "A new user \"" . $user->getName() . "\" (" . wfGetIP() . ") has requested an account on OrganicDesign.
 
         "A new user \"" . $user->getName() . "\" (" . wfGetIP() . ") has requested an account on OrganicDesign.
Line 53: Line 62:
 
Manage account requests at the following link,
 
Manage account requests at the following link,
 
https://www.organicdesign.co.nz/Special:ConfirmAccounts"
 
https://www.organicdesign.co.nz/Special:ConfirmAccounts"
);</php>}}
+
);
 +
</source>
  
 
[[Category:Extensions]]
 
[[Category:Extensions]]

Latest revision as of 18:11, 22 May 2015

We been getting a lot of user signing up with the intent to do spamming - they haven't been able to because we've had a policy requiring users to request entry into the known group before they can edit. But recently even the number of signups have become annoying and messing up the recent changes, so I've finally installed the ConfirmAccount extension.

It's important to install the version of the extension that matches the MediaWiki version. I find the easiest way to do this is to use Subversion to checkout a specific release of the extension code, e.g.

svn co http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_16/extensions/ConfirmAccount

This extension also requires some SQL tables to be added. This is easily done by piping the ConfirmAccount.sql into your database from shell. But not that the SQL script will need to be edited in two locations if you use a table-prefix in your wiki.

1.19 issues

After I upgraded the site to 1.19.2, the ConfirmAccount extension broke. I tried updating the code to the latest version with git using:

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ConfirmAccount.git

but the new SQL would not import correctly giving this error. The solution provided at that link worked, which was to move the definition of the acr_email index to the end after the acr_type_del_reg index definition in the ConfirmAccount.sql file. Note that the account_requests and account_credentials tables had to be dropped before importing the SQL (and since I had outstanding account requests, I had to first export the data and then re-import after creating the tables from the new schema.

But then after that another fatal error occurred when I tried to accept an account registration which was that it tried to insert data into two non-existent columns; acd_xff and acd_agent. I created these columns and then the account could be accepted (but the user had to be deleted with UserMerge first as it had been created during the failed accept preventing it being accepted after the fix was made).

LocalSettings

These are the settings we use for the ConfirmAccount extension on this wiki.

$wgMakeUserPageFromBio = false;
$wgUseRealNamesOnly = false;
$wgAccountRequestMinWords = 0;
$wgAccountRequestToS = false;
$wgAccountRequestExtraInfo = false;
$wgConfirmAccountContact = false;
$wgConfirmAccountCaptchas = false;
$wgAllowAccountRequestFiles = false;
$wgConfirmAccountNotice = true;

System messages

I also adjusted the following system messages to suit our site:

Adjust code to notify an admin of requests (not required as of MW1.21)

The ConfirmAccount extension does not provide an email notification to administrators when a user requests a new account. There are also no hooks in the user main system allowing an administrator confirmation to be gracefully added, so unfortunately a code-base hack was required to implement this. It has been done by changing line 583 of RequestAccount_body.php which has the following content:

return $user->sendMail(
	wfMsg( 'requestaccount-email-subj' ),
	wfMsg( 'requestaccount-email-body',
		wfGetIP(),
		$user->getName(),
		$url,
		$wgContLang->timeanddate( $expiration, false ),
		$wgContLang->date( $expiration, false ),
		$wgContLang->time( $expiration, false )
	)
);


Insert the following before the return statement to send a message to ad admin first.

User::newFromName( 'ADMIN-USER-NAME' )->sendMail(
        "A new user \"" . $user->getName() . "\" has requested an account on OrganicDesign",
        "A new user \"" . $user->getName() . "\" (" . wfGetIP() . ") has requested an account on OrganicDesign.

Manage account requests at the following link,
https://www.organicdesign.co.nz/Special:ConfirmAccounts"
);