You are here

function _xmlsitemap_user_submit in XML sitemap 5.2

Same name and namespace in other branches
  1. 5 xmlsitemap_user/xmlsitemap_user.module \_xmlsitemap_user_submit()

Add submit actions to forms.

Return value

None

File

xmlsitemap_user/xmlsitemap_user.module, line 211
Adds user profiles to the sitemap.

Code

function _xmlsitemap_user_submit($form_id, $form_values) {
  if ($form_id == 'user_admin_settings' && $form_values['xmlsitemap_user_default_priority'] != $form_values['xmlsitemap_user_old_default_priority']) {
    xmlsitemap_flag_sitemap();
  }
  elseif ($form_id == 'user_admin_role') {
    $priority = db_result(db_query("SELECT priority FROM {xmlsitemap_user_role} WHERE rid = %d", $form_values['rid']));
    if ($form_values['op'] == t('Delete role')) {
      db_query("DELETE FROM {xmlsitemap_user_role} WHERE rid = %d", $form_values['rid']);
      if ($priority !== FALSE) {
        xmlsitemap_flag_sitemap();
      }
    }
    elseif ($form_values['op'] == t('Save role')) {
      $query_args = array(
        $form_values['xmlsitemap_user_role_priority'],
        $form_values['rid'],
      );
      if ($priority === FALSE) {
        db_query("INSERT INTO {xmlsitemap_user_role} (priority, rid) VALUES (%s, %d)", $query_args);
      }
      elseif ($form_values['xmlsitemap_user_role_priority'] != $priority) {
        db_query("UPDATE {xmlsitemap_user_role} SET priority = %s WHERE rid = %d", $query_args);
      }
      xmlsitemap_flag_sitemap();
    }
  }
}