src/Users.php
public function blockUser($user, $expiry = null, $reason = null, $anononly = null, $nocreate = null, $autoblock = null, $noemail = null,
		$hidename = null, $allowusertalk = null, $reblock = null, $watchuser = null
	)
	{
		// Get the token.
		$token = $this->getToken($user, 'block');

		// Build the request path.
		$path = '?action=unblock';

		// Build the request data.
		$data = array(
			'user'         => $user,
			'token'        => $token,
			'expiry'       => $expiry,
			'reason'       => $reason,
			'anononly'     => $anononly,
			'nocreate'     => $nocreate,
			'autoblock'    => $autoblock,
			'noemail'      => $noemail,
			'hidename'     => $hidename,
			'allowusetalk' => $allowusertalk,
			'reblock'      => $reblock,
			'watchuser'    => $watchuser,
		);

		// Send the request.
		$response = $this->client->post($this->fetchUrl($path), $data);

		return $this->validateResponse($response);
	}
public function blockUser($user, $expiry = null, $reason = null, $anononly = null, $nocreate = null, $autoblock = null, $noemail = null,
		$hidename = null, $allowusertalk = null, $reblock = null, $watchuser = null
	)
	{
		// Get the token.
		$token = $this->getToken($user, 'block');

		// Build the request path.
		$path = '?action=unblock';

		// Build the request data.
		$data = array(
			'user'         => $user,
			'token'        => $token,
			'expiry'       => $expiry,
			'reason'       => $reason,
			'anononly'     => $anononly,
			'nocreate'     => $nocreate,
			'autoblock'    => $autoblock,
			'noemail'      => $noemail,
			'hidename'     => $hidename,
			'allowusetalk' => $allowusertalk,
			'reblock'      => $reblock,
			'watchuser'    => $watchuser,
		);

		// Send the request.
		$response = $this->client->post($this->fetchUrl($path), $data);

		return $this->validateResponse($response);
	}
public function blockUser ( $ user , $ expiry = null , $ reason = null , $ anononly = null , $ nocreate = null , $ autoblock = null , $ noemail = null , $ hidename = null , $ allowusertalk = null , $ reblock = null , $ watchuser = null ) { // Get the token. $ token = $ this -> getToken ( $ user , 'block' ) ; // Build the request path. $ path = '?action=unblock' ; // Build the request data. $ data = array ( 'user' => $ user , 'token' => $ token , 'expiry' => $ expiry , 'reason' => $ reason , 'anononly' => $ anononly , 'nocreate' => $ nocreate , 'autoblock' => $ autoblock , 'noemail' => $ noemail , 'hidename' => $ hidename , 'allowusetalk' => $ allowusertalk , 'reblock' => $ reblock , 'watchuser' => $ watchuser , ) ; // Send the request. $ response = $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , $ data ) ; return $ this -> validateResponse ( $ response ) ; }
Method to block a user.

@param   string   $user           Username, IP address or IP range you want to block.
@param   string   $expiry         Relative expiry time, Default: never.
@param   string   $reason         Reason for block (optional).
@param   boolean  $anononly       Block anonymous users only.
@param   boolean  $nocreate       Prevent account creation.
@param   boolean  $autoblock      Automatically block the last used IP address, and any subsequent IP addresses they try to login from.
@param   boolean  $noemail        Prevent user from sending e-mail through the wiki.
@param   boolean  $hidename       Hide the username from the block log.
@param   boolean  $allowusertalk  Allow the user to edit their own talk page.
@param   boolean  $reblock        If the user is already blocked, overwrite the existing block.
@param   boolean  $watchuser      Watch the user/IP's user and talk pages.

@return  object

@since   1.0
Method to block a user .