You are here

function xmlsitemap_user_create_link in XML sitemap 7.2

Same name and namespace in other branches
  1. 6.2 xmlsitemap_user/xmlsitemap_user.module \xmlsitemap_user_create_link()

Create a sitemap link from a user.

The link will be saved as $account->xmlsitemap.

Parameters

object $account: A user object.

4 calls to xmlsitemap_user_create_link()
xmlsitemap_user_user_insert in xmlsitemap_user/xmlsitemap_user.module
Implements hook_user_insert().
xmlsitemap_user_user_presave in xmlsitemap_user/xmlsitemap_user.module
Implements hook_user_presave().
xmlsitemap_user_user_update in xmlsitemap_user/xmlsitemap_user.module
Implements hook_user_update().
xmlsitemap_user_xmlsitemap_process_user_links in xmlsitemap_user/xmlsitemap_user.module
Process user sitemap links.

File

xmlsitemap_user/xmlsitemap_user.module, line 131
Default file for XML sitemap user.

Code

function xmlsitemap_user_create_link(stdClass &$account) {
  if (!isset($account->xmlsitemap)) {
    $account->xmlsitemap = array();
    if ($account->uid && ($link = xmlsitemap_link_load('user', $account->uid))) {
      $account->xmlsitemap = $link;
    }
  }
  $settings = xmlsitemap_link_bundle_load('user', 'user');
  $uri = entity_uri('user', $account);
  $account->xmlsitemap += array(
    'type' => 'user',
    'id' => $account->uid,
    'subtype' => 'user',
    'status' => $settings['status'],
    'status_default' => $settings['status'],
    'status_override' => 0,
    'priority' => $settings['priority'],
    'priority_default' => $settings['priority'],
    'priority_override' => 0,
  );

  // The following values must always be checked because they are volatile.
  $account->xmlsitemap['loc'] = $uri['path'];
  $account->xmlsitemap['access'] = $account->uid && $account->status;
  $account->xmlsitemap['language'] = !empty($account->language) ? $account->language : LANGUAGE_NONE;
  return $account->xmlsitemap;
}