Quote:
Originally Posted by Live Wire
Add a new hook to global_start with this code:
PHP Code:
$user['activity'] = intval($vbulletin->userinfo['wwu002activity'] / $GLOBALS['WWU002maxPoints'] * 100) . '%';
Now that should make it so you can use $user[activity] in any template.
|
Almost. Your code doesn't take into account the first visit of the day, where the data in userinfo may not be up to date yet. This code should handle that situation:
Code:
if(isset($WWU002activityPoints)){
$user['activity']=intval($WWU002activityPoints/$WWU002maxPoints*100).'%';
}else if($vbulletin->userinfo['userid']){
$user['activity']=intval($vbulletin->userinfo['wwu002activity']/$WWU002maxPoints*100).'%';
}else{//(isset($WWU002activityPoints))
$user['activity']='N/A';
}//endif(isset($WWU002activityPoints))