You are here

function advanced_forum_statistics_latest_users in Advanced Forum 7.2

Same name and namespace in other branches
  1. 6.2 advanced_forum.module \advanced_forum_statistics_latest_users()

Return the newest X active (not blocked) users, linked to their profiles.

1 call to advanced_forum_statistics_latest_users()
advanced_forum_preprocess_advanced_forum_statistics in includes/theme.inc
Preprocesses template variables for the forum statistics template.

File

./advanced_forum.module, line 792
Enables the look and feel of other popular forum software.

Code

function advanced_forum_statistics_latest_users() {

  // @TODO: Make this a setting.
  $number_to_fetch = 5;
  $query = db_select("users", "u")
    ->fields("u", array(
    "uid",
    "name",
  ))
    ->condition("status", 0, "<>")
    ->condition("access", 0, "<>")
    ->orderBy("created", "DESC");
  $latest_users = $query
    ->range(NULL, $number_to_fetch)
    ->execute();
  while ($account = $latest_users
    ->fetchObject()) {
    $list[] = theme('username', array(
      'account' => $account,
    ));
  }
  return $list;
}