diff --git a/xmlsitemap.admin.inc b/xmlsitemap.admin.inc index 623b41e..902aafb 100644 --- a/xmlsitemap.admin.inc +++ b/xmlsitemap.admin.inc @@ -35,8 +35,8 @@ function xmlsitemap_sitemap_list_form() { $form['operations']['submit'] = array( '#type' => 'submit', '#value' => t('Update'), - //'#validate' => array('xmlsitemap_sitemap_list_form_validate'), - //'#submit' => array('xmlsitemap_sitemap_list_form_submit'), + //'#validate' => array('xmlsitemap_sitemap_list_form_validate'), + //'#submit' => array('xmlsitemap_sitemap_list_form_submit'), ); $contexts = xmlsitemap_get_context_info(); @@ -752,6 +752,20 @@ function xmlsitemap_add_form_link_options(array &$form, $entity, $bundle, $id) { ), ), ); + //https://www.drupal.org/node/1811692 + if ($entity == 'node') { + $form['xmlsitemap']['changefreq'] = array( + '#type' => 'select', + '#title' => t('Change frequency'), + '#options' => array('default'=>t('Default')) + xmlsitemap_get_changefreq_options(), + '#default_value' => isset($link['changefreq']) ? $link['changefreq'] : 'default', + '#states' => array( + 'invisible' => array( + 'select[name="xmlsitemap[status]"]' => array('value' => '0'), + ), + ), + ); + } if (!$link['status_default']) { // If the default status is excluded, add a visible state on the include // override option. diff --git a/xmlsitemap_node/xmlsitemap_node.module b/xmlsitemap_node/xmlsitemap_node.module index 9005195..383bdbc 100644 --- a/xmlsitemap_node/xmlsitemap_node.module +++ b/xmlsitemap_node/xmlsitemap_node.module @@ -196,7 +196,10 @@ function xmlsitemap_node_create_link(stdClass $node) { // Always recalculate changefreq and changecount. $timestamps = xmlsitemap_node_get_timestamps($node); - $node->xmlsitemap['changefreq'] = $node->nid ? xmlsitemap_calculate_changefreq($timestamps) : 0; + //Change Frequency set from node - https://www.drupal.org/node/1811692 + if ($node->xmlsitemap['changefreq'] == 'default') { + $node->xmlsitemap['changefreq'] = $node->nid ? xmlsitemap_calculate_changefreq($timestamps) : 0; + } $node->xmlsitemap['changecount'] = $node->nid ? count($timestamps) - 1 : 0; // Node access must be reset since it a user may have changed published status, etc. @@ -312,8 +315,8 @@ function xmlsitemap_node_view_access($node, $account = NULL) { foreach ($grants[$account->uid][$op] as $realm => $gids) { foreach ($gids as $gid) { $grant_condition->condition(db_and() - ->condition('gid', $gid) - ->condition('realm', $realm) + ->condition('gid', $gid) + ->condition('realm', $realm) ); } }