You are here

function _xmlsitemap_user_links in XML sitemap 5

Get user profile links.

Return value

An array of links. Each link is an array containing the XML values for a site map URL.

Related topics

1 call to _xmlsitemap_user_links()
xmlsitemap_user_xmlsitemap_links in xmlsitemap_user/xmlsitemap_user.module
Implementation of hook_xmlsitemap_links().

File

xmlsitemap_user/xmlsitemap_user.module, line 37
Adds user profiles to the site map.

Code

function _xmlsitemap_user_links() {
  $links = array();
  $result = db_query("\n    SELECT u.uid, xu.last_changed, xu.previously_changed, xu.priority_override, SUM(xur.priority) as priority, ua.dst AS alias\n    FROM {users} u\n    LEFT JOIN {users_roles} ur ON ur.uid = u.uid\n    LEFT JOIN {xmlsitemap_user_role} xur ON xur.rid = ur.rid\n    LEFT JOIN {xmlsitemap_user} xu ON xu.uid = u.uid\n    LEFT JOIN {url_alias} ua ON ua.pid = xu.pid\n    WHERE (xu.priority_override IS NULL OR xu.priority_override >= 0) AND u.uid <> %d AND u.uid > 0 AND u.status <> 0\n    GROUP BY u.uid, xu.last_changed, xu.previously_changed, xu.priority_override, alias\n    HAVING COUNT(xu.priority_override) > 0 OR (COUNT(xur.rid) = 0 AND %f <> -1 OR MIN(xur.priority) <> -1)\n  ", _xmlsitemap_user_frontpage(), variable_get('xmlsitemap_user_default_priority', 0.5));
  while ($user = db_fetch_object($result)) {
    $age = time() - $user->last_changed;
    $interval = empty($user->previously_changed) ? 0 : $user->last_changed - $user->previously_changed;
    $links[] = array(
      'uid' => $user->uid,
      '#loc' => xmlsitemap_url("user/{$user->uid}", $user->alias, NULL, NULL, TRUE),
      '#lastmod' => $user->last_changed,
      '#changefreq' => max($age, $interval),
      '#priority' => _xmlsitemap_user_priority($user),
    );
  }
  return $links;
}