Download & Extend

Sample hook implementation for user_stats

Project:User titles
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi,

If you wish your user_titles to be given on the base of user_stats post count, this is for you.

/**
* Sample hook implementation for user_stats; should be placed in user_stats
*/
if (module_exists('user_stats') && !function_exists('user_stats_user_titles')) {
  function user_stats_user_titles($op, $uid = NULL) {
    switch ($op) {
      case 'register':
        return 'user_stats';
      case 'name':
        return t('User Stats');
      case 'description':
        return t('Count of post and/or comments');
      case 'units':
        return t('Posts');
      case 'url':
        return 'admin/help/user_stats';
      case 'get':
        return user_stats_get_stats('post_count', $uid);
    }
  }
}

Comments

#1

Version:6.x-1.0-beta2» 6.x-1.x-dev
Status:active» needs review

I haven't had tome to test this out properly yet but here is your code in a patch.

You have to apply the patch in #453190: Role based titles first.
This is because that patch moves the integration with userpoints, user_stats etc. out to separate submodules, which is better.
So with this patch you also have to enable the user titles user stats module.

AttachmentSize
user_titles-597028-1.patch 1.36 KB

#2

Status:needs review» fixed

Committed and in 6.x-1.0-beta3

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.