OnAfterBanningUser

Revision as of 03:43, 5 July 2016 by Sinisakrisan (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

This event will be triggered when the user is banned.

Params

An array of two items; user id who performed the banning action and the user id which is banned.

Example

/**
	* @param $adminId admin id who banned the user
	* @param $userId user id who has been banned
	*/
	public function onAfterBanningUser($adminId, $userId) 
	{
		//do any operation that you need here with the $adminid and $userid
	}


Add Notification to Queue Example

public function onAfterBanningUser($adminId, $userId) 
	{
		$cmd = 'system_messaging'; // type of notification
		$actor = $adminId; // our admin who performed the action will be the "actor"
		$target = '965'; // target should be whoever is receiving the notification
		$subject = "Administrator ".$adminId->getDisplayName()." just banned the user ".$userId->getDisplayName().""; // Subject of both, email and popup notifications
		$body = 'This is the notification body message'; //Body message in emails.
		$template = ''; // If you need to use specific jomsocial template file, you can define it here. Leave it empty to use default system messaging template.
		$params = new CParameter(''); // We want to create an additional params object, and assign data to it, without having to formally define a class
 
		CNotificationLibrary::add( $cmd , $actor , $target , $subject , $body , $template , $params );
	}