You are here

public static function OpignoMessageThread::getUserThreads in Opigno messaging 8

Gets message treads of current user.

Parameters

int $uid: User uid.

Return value

bool|array User threads.

1 call to OpignoMessageThread::getUserThreads()
opigno_messaging_views_query_alter in ./opigno_messaging.module
Implements hook_views_query_alter().

File

src/OpignoMessageThread.php, line 24

Class

OpignoMessageThread
Class OpignoMessageThread.

Namespace

Drupal\opigno_messaging

Code

public static function getUserThreads($uid) {
  $db_connection = \Drupal::service('database');
  $query = $db_connection
    ->select('private_message_thread__members', 'tm');
  $query
    ->fields('tm', [
    'entity_id',
  ])
    ->condition('tm.members_target_id', $uid);
  $result = $query
    ->execute()
    ->fetchCol();
  if ($result) {
    return $result;
  }
  return FALSE;
}