View Single Post
  #1  
Old 02-20-2005, 07:50 PM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 1st to tell me the answer wins a prize!

This is a mod I am trying to release to vb.org for users that have vbindex.
WAIT WAIT before you click back... what I am doing is a detailed mod. but one part I am stuck on. I want in the online users a flag to show up.
example :dead: <-pretend that is a flag.
:dead: T3media
:lick: Your name
:devious: his name.

This "flag" is sitting in the users profile field. (say 20)

Now I know already that:
PHP Code:
SELECT field20
FROM myvb3_userfield
WHERE userid 

where x is the user's id number will bring back the text that the flag is...
In this example it is the "dead" icon so it would just say dead.
but in the php I would have it set like $flag.gif which would print the flag that has the same name.

now vbindex wol code is as such....

PHP Code:
// ####################### PROCESS vBindex WOL ##########################
if ($vbindex['options'] & VBI_WOL) {
    
$online['datecut'] = TIMENOW $vboptions['cookietimeout'];
    
$buddies explode(' '$bbuserinfo['buddylist']);

    
$onlineusers $DB_site->query("
                        ## GET ONLINE USERS ##
                        SELECT user.username, (user.options & 
$_USEROPTIONS[invisible]) AS invisible,
                        user.usergroupid, session.userid, session.lastactivity,
                        IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
                        FROM "
.TABLE_PREFIX."session AS session
                        LEFT JOIN "
.TABLE_PREFIX."user AS user ON (user.userid = session.userid)
                        WHERE session.lastactivity > 
$online[datecut]
                        ORDER BY "
.iif($permissions['genericpermissions'] & CANSEEHIDDEN'invisible ASC, ')."username ASC");

    
$home['onlinetotal'] = 0;
    
$home['onlineguesttotal'] = 0;
    
$home['onlinemembertotal'] = 0;
    
$done = array();
    while(
$onlineuser $DB_site->fetch_array($onlineusers)) {

        if (
$onlineuser['userid'] && !$done["$onlineuser[userid]"]) {

            
$done["$onlineuser[userid]"] = true;

            
$home['onlinetotal']++;
            
$home['onlinemembertotal']++;

            
// do invisible users
            
if (($permissions['genericpermissions'] & CANSEEHIDDEN) && $onlineuser['invisible']) {
                
$onlineuser['invisiblemark'] = '*';
            } elseif (
$onlineuser['invisible']) {
                
$home['onlineguesttotal']++;
                
$home['onlinemembertotal']--;
                break 
1;
            }

            
// do buddies
            
if (in_array($onlineuser['userid'], $buddies)) {
                
$onlineuser['buddymark'] = '+';
            }

            
$onlineuser['musername'] = fetch_musername($onlineuser);
            eval(
"\$home[onlineusers] .= \", ".fetch_template('vbindex_onlineuser')."\";");

        } elseif (
$onlineuser['userid'] == 0) {
            
$home['onlineguesttotal']++;
            
$home['onlinetotal']++;
        }
    }

    if (
$vbindex['options'] & VBI_24WOL) {
        
// show users from the last 24 hours
        
$show['last24'] = true;
        unset(
$onlineuser);
        
$starttime mktime(000date('m'), date('d'), date('Y'));


        if (
$vbindex['options'] & VBI_24WOLUSER) {

            
// show user names and count
            
$show['last24user'] = true;

            
$fetchusers $DB_site->query("
                        ## USERS IN PAST 24HRS ##
                        SELECT username, userid, usergroupid,
                        (user.options & 
$_USEROPTIONS[invisible]) AS invisible,
                        IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
                        FROM "
.TABLE_PREFIX."user AS user
                        WHERE lastactivity >= 
$starttime
                        ORDER BY username ASC
            "
);

            while(
$onlineuser $DB_site->fetch_array($fetchusers)) {

                
$home['last24count']++;
                
$onlineuser['musername'] = fetch_musername($onlineuser);

                if ((
$permissions['genericpermissions'] & CANSEEHIDDEN) && $onlineuser['invisible']) {
                    
$onlineuser['invisiblemark'] = '*';
                } elseif (
$onlineuser['invisible']) {
                    
$onlineuser['musername'] = '';
                    
$home['last24count']--;
                }

                eval(
"\$home[last24] .= \", ".fetch_template('vbindex_onlineuser')."\";");
            }
            
// removed inital comma in online list
            
$home['last24'] = substr($home['last24'], 2);
            
// memory saving
            
unset($user);
            
$DB_site->free_result($fetchusers);

        } else {

            
// show count only
            
$show['last24user'] = false;
            
$onlinetoday $DB_site->query_first("  ## USERS IN LAST 24HRS COUNT ##
                                                    SELECT COUNT(*) AS count
                                                    FROM "
.TABLE_PREFIX."user
                                                    WHERE lastactivity >= 
$starttime
                                    "
);
            
$home['last24count'] = $onlinetoday['count'];
        }
    }

    
// removed inital comma in online list
    
$home['onlineusers'] = substr($home['onlineusers'], 2);
    eval(
"\$side[onlineusers] .= \"".fetch_template('vbindex_onlineusers')."\";");
    
// memory saving
    
unset($onlineuser$done$online$buddies);
    
$DB_site->free_result($onlineusers);

where you suggest I should put the small piece of code? I need help becuase I am not making progress.
Thank you!!!
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01220 seconds
  • Memory Usage 1,872KB
  • 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
  • (2)bbcode_php
  • (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