* of success. If it fails, the result will specify the nature of the error.
*/
public function execute() {
- global $wgUser;
+ global $wgUser, $wgBlockAllowsUTEdit;
$this->getMain()->requestWriteMode();
$params = $this->extractRequestParams();
$form->BlockEnableAutoblock = $params['autoblock'];
$form->BlockEmail = $params['noemail'];
$form->BlockHideName = $params['hidename'];
+ $form->BlockAllowUsertalk = $params['allowusertalk'] && $wgBlockAllowsUTEdit;
$userID = $expiry = null;
$retval = $form->doBlock($userID, $expiry);
$res['noemail'] = '';
if($params['hidename'])
$res['hidename'] = '';
+ if($params['allowusertalk'])
+ $res['allowusertalk'] = '';
$this->getResult()->addValue(null, $this->getModuleName(), $res);
}
public function mustBePosted() { return true; }
public function getAllowedParams() {
+ global $wgBlockAllowsUTEdit;
return array (
'user' => null,
'token' => null,
'autoblock' => false,
'noemail' => false,
'hidename' => false,
+ 'allowusertalk' => $wgBlockAllowsUTEdit,
);
}
'nocreate' => 'Prevent account creation',
'autoblock' => 'Automatically block the last used IP address, and any subsequent IP addresses they try to login from',
'noemail' => 'Prevent user from sending e-mail through the wiki. (Requires the "blockemail" right.)',
- 'hidename' => 'Hide the username from the block log. (Requires the "hideuser" right.)'
+ 'hidename' => 'Hide the username from the block log. (Requires the "hideuser" right.)',
+ 'allowusertalk' => 'Whether to allow the user to edit their own talk page (Dependent on $wgBlockAllowsUTEdit)'
);
}
* @return array(message key, arguments) on failure, empty array on success
*/
function doBlock( &$userId = null, &$expiry = null ) {
- global $wgUser, $wgSysopUserBans, $wgSysopRangeBans;
+ global $wgUser, $wgSysopUserBans, $wgSysopRangeBans, $wgBlockAllowsUTEdit;
$userId = 0;
# Expand valid IPv6 addresses, usernames are left as is
$block = new Block( $this->BlockAddress, $userId, $wgUser->getId(),
$reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
$this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName,
- $this->BlockEmail, $this->BlockAllowUsertalk );
+ $this->BlockEmail, isset( $this->BlockAllowUsertalk ) ? $this->BlockAllowUsertalk : $wgBlockAllowsUTEdit );
if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {