You are here

function xmlsitemap_user_enable in XML sitemap 5.2

Same name and namespace in other branches
  1. 5 xmlsitemap_user/xmlsitemap_user.install \xmlsitemap_user_enable()
  2. 6 xmlsitemap_user/xmlsitemap_user.install \xmlsitemap_user_enable()

Implementation of hook_enable().

File

xmlsitemap_user/xmlsitemap_user.install, line 15
XML sitemap user install file

Code

function xmlsitemap_user_enable() {
  $weight = db_result(db_query("SELECT weight FROM {system} WHERE type = 'module' AND name = 'pathauto'"));
  if ($weight !== FALSE) {
    db_query("UPDATE {system} SET weight = %d WHERE type = 'module' AND name = 'xmlsitemap_user'", ++$weight);
  }
  db_query("INSERT INTO {xmlsitemap_user} (uid, last_changed)\n    SELECT u.uid, u.created FROM {users} u\n    LEFT JOIN {xmlsitemap_user} xu ON xu.uid = u.uid\n    WHERE u.uid <> 0 AND xu.uid IS NULL");
  db_query("INSERT INTO {xmlsitemap_user_role} (rid)\n    SELECT r.rid FROM {role} r\n    LEFT JOIN {xmlsitemap_user_role} xur ON xur.rid = r.rid\n    WHERE r.rid > 2 AND xur.rid IS NULL");
  xmlsitemap_flag_sitemap();
}