You are here

function cctags_invoke_user_weight in cctags 6

Invoke a hook_user_weight() operation in all modules. or if defined function get_user_weight(&$user) set the $user->weight

Parameters

&$user: A user object.

Return value

none. example hook_user_weight: function mymodyle_user_weight(&$user) { if ($user->uid == 3) { $user->weight = 10; return TRUE; } else { return FALSE; } }

1 call to cctags_invoke_user_weight()
cctags_get_users in ./cctags.module

File

./cctags.module, line 317

Code

function cctags_invoke_user_weight(&$user) {
  $nodes = db_fetch_object(db_query("SELECT COUNT(uid) AS node_count FROM {node} WHERE status=1 AND uid=%d", $user->uid));
  $comments = db_fetch_object(db_query("SELECT COUNT(uid) AS comments_count FROM {comments} WHERE status=0 AND uid=%d", $user->uid));
  $user->node_count = isset($nodes) ? $nodes->node_count : 0;
  $user->comments_count = isset($comments) ? $comments->comments_count : 0;
  if (!module_invoke_all('user_weight', $user)) {
    $user->weight = cctags_get_user_weight($user);
  }
  if (function_exists('get_user_weight')) {
    call_user_func('get_user_weight', $user);
  }
}