mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 00:25:18 +00:00
Can get the number of unread conversations of a user
This commit is contained in:
@ -766,6 +766,24 @@ class conversations {
|
||||
return CS::get()->db->deleteEntry($this->conversationsListTable, "ID = ?", array($convID));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of unread conversations of a user
|
||||
*
|
||||
* @param int $userID Target user ID
|
||||
* @return int The number of unread conversations of the user
|
||||
*/
|
||||
public function number_user_unread(int $userID) : int {
|
||||
|
||||
//Prepare database request
|
||||
$tableName = $this->conversationsUsersTable;
|
||||
$conditions = "WHERE ID_utilisateurs = ? AND saw_last_message = 0";
|
||||
$values = array($userID);
|
||||
|
||||
//Perform request and return result
|
||||
return CS::get()->db->count($tableName, $conditions, $values);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of conversation messages based on specified conditions
|
||||
*
|
||||
|
Reference in New Issue
Block a user