You are here

function pmteam_user_return_teams in Drupal PM (Project Management) 7

Function to return the teams that a user is a member of

File

pmteam/pmteam.module, line 440
Functionality for the Project Management Team module Organized into the following sections:

Code

function pmteam_user_return_teams($account = NULL) {
  if (empty($account)) {
    global $user;
    $account = $user;
  }

  // Get the list of team nodes. Include organizations which the person is a member of.
  $s = "SELECT ste.nid FROM {pmteam} ste JOIN {pmperson} stp ON (stp.nid = ste.mnid OR stp.organization_nid = ste.mnid) WHERE stp.user_uid = %d";
  $r = db_query($s, $account->uid);
  $teams = array();
  while ($team = db_fetch_object($r)) {
    $teams[] = $team->nid;
  }
  return $teams;
}