Announcement

Collapse
No announcement yet.

[RELEASE v2] Top Posters

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [RELEASE v2] Top Posters

    To all my loyal "fans" and others:
    I am sorry to withdraw this hack. However there are so many problems with it it's just not worth putting you guys through it. Therefore I am ceasing work on it and will no longer be able to support it.

    To remove the hack, run the following query from phpMyAdmin or Telnet:
    Code:
    DELETE FROM template WHERE title='toppostall' OR title='toppost24' OR title='topposttoday'
    then "un-make" the changes you made to index.php and admin/functions.php. These are:

    Remove from index.php
    Code:
    if ($loadtoppost==1) {
    $today = mktime(0,0,0); $yesterday = $today-86400;
    
    $toptemp = gettemplate('toppost24',0,0);
    $top24 = explode("|||",$toptemp);
    if ($top24[0] != $yesterday and $top24[1] != $today) {
    	gettop24();
    	$top24 = gettemplate('toppost24',0,0);
    	$top24 = explode("|||",$top24);
    }
    $ttopthreadname = $top24[2]; $ttopthreadnum = $top24[3]; $ttoppostname = $top24[4]; $ttoppostnum = $top24[5];
    $tttu = $top24[6]; $ttpu = $top24[7];
    
    gettoptoday();
    $toptoday = gettemplate('topposttoday',0,0);
    $toptoday = explode("|||",$toptoday);
    $tttopthreadname = $toptoday[0]; $tttopthreadnum = $toptoday[1]; $ttttu = $toptoday[2];
    $tttoppostname = $toptoday[3]; $tttoppostnum = $toptoday[4]; $tttpu = $toptoday[5];
    
    $topatemp = gettemplate('toppostall',0,0);
    $topall = explode("|||",$topatemp);
    if ($topall[0] != $today) {
    	gettopall();
    	$topall = gettemplate('toppostall',0,0);
    	$topall = explode("|||",$topall);
    }
    $topthreadname = $topall[1]; $topthreadnum = $topall[2]; $toppostname = $topall[3]; $toppostnum = $topall[4];
    $topthreaddate = date($dateformat,$topall[5]); $toppostdate = date($dateformat,$topall[6]);
    $ttu = $topall[7]; $tpu = $topall[8];
    eval("\$topposterinfo = \"".gettemplate('topposters')."\";");
    }
    Code:
    $templatesused.=",topposters";
    Code:
    $loadtoppost=1;
    From admin/functions.php, change
    Code:
      global $templatecache,$DB_site,$templatesetid,$loadmaxusers,$loadbirthdays,$loadtoppost;
    to
    Code:
      global $templatecache,$DB_site,$templatesetid,$loadmaxusers,$loadbirthdays;
    Then remove
    Code:
    						  ".iif ($loadtoppost,"OR (title = 'toppostall')","")."
    						  ".iif ($loadtoppost,"OR (title = 'toppost24')","")."
    						  ".iif ($loadtoppost,"OR (title = 'topposttoday')","")."
    Code:
    // ###################### Start gettoptoday #######################
    function gettoptoday() {
    	global $DB_site;
    	$today = mktime(0,0,0); $tommorrow = $today+86400;
    	$ttopt = $DB_site->query_first("SELECT userid,COUNT(*) AS threads,username FROM thread,user WHERE dateline>=$today AND dateline<=$tommorrow AND postuserid>0 AND postuserid=userid GROUP BY postusername ORDER BY threads DESC");
    	$ttopp = $DB_site->query_first("SELECT user.username AS uuname,COUNT(*) AS posts,user.userid AS uuid FROM post,user WHERE dateline>=$today AND dateline<=$tommorrow AND post.userid>0 AND user.userid=post.userid GROUP BY post.username ORDER BY posts DESC");
    	$sep = "|||";
    	if ($ttopt[username] == "") {
    		$ttopt[username] = "No one yet";
    		$ttopt[userid] = 0;
    		$ttopt[threads] = 0;
    	}
    	if ($ttopp[uuname] == "") {
    		$ttopp[uuname] = "No one yet";
    		$ttopp[uuid] = 0;
    		$ttopp[posts] = 0;
    	}
    	$template = "$ttopt[username]$sep$ttopt[threads]$sep$ttopt[userid]$sep$ttopp[uuname]$sep$ttopp[posts]$sep$ttopp[uuid]";
    	$DB_site->query("UPDATE template SET template='".addslashes($template)."' WHERE title='topposttoday'");
    }
    
    // ###################### Start gettop24 #######################
    function gettop24() {
    	global $DB_site;
    	$today = mktime(0,0,0); $yesterday = $today-86400;
    	$ttopt = $DB_site->query_first("SELECT username,COUNT(*) AS threads,userid FROM thread,user WHERE dateline<=$today AND dateline>=$yesterday AND postuserid>0 AND postuserid=userid GROUP BY postusername ORDER BY threads DESC");
    	$ttopp = $DB_site->query_first("SELECT user.username AS uuname,COUNT(*) AS posts,user.userid AS uuid FROM post,user WHERE dateline<=$today AND dateline>=$yesterday AND post.userid>0 AND user.userid=post.userid GROUP BY post.username ORDER BY posts DESC");
    	$sep = "|||";
    	$template = "$yesterday$sep$today$sep$ttopt[username]$sep$ttopt[threads]$sep$ttopp[uuname]$sep$ttopp[posts]$sep$ttopt[userid]$sep$ttopp[uuid]";
    	$DB_site->query("UPDATE template SET template='".addslashes($template)."' WHERE title='toppost24'");
    }
    
    // ###################### Start gettopall #######################
    function gettopall() {
    	global $DB_site, $topall;
    	$today = mktime(0,0,0); $yesterday = $today-86400;
    	$topt = $DB_site->query_first("SELECT username,COUNT(*) AS threads,userid FROM thread,user WHERE dateline<=$today AND dateline>=$yesterday AND postuserid>0 AND postuserid=userid GROUP BY postusername ORDER BY threads DESC");
    	$topp = $DB_site->query_first("SELECT user.username AS uuname,COUNT(*) AS posts,user.userid AS uuid FROM post,user WHERE dateline<=$today AND dateline>=$yesterday AND post.userid>0 AND user.userid=post.userid GROUP BY post.username ORDER BY posts DESC");
    	$topalle = explode("|||",$topall);
    	if ($topalle[4] < $topp[posts]) {
    		$toppb = $topp[posts]; $toppa = $topp[uuname];
    		$toppd = $yesterday; $toppc = $topp[uuid];
    	} else {
    		$toppb = $topalle[4]; $toppa = $topalle[3];
    		$toppd = $topalle[6]; $toppc = $topalle[8];
    	}
    	if ($topalle[2] < $topt[threads]) {
    		$toptb = $topt[threads]; $topta = $topt[username];
    		$toptd = $yesterday; $toptc = $topt[userid];
    	} else {
    		$toptb = $topalle[2]; $topta = $topalle[1];
    		$toptd = $topalle[5]; $toptc = $topalle[7];
    	}
    	$sep = "|||";
    	$template = "$today$sep$topta$sep$toptb$sep$toppa$sep$toppb$sep$toptd$sep$toppd$sep$toptc$sep$toppc";
    	$DB_site->query("UPDATE template SET template='".addslashes($template)."' WHERE title='toppostall'");
    }
    Finally, remove the custom template topposters.

    This should remove the hack completely from your vBulletin installation.
    Last edited by tubedogg; Sun 13 May '01, 6:36pm.

  • #2
    That is great...! thanks

    can't wait to get out of my C++ class and try this out

    is there a way.. to have a Member of the Month or Week hack...? I seen it in UBB.. just curious

    Comment


    • #3
      Parse error: parse error in ./admin/functions.php on line 49

      Fatal error: Call to undefined function: getuserinfo() in ./admin/sessions.php on line 300

      Warning: Unable to call doshutdown() - function does not exist in ./admin/sessions.php on line 300

      Comment


      • #4
        Hello Kevin,
        I'm a fan of your Hacks
        but this one makes some troubles.
        i run the topinstall.php in my browser and come directly to the page where the instructons are. the script doesn't modify my DB.
        when i upload the modified index.php and functions.php i'll get a parse error.
        Code:
        Parse error: parse error in url/board/admin/functions.php on line 49
        
        Fatal error: Call to undefined function: getuserinfo() in url/board/admin/sessions.php on line 300
        can you help me?


        *sorry for my bad english i hope u can understand me*
        Last edited by AS_Eagle_1; Wed 9 May '01, 1:30pm.

        Comment


        • #5
          will this work on beta 3?
          Thanks
          Chris

          Comment


          • #6
            I have hopefully fixed all of the problems listed and then some with v0.5, released in the first post in this thread. I apologize again to this who previously tried to install this.

            If you did previously install this, please start again with fresh copies of index.php and admin/functions.php. Same directions: upload topinstall.php to your admin directory and follow the instructions in it.

            Comment


            • #7
              Ohhh very nice
              will add it on my site tonight,thx very much guy

              Comment


              • #8
                very nice hack mate


                works well too.

                Comment


                • #9
                  it is possible to add this hack to a non-vbpage ?
                  if yes,how?

                  Comment


                  • #10
                    i follow all the steps but nothing change on my forum
                    what can i do?
                    Last edited by furious; Thu 10 May '01, 4:33pm.

                    Comment


                    • #11
                      Nothing changes...do you mean it doesn't appear on your front page? If that's the case, make sure you edited the forumhome template (make sure, if you have multiple template sets, you edited the template set you are using on your site!). Can you be a little more specific?

                      Comment


                      • #12
                        i follow all the steps, i make all the modifications including the forumhome template but there is nothing new, no top poster
                        it doesnt appear
                        and i havent multiple template set

                        Comment


                        • #13
                          another cool hack cheers.
                          Christopher Padfield
                          Web Based Helpdesk
                          DeskPRO v3.0.3 Released - Download Demo Now!

                          Comment


                          • #14
                            wow i need some sleep (its 2.46am here)
                            i'm sorry its working fine
                            i forgot $loadtoppost=1; in index.php, i put twice $loadmaxusers=1; instead

                            very nice hack

                            Comment


                            • #15
                              Chris: Thanks

                              Furious: I'm glad you found it...I couldn't figure out for the life of me why it wouldn't show!

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X