You are here

function user_stats_install in User Stats 5

Same name and namespace in other branches
  1. 6 user_stats.install \user_stats_install()

Implementation of hook_install().

File

./user_stats.install, line 6

Code

function user_stats_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    case 'pgsql':
      db_query("DELETE FROM {profile_fields} WHERE name IN ('user_post_count', 'user_ip_address', 'user_login_count')");
      db_query("INSERT INTO {profile_fields} (\n        title, name, explanation, category, page, type, weight, required, register, visibility, options) VALUES\n        ('Post Count', 'user_post_count', '', 'Statistics', '', 'textfield', 0, 0, 0, %d, '')", PROFILE_HIDDEN);
      db_query("INSERT INTO {profile_fields} (\n        title, name, explanation, category, page, type, weight, required, register, visibility, options) VALUES\n        ('IP Address', 'user_ip_address', '', 'Statistics', '', 'textfield', 0, 0, 0, %d, '')", PROFILE_HIDDEN);
      db_query("INSERT INTO {profile_fields} (\n        title, name, explanation, category, page, type, weight, required, register, visibility, options) VALUES\n        ('Login Count', 'user_login_count', '', 'Statistics', '', 'textfield', 0, 0, 0, %d, '')", PROFILE_HIDDEN);
      break;
  }
  variable_set('user_stats_postcount_profile_field', 'user_post_count');
}