Browse Source

Event for changing a participant type

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/434/head
Joas Schilling 8 years ago
parent
commit
d63b21576e
No known key found for this signature in database GPG Key ID: E166FD8976B3BAC8
  1. 10
      lib/Room.php

10
lib/Room.php

@ -360,12 +360,22 @@ class Room {
* @param int $participantType
*/
public function setParticipantType($participant, $participantType) {
$this->dispatcher->dispatch(self::class . '::preChangeParticipantType', new GenericEvent($this, [
'user' => $participant,
'newType' => $participantType,
]));
$query = $this->db->getQueryBuilder();
$query->update('spreedme_room_participants')
->set('participantType', $query->createNamedParameter($participantType, IQueryBuilder::PARAM_INT))
->where($query->expr()->eq('roomId', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->eq('userId', $query->createNamedParameter($participant)));
$query->execute();
$this->dispatcher->dispatch(self::class . '::postChangeParticipantType', new GenericEvent($this, [
'user' => $participant,
'newType' => $participantType,
]));
}
/**

Loading…
Cancel
Save