Esempio n. 1
0
 /**
  * Get author id from given username.
  *
  * @param string $author		Author's username.
  * @return int Return's user id or 0 if user was not found.
  */
 protected function get_author_id($author)
 {
     $user = user_helper::get_user_ids_from_list($this->db, $author);
     return (int) array_shift($user['ids']);
 }
Esempio n. 2
0
 /**
  * Get author id's and usernames from supplied usernames.
  *
  * @param array $authors	Array in the form of array('active' => 'usernames', nonactive => 'usernames')
  *	with the usernames separated by a new line.
  * @return array Returns array in the form of
  *	array('active' => array(username => user_id), 'nonactive' => (...), 'missing' => array('active' => username, ...)
  */
 public function get_authors_from_usernames($authors)
 {
     $result = array('missing' => array());
     foreach ($authors as $group => $users) {
         $users = user_helper::get_user_ids_from_list($this->db, $users);
         $result[$group] = $users['ids'];
         $result['missing'][$group] = $users['missing'];
     }
     return $result;
 }