What it is
ModeratorPermissions extensions allow you to add additional moderator permissions that administrators will be able to set on a per-moderator basis when configuring moderators in the AdminCP. You could use this to allow administrators to specify which moderators can ban users from a chat room, for instance, or to specify which moderators can approve applications in your application.
How to use
When you create an instance of this extension you can define 3 methods.
/**
* Get Permissions
*
* @code
return array(
'key' => 'YesNo', // Can just return a string with type
'key' => array( // Or an array for more options
'YesNo', // Type
array( ... ), // Options (as defined by type's class)
'prefix', // Prefix
'suffix', // Suffix
),
...
);
* @endcode
* @return array
*/
public function getPermissions()
{
return array();
}
The getPermissions() method returns the form elements to show when configuring the moderators in the AdminCP.
/**
* After change
*
* @param array $moderator The moderator
* @param array $changed Values that were changed
* @return void
*/
public function onChange( $moderator, $changed )
{
}
The onChange event is called when moderator permissions are actually changed. You can use this to update data within your application if needed.
/**
* After delete
*
* @param array $moderator The moderator
* @return void
*/
public function onDelete( $moderator )
{
}
The onDelete() method is called when a moderator is deleted, giving your application an opportunity to perform any necessary actions when this situation occurs, if required. For instance if moderators are flagged special in your application, you may need to remove this flag when a user is removed as a moderator.
Report Document