mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 13:24:41 +03:00
Add "invitationCreate" event
This commit is contained in:
parent
09b3d77b19
commit
5ad1044dc0
@ -50,6 +50,16 @@ final class Events
|
||||
*/
|
||||
const GROUP_DELETE = 'groupDelete';
|
||||
|
||||
/**
|
||||
* An invitation is created.
|
||||
*
|
||||
* This event is triggered after an invitation has been created. An
|
||||
* associative array with the following items is passed to the event
|
||||
* handlers:
|
||||
* - "invitation": an instance of {@link \Mibew\Thread} class.
|
||||
*/
|
||||
const INVITATION_CREATE = 'invitationCreate';
|
||||
|
||||
/**
|
||||
* An operator cannot be authenticated.
|
||||
*
|
||||
|
@ -18,6 +18,8 @@
|
||||
*/
|
||||
|
||||
// Import namespaces and classes of the core
|
||||
use Mibew\EventDispatcher\EventDispatcher;
|
||||
use Mibew\EventDispatcher\Events;
|
||||
use Mibew\Database;
|
||||
use Mibew\Settings;
|
||||
use Mibew\Thread;
|
||||
@ -59,6 +61,8 @@ function invitation_state($visitor_id)
|
||||
/**
|
||||
* Invite visitor by operator
|
||||
*
|
||||
* Triggers {@link \Mibew\EventDispatcher\Events::INVITATION_CREATE} event.
|
||||
*
|
||||
* @param int $visitor_id ID of the visitor, who must be invited.
|
||||
* @param array $operator Info for operator who invite the visitor
|
||||
* @return Thread|boolean Thread object related with invitation or boolean
|
||||
@ -137,6 +141,10 @@ function invitation_invite($visitor_id, $operator)
|
||||
)
|
||||
);
|
||||
|
||||
// Let plugins know about the invitation.
|
||||
$args = array('invitation' => $thread);
|
||||
EventDispatcher::getInstance()->triggerEvent(Events::INVITATION_CREATE, $args);
|
||||
|
||||
return $thread;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user