Thread: Miscellaneous Hacks - Activity Modification
View Single Post
  #295  
Old 05-04-2009, 03:38 AM
WetWired's Avatar
WetWired WetWired is offline
 
Join Date: Jun 2002
Location: Texas
Posts: 669
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by EmilGH View Post
Hey -- GREAT mod -- it's become the lifeblood of a site I co-run. Two quick questions:

1. Is there a way to modify the "Top Activity" page to show last login instead of join date?

2. Is there a way to modify the "Top Activity" page to hide banned users (or users that are in a specific usergroup)?

We have an activity-based site, and when people fall below a certain activity level they get put into an inactive group. I'd like to be able to hide those folks from the top activity page so we see only the actives.

Thanks!
The problem with mucking with the top activity is that when you do it, the optimization to prevent checking everyone's activity breaks... since you are interested in the activity of a limited group of people, perhaps that is something you can deal with.

in the plugin marked "Top Activity" (for forumhome), find
Code:
  //**************************************** 
  // How old are we? how many users do we need to process? 
  if(MAX_NUM==0){ 
    $querylimit=1; 
  }else{//(MAX_NUM==0) 
    $daysold=($WWU002startOfDay-$statdata[0])/WWU002_ONE_DAY; 
    if(($daysold>=($vbulletin->options['WWU002weeks']*3.5))||($_REQUEST['oldway'])){ 
      //A complete reversal of activity is possible in this time period, we must check everyone 
      $querylimit='1'; 
    }else{//($daysold>=($vbulletin->options['WWU002weeks']*3.5)) 
      //What is the lowest activity that could surpass the lowest activity on the old list? 
      $acc=0; 
      DEVDEBUG('Days old='.$daysold); 
      for($i=1;$i<=$daysold;$i++){ 
        $acc+=$WWU002maxDay*$WWU002weekWeights[floor($i/7)]; 
      }//endfor($i=1;$i<$daysold;$i++) 
      $temp=$statdata[1]; 
      $temp=array_pop($temp); 
      DEVDEBUG('Activity lower limit='.$temp[3].'-'.($acc*2).'='.($temp[3]-($acc*2))); 
      $acc=$temp[3]-($acc*2); 
      if($acc<=0){ 
        //just use the simple where clause 
        $querylimit='1'; 
      }else{//($acc<=0) 
        $querylimit='wwu002activity>='.$acc; 
      }//endif($acc<=0) 
    }//endif($daysold>=($vbulletin->options['WWU002weeks']*3.5)) 
  }//endif(MAX_NUM==0)
replace with
Code:
$querylimit='usergroupid<>100';
This should (I'm not testing any of this) remove the optimization and instead only include people whose primary group is not group 100.

For the date thing, I think you should be able to
find (in the same plugin)
Code:
$longresult=$db->query_read('SELECT userid,username,joindate FROM '.TABLE_PREFIX.'user WHERE userid IN ('.$ids.')');
and replace with
Code:
$longresult=$db->query_read('SELECT userid,username,lastvisit AS joindate FROM '.TABLE_PREFIX.'user WHERE userid IN ('.$ids.')');
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01673 seconds
  • Memory Usage 1,777KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete