You are here

function user_stats_reset_counts in User Stats 5

Same name and namespace in other branches
  1. 6 user_stats.module \user_stats_reset_counts()
  2. 7 user_stats.module \user_stats_reset_counts()

Resets statistics. Full stop.

Parameters

$statistic: The name of the statistic to be reset. This must be the name of the profile_fields field.

3 calls to user_stats_reset_counts()
user_stats_admin_settings_validate in ./user_stats.module
Validate callback.
user_stats_reset_login_count in ./user_stats.module
Reset login count handler.
user_stats_reset_post_count in ./user_stats.module
Reset post count handler.

File

./user_stats.module, line 920
User Stats provides commonly requested user statistics for themers. These are:

Code

function user_stats_reset_counts($statistic = 'user_post_count') {
  $sql = "SELECT fid FROM {profile_fields} WHERE name = '%s'";
  if ($statistic == 'user_post_count') {
    $fid = db_result(db_query($sql, variable_get('user_stats_post_count_profile_field', 'user_post_count')));
  }
  else {
    $fid = db_result(db_query($sql, $statistic));
  }
  if ($fid) {
    db_query('DELETE FROM {profile_values} WHERE fid = %d', $fid);
  }
}