views_handler_argument_user_uid.inc 741 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_argument_user_uid.
  5. */
  6. /**
  7. * Argument handler to accept a user id.
  8. *
  9. * @ingroup views_argument_handlers
  10. */
  11. class views_handler_argument_user_uid extends views_handler_argument_numeric {
  12. /**
  13. * Override the behavior of title(). Get the name of the user.
  14. *
  15. * @return array
  16. * A list of usernames.
  17. */
  18. function title_query() {
  19. if (!$this->argument) {
  20. return array(variable_get('anonymous', t('Anonymous')));
  21. }
  22. $titles = array();
  23. $result = db_query("SELECT u.name FROM {users} u WHERE u.uid IN (:uids)", array(':uids' => $this->value));
  24. foreach ($result as $term) {
  25. $titles[] = check_plain($term->name);
  26. }
  27. return $titles;
  28. }
  29. }