You are here

function xmlsitemap_user_create_link in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.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

$account: A user object.

3 calls to xmlsitemap_user_create_link()
xmlsitemap_user_update_6201 in xmlsitemap_user/xmlsitemap_user.install
Migrate 6.x-1.x user data.
xmlsitemap_user_user in xmlsitemap_user/xmlsitemap_user.module
Implements hook_user().
xmlsitemap_user_xmlsitemap_process_user_links in xmlsitemap_user/xmlsitemap_user.module
Process user sitemap links.

File

xmlsitemap_user/xmlsitemap_user.module, line 142

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 = xmlsitemap_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->login && $account->access;
  $account->xmlsitemap['language'] = !empty($account->language) ? $account->language : '';
  return $account->xmlsitemap;
}