Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
DevBox Work - Online Users Today, Latest Threads, Top Posters, Newest Members Details »»
DevBox Work - Online Users Today, Latest Threads, Top Posters, Newest Members
Version: 1.00, by Chroder Chroder is offline
Developer Last Online: May 2011 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 03-28-2004 Last Update: Never Installs: 33
 
No support by the author.

This is another one of my 'all in one' hacks, this time without the 'latest posts' part.

Features



  • Turn on/off each option. An individual setting
  • Alter the amount of rows to retrieve (ie. only get 10 recent threads)
  • Easy access to used SQL queries, so advanced users can alter the SQL to get extra information.
  • Uses phrase system
  • Fully customizable templates
  • Latest Threads can be from only forums you specify, or from forums that the current user has permission to see. Deleted threads are not shown.
  • Online Users Today shows invisible marks to those who can see them, and shows open/close tag (ie. admins are bold and italic).
  • Dates uses vbdate function, which uses your date string in vboptions
  • Installer for phrases and templates!
  • + more
Support
I can offer limited support for this hack. I wrote it for my forum, and its workin' pretty good. If you find any problems, post'em here and I might find some time to help you out. Just back up all your data before you apply anything, as goes with all hacks!

Demo
Online demo (with some template edits, I might add!): http://www.DevBoxForums.com

Notes
I didn't have the time to edit the default templates, so I don't think it's too pleasing out-of-the-box. If someone would like to spice it up a notch and submit it here, I'd be glad to include it in the actual package.

Installation
Upload devbox_work.php to your forum root path, as well as the devbox_install directory. Navigate your browser to devbox_install/install.php and follow onscreen instructions. You will need your database username and password simply for authentication to start the installer.

Should I install this hack? Is it buggy? Etc
I've been making the installer for a little while and I must've run it at least a dozen times throughout and I haven't had any errors. But thats only me. Before people can install it for themselves and see how it goes, I can't say much.

Troubleshooting / Common Problems
If you end up running the phrase step or template step more then once, you'll probably get mysql errors complaining about duplicate entries. You can go in phpMyAdmin into the phrase/template tables, sort by the primary key so oldest is first, and delete all the devbox related rows.


Template Variables
Since this hack is obviously lacking some default-template looks, I thought I'd go over all of the variables you can use. If you want more, you'll have to edit the SQL queries under 'Section 2'. All variables are accessed through the $data array. Example: $data[threadid]

  • Latest Threads
    • threadid - The ThreadID. Used in URL's mostly
    • title - Thread title
    • replycount - The number of replies the thread has
    • views - The number of views the thread has
    • lastposter - The username of the last poster
    • posterusername - The username of the thread starter
    • posteruserid - The UserID of the thread starter
    • forumid - The ForumID of the the forum the thread resides in
    • forumtitle - The forum name the thread resides in
  • Newest Members

    • userid - The UserID of the member. Usually used in URL's
    • username - The username of the member
    • date - The readable joindate of the user. If for some reason you wanted the timestamp, use joindate
    • posts - The number of posts this member has
    • opentag/closetag - The open/close HTML tags for this member. (ie. Admins are generally bold and italic)
  • Top Posters

    • userid - See above
    • username - See above
    • posts - See above
    • opentag/closetag - See above
  • Online Today

    • userid - See above
    • username - See above
    • invisible - The invisible mark shown next to invisible users. Set to '*' to members that are hidden users, and set to '' (nothing) to those who are not. Note: Hidden users are only shown on the list if the user viewing the page has permission to see them.
    • opentag/closetag - See above
Attachments



  • devbox_work.zip contains all the files neede
  • installer.gif is a screenshot of the install script

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 05-11-2004, 12:40 AM
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there anyway to exclude certain usergroups from the top posters?
Reply With Quote
  #23  
Old 05-13-2004, 01:20 PM
streetfighter streetfighter is offline
 
Join Date: May 2004
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well,

whever i call the devbox_work.php file: I GET FOLLWING ERROR:

Code:
Warning: array_keys(): The first argument should be an array in /home/indiangu/public_html/devbox_work.php on line 81
Warning: Invalid argument supplied for foreach() in /home/indiangu/public_html/devbox_work.php on line 81
Fatal error: Call to a member function on a non-object in /home/indiangu/public_html/devbox_work.php on line 180
As per ur suggestion in earlier posts, i have to give individual forum ids in config file, which i did, but still not effect.

here is my config file:

Code:
<?php
// +-----------------------------------------------------------------------------+
// | devbox_work.php                                                             |
// +-----------------------------------------------------------------------------+
// | Written by Christopher Nadeau                                               |
// |    - www.DevBox.net, www.DevBoxForums.com [chris@devbox.net]                |
// +-----------------------------------------------------------------------------+
// | Copyright 2004 by Christopher Nadeau                                        |
// +-----------------------------------------------------------------------------+
// | RELEASED UNDER THE EvB license:                                             |
// |    => Standard Attribution                                                  |
// |    => Limited Derivs                                                        |
// |    => Limited Translation                                                   |
// | MORE INFO HERE:                                                             |
// |    => http://www.everythingvb.com/licenses/sa-ld-lt/1.0/                    |
// +-----------------------------------------------------------------------------+
// | TABLE OF CONTENTS                                                           |
// |     1. CONFIGURATION: Config area, you should edit this area.               |
// |                                                                             |
// |     2. INTERPRETATION: Handles config, you should NOT edit ths area.        |
// |                                                                             |
// |     3. ADV. CONFIGURATION: Edit the SQL to use. You should only edit this   |
// |                            area if you know what your doing.                |
// |                                                                             |
// |     4. SCRIPT: The actual script. You should NOT edit this area.            |
// |                                                                             |
// |     5. MISC: Misc functions. You should NOT edit this area.                 |
// +-----------------------------------------------------------------------------+

/*********************************************************************************
 1. CONFIGURATION
     Each configuration value can be set to 'on', 'off', 1, 0, true or false.
         => 'on'    - Activated
         => 'off'   - Deactivated
         => 1       - Activated
         => 0       - Deactivated
         => true    - Activated
         => false   - Deactivated
     
     *_*_num: the number of values to retrieve.

     forum_ids: the forumid's of the forums you want to grab the latest threads
                from. You can set this to 'auto' to include all forums that the
                user has permission to see. Serparate each with a comma. Ex:
                    - '1,8,19,20'
                    - 'auto'
 *********************************************************************************/
$devbox_config = array( 'latest_threads'     => 'on',
                        'latest_threads_num' => 10,

                        'newest_members'     => 'on',
                        'newest_members_num' => 5,

                        'top_posters'        => 'on',
                        'top_posters_num'    => 5,

                        'online_today'       => 'on',

                        'forum_ids'          => '2,6,16,7,14,5,18,9,10,11,13,15',
                       );





/*********************************************************************************
 2. INTERPRETATION
     This section just interprets the config options, and ensures they're alright.
     You should skip this section and go onto #3 if you want.
 *********************************************************************************/
// Ensure all the right numbers are in place
$devbox_config['latest_threads_num'] = (int) $devbox_config['latest_threads_num'];
$devbox_config['newest_members_num'] = (int) $devbox_config['newest_members_num'];
$devbox_config['top_posters_num']    = (int) $devbox_config['top_posters_num'];

// Handle forum id's
if($devbox_config['forum_ids'] == 'auto')
{
    $devbox_config['forum_ids'] = array();

    foreach(array_keys($forumcache) AS $forumid)
    {
        $fp = &$bbuserinfo['forumpermissions']["$forumid"];
        if ($fp & CANVIEW AND $fp & CANVIEWOTHERS)
        {
            $devbox_config['forum_ids'][] = $forumid;
        }
    }

    $devbox_config['forum_ids'] = implode(',', $devbox_config['forum_ids']);
    unset($fp);
}

$TP = TABLE_PREFIX;





/*********************************************************************************
 3. ADVANCED CONFIGURATION
     These config values define what SQL should be used to grab the info from the
     database. Don't touch these if you don't know what your doing! You have
     to change these if you want information other then what is already
     provided. Use the variable $TP for table prefix if you don't want to get out
     of the quotes.
**********************************************************************************/
$devbox_config['latest_threads_sql'] = "### devbox_work.php - grabbing latest threads ###
                                        SELECT
                                            t.threadid, t.title, t.replycount, t.views, t.lastposter, t.postusername, t.postuserid,
                                            f.forumid, f.title AS forumtitle                                           
                                        FROM
                                            {$TP}thread t,
                                            {$TP}forum f
                                            LEFT JOIN {$TP}deletionlog AS del ON (del.primaryid = t.threadid AND del.type = 'thread')
                                        WHERE
                                            f.forumid = t.forumid
                                            AND f.forumid IN({$devbox_config['forum_ids']})
                                            AND t.visible = 1
                                            AND del.primaryid IS NULL
                                        ORDER BY t.threadid DESC
                                        LIMIT {$devbox_config['latest_threads_num']}";
                                        

$devbox_config['newest_members_sql'] = "### devbox_work.php - grabbing newest members ###
                                        SELECT
                                            u.userid, u.username, u.joindate, u.posts,
                                            g.opentag, g.closetag
                                        FROM
                                            {$TP}user u,
                                            {$TP}usergroup g
                                        WHERE
                                            g.usergroupid = u.usergroupid
                                        ORDER BY u.userid DESC
                                        LIMIT {$devbox_config['newest_members_num']}";

$devbox_config['top_posters_sql'] = "### devbox_work.php - grabbing top posters ###
                                     SELECT
                                         u.userid, u.username, u.posts,
                                         g.opentag, g.closetag
                                     FROM
                                         {$TP}user u,
                                         {$TP}usergroup g
                                     WHERE
                                         g.usergroupid = u.usergroupid
                                         ORDER BY u.posts DESC
                                         LIMIT {$devbox_config['top_posters_num']}";

$devbox_config['online_today_sql'] = "### devbox_work.php - grabbing online today ###
                                      SELECT
                                          u.userid, u.username, (u.options & {$_USEROPTIONS['invisible']}) AS invisible,
                                          g.opentag, g.closetag
                                      FROM
                                          {$TP}user u,
                                          {$TP}usergroup g
                                      WHERE
                                          g.usergroupid = u.usergroupid AND
                                          u.lastactivity >= " . (mktime(0, 0, 0) + (($bbuserinfo['timezoneoffset'] - $vboptions['timeoffset']) * 3600)) . "
                                      ORDER BY u.username ASC";





/*********************************************************************************
 4. SCRIPT
     You shouldn't need to edit anything below this!
 *********************************************************************************/

$devbox = array('latest_threads' => '',
                'newest_members' => '',
                'online_today'   => '',
                'top_posters'    => '',                
               );

//--------------------------------------------------------------------------------
// Grab the 'latest threads'
if(isOn('latest_threads'))
{
    $devbox_latest_threads = $DB_site->query($devbox_config['latest_threads_sql']);
    $devbox_config['latest_threads_num'] = $DB_site->num_rows($devbox_latest_threads);
    $devbox_counter = 0;

    if($devbox_config['latest_threads_num'] < 1)
    {
        $devbox['latest_threads'] = 'No threads.';
    }

    else
    {
        while($data = $DB_site->fetch_array($devbox_latest_threads))
        {
            $data['counter'] = ++$devbox_counter;
            eval('$devbox[\'latest_threads\'] .= "' . fetch_template('devbox-latest_threads_bit') . '";');
        }
    }

    $DB_site->free_result($devbox_latest_threads);
    unset($devbox_latest_threads, $devbox_counter, $data);
}

//--------------------------------------------------------------------------------
// Grab the 'lastest members'
if(isOn('newest_members'))
{
    $devbox_newest_members = $DB_site->query($devbox_config['newest_members_sql']);
    $devbox_config['newest_members_num'] = $DB_site->num_rows($devbox_newest_members);
    $devbox_counter = 0;

    while($data = $DB_site->fetch_array($devbox_newest_members))
    {
        $data['counter'] = ++$devbox_counter;
        $data['date']    = vbdate($vboptions['dateformat'], $data['joindate'], false, true, false);
        eval('$devbox[\'newest_members\'] .= "' . fetch_template('devbox-newest_members_bit') . '";');
    }
    
    $DB_site->free_result($devbox_newest_members);
    unset($devbox_newest_members, $devbox_counter, $data);
}

//--------------------------------------------------------------------------------
// Grab the 'online today'
if(isOn('online_today'))
{
    $devbox_online_today = $DB_site->query($devbox_config['online_today_sql']);
    $devbox_counter = 0;

    while($data = $DB_site->fetch_array($devbox_online_today))
    {
        $data['counter'] = ++$devbox_counter;

        if($data['invisible'])
        {
            if(!($permissions['genericpermissions'] & CANSEEHIDDEN))
                continue;
            else
                $data['invisible'] = '*';
        }

        else
            $data['invisible'] = '';

        eval('$devbox[\'online_today\'] .= "' . fetch_template('devbox-online_today_bit') . '";');
        $devbox['online_today'] .= ', ';
    }

    $devbox['online_today'] = substr($devbox['online_today'], 0, (strlen($devbox['online_today']) - 3));
    $devbox['online_today_num'] = $devbox_counter;

    $DB_site->free_result($devbox_online_today);
    unset($devbox_online_today, $devbox_counter, $data);

    ////////////////////

    if(!isset($datastore['maxonlinetoday']))
    {
        $devbox['online_today_max'] = $devbox['online_today_num'];
        $devbox['online_today_maxwhen'] = mktime();

        $devbox_ot['online_today_max'] = $devbox['online_today_max'];
        $devbox_ot['online_today_maxwhen'] = $devbox['online_today_maxwhen'];
        $devbox_ot = serialize($devbox_ot);

        $DB_site->query("### devbox_work.php - insert online today into datastore ###
                         INSERT INTO {$TP}datastore (title, data) VALUES ('maxonlinetoday', '$devbox_ot')");
    }

    else
    {
        $devbox_ot = unserialize($datastore['maxonlinetoday']);
        if($devbox_ot['online_today_max'] < $devbox['online_today_num'])
        {
            $devbox['online_today_max'] = $devbox['online_today_num'];
            $devbox['online_today_maxwhen'] = mktime();

            $devbox_ot['online_today_max'] = $devbox['online_today_max'];
            $devbox_ot['online_today_maxwhen'] = $devbox['online_today_maxwhen'];
            $devbox_ot = serialize($devbox_ot);

            $DB_site->query("### devbox_work.php - update online today ###
                             UPDATE {$TP}datastore SET data='$devbox_ot' WHERE title='maxonlinetoday'");
        }

        else
        {
            $devbox['online_today_max'] = $devbox_ot['online_today_max'];
            $devbox['online_today_maxwhen'] = $devbox_ot['online_today_maxwhen'];
        }
    }

    $devbox['online_today_maxwhen'] = vbdate($vboptions['dateformat'], $devbox['online_today_maxwhen'], true, true, false);
    unset($devbox_it);
}

//--------------------------------------------------------------------------------
// Grab the 'top posters'
if(isOn('top_posters'))
{
    $devbox_top_posters = $DB_site->query($devbox_config['top_posters_sql']);
    $devbox_config['top_posters_num'] = $DB_site->num_rows($devbox_top_posters);
    $devbox_counter = 0;

    while($data = $DB_site->fetch_array($devbox_top_posters))
    {
        $data['counter'] = ++$devbox_counter;
        eval('$devbox[\'top_posters\'] .= "' . fetch_template('devbox-top_posters_bit') . '";');
    }

    $DB_site->free_result($devbox_top_posters);
    unset($devbox_top_posters, $devbox_counter, $data);
}





/*********************************************************************************
 5. MISC
     Misc functions. You shouldnt edit this area.
 *********************************************************************************/
// check if config value to see if we should do something or not
function isOn($what)
{
    global $devbox_config;

    if(!isset($devbox_config["$what"]))
        return false;

    $val = $devbox_config["$what"];

    if(is_string($val))
        $val = strtolower($val);

    if($val === 'on' OR $val === 1 OR $val === true)
    {
        $devbox_config["$what"] = true;
        return true;
    }
    else
    {
        $devbox_config["$what"] = false;
        return false;
    }
}

?>
I hope some quick solution is given to me.

Thanks.
Reply With Quote
  #24  
Old 05-13-2004, 05:39 PM
paulomt1 paulomt1 is offline
 
Join Date: Nov 2001
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have istalled the hack but it not show like in your page???
I see the box's in the buttom not in the right of screen.
Reply With Quote
  #25  
Old 05-18-2004, 11:38 PM
moonclamp's Avatar
moonclamp moonclamp is offline
 
Join Date: May 2004
Location: London
Posts: 516
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am getting this error, I tried defining the forum numbers manually instead of 'auto' and that made no difference:

Fatal error: Call to a member function on a non-object in /domains/domainname-com/domainname/www_root/devbox_work.php on line 180
Reply With Quote
  #26  
Old 08-01-2004, 06:24 PM
WoodiE WoodiE is offline
 
Join Date: May 2002
Posts: 317
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Has the recent errors been fixed? What about making this show on the right hand side, I'd be very interested in this hack if instructions where provided to make it show on the right side.
Reply With Quote
  #27  
Old 08-02-2004, 04:15 PM
Wapture Wapture is offline
 
Join Date: Jul 2004
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I really need help with this, when I go to devbox_work.php it doesn't work but shows an error. Please help!
Reply With Quote
  #28  
Old 08-03-2004, 12:03 AM
apokphp apokphp is offline
 
Join Date: Nov 2002
Posts: 440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm getting an error similar to one mentioned before...unfortunately, that poster never provided the correction, so I don't know what I'm doing wrong here. I did get the same error, but I input the specific forum ID's, and it got rid of 2 errors.

I'm left with:
Fatal error: Call to a member function on a non-object in /home/myfamily/public_html/forums/devbox_work.php on line 180


My dev site: www.myfamilycorner.net/forums/

What would cause this error? This is my config:

PHP Code:
$devbox_config = array( 'latest_threads'     => 'on',
                        
'latest_threads_num' => 10,

                        
'newest_members'     => 'on',
                        
'newest_members_num' => 5,

                        
'top_posters'        => 'on',
                        
'top_posters_num'    => 5,

                        
'online_today'       => 'on',

                        
'forum_ids'          => '2,3,4',
                       ); 
Reply With Quote
  #29  
Old 08-03-2004, 06:53 PM
jamesk jamesk is offline
 
Join Date: Jan 2004
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

does the forumid # have to reflect exzaclty like on the site or can i provide 1, through 300;?
Reply With Quote
  #30  
Old 08-03-2004, 09:25 PM
Henry-RS's Avatar
Henry-RS Henry-RS is offline
 
Join Date: Mar 2002
Location: Chicago
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can I get a screen shot of the dullness that is this hack's default display?
Reply With Quote
  #31  
Old 08-04-2004, 09:13 AM
apokphp apokphp is offline
 
Join Date: Nov 2002
Posts: 440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This doesn't update the "latest threads" when someone posts in a thread...it only updates the list of actual new threads. How can we set it, so that it displays the threads w/ the latest posts?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:04 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09344 seconds
  • Memory Usage 2,348KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete