Link to home
Create AccountLog in
Avatar of xboxfun
xboxfun

asked on

How can i add color?

How can i span the color for field3 on my php page withought it screwing up with php errors.

Ive tried putting the color code in all sorts, from html - php code.
Here is my code. I need to make field3 appear red


                $fil = $db->query_read_slave("SELECT field3 FROM `userfield` WHERE userid = '{$loggedin['userid']}'");
                  $fil = $db->fetch_array($fil);

                  $loggedin['field3'] = $fil['field3'];
                  $numbervisible++;
                  $show['comma_leader'] = ($activeusers !=  '');
Avatar of Slimshaneey
Slimshaneey
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you show your frontend code that outputs the field3?

In general, you could use CSS, in this case inline using a span or some other element like so:

<span style="color: red"><?php echo $loggedin['field3']; ?></span>

Open in new window

Alternately, to using red, use #FF0000
Avatar of xboxfun
xboxfun

ASKER

sorry i shoudl have said, its vbulliten whoisonline mod, its forum.php
Ah, sorry, cant help you there!
Avatar of xboxfun

ASKER

full code, please can you show me where to input the color code, cheers




/////////////////
// ### LOGGED IN USERS #################################################
$activeusers = '';
if (($vbulletin->options['displayloggedin'] == 1 OR $vbulletin->options['displayloggedin'] == 2 OR ($vbulletin->options['displayloggedin'] > 2 AND $vbulletin->userinfo['userid'])) AND !$show['search_engine'])
{
      $datecut = TIMENOW - $vbulletin->options['cookietimeout'];
      $numbervisible = 0;
      $numberregistered = 0;
      $numberguest = 0;

      $hook_query_fields = $hook_query_joins = $hook_query_where = '';
      ($hook = vBulletinHook::fetch_hook('forumhome_loggedinuser_query')) ? eval($hook) : false;

      $forumusers = $db->query_read_slave("
            SELECT
                  user.username, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, user.usergroupid, user.lastvisit,
                  session.userid, session.inforum, session.lastactivity, session.badlocation,
                  IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
                  $hook_query_fields
            FROM " . TABLE_PREFIX . "session AS session
            LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)
            $hook_query_joins
            WHERE session.lastactivity > $datecut
                  AND (user.usergroupid NOT IN (3,4) OR user.usergroupid IS NULL)
                  $hook_query_where
            " . iif($vbulletin->options['displayloggedin'] == 1 OR $vbulletin->options['displayloggedin'] == 3, "ORDER BY username ASC") . "
      ");



      if ($vbulletin->userinfo['userid'])
      {
            // fakes the user being online for an initial page view of index.php
            $vbulletin->userinfo['joingroupid'] = iif($vbulletin->userinfo['displaygroupid'], $vbulletin->userinfo['displaygroupid'], $vbulletin->userinfo['usergroupid']);
            $userinfos = array
            (
                  $vbulletin->userinfo['userid'] => array
                  (
                        'userid'            =>& $vbulletin->userinfo['userid'],
                        'username'          =>& $vbulletin->userinfo['username'],
                        'invisible'         =>& $vbulletin->userinfo['invisible'],
                        'inforum'           => 0,
                        'lastactivity'      => TIMENOW,
                        'lastvisit'         =>& $vbulletin->userinfo['lastvisit'],
                        'usergroupid'       =>& $vbulletin->userinfo['usergroupid'],
                        'displaygroupid'    =>& $vbulletin->userinfo['displaygroupid'],
                        'infractiongroupid' =>& $vbulletin->userinfo['infractiongroupid'],
                  )
            );
      }
      else
      {
            $userinfos = array();
      }
      $inforum = array();

      while ($loggedin = $db->fetch_array($forumusers))
      {
            $userid = $loggedin['userid'];
            if (!$userid)
            {      // Guest
                  $numberguest++;
                  if (!isset($inforum["$loggedin[inforum]"]))
                  {
                        $inforum["$loggedin[inforum]"] = 0;
                  }
                  if (!$loggedin['badlocation'])
                  {
                        $inforum["$loggedin[inforum]"]++;
                  }
            }
            else if (empty($userinfos["$userid"]) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity']))
            {
                  $userinfos["$userid"] = $loggedin;
            }
      }

      if (!$vbulletin->userinfo['userid'] AND $numberguest == 0)
      {
            $numberguest++;
      }

      foreach ($userinfos AS $userid => $loggedin)
      {
            $numberregistered++;
            if ($userid != $vbulletin->userinfo['userid'] AND !$loggedin['badlocation'])
            {
                  if (!isset($inforum["$loggedin[inforum]"]))
                  {
                        $inforum["$loggedin[inforum]"] = 0;
                  }
                  $inforum["$loggedin[inforum]"]++;
            }
            fetch_musername($loggedin);
      
            ($hook = vBulletinHook::fetch_hook('forumhome_loggedinuser')) ? eval($hook) : false;

            if (fetch_online_status($loggedin))
            {

                  
                $fil = $db->query_read_slave("SELECT field3 FROM `userfield` WHERE userid = '{$loggedin['userid']}'");
                  $fil = $db->fetch_array($fil);

                  $loggedin['field3'] = $fil['field3'];
                  $numbervisible++;
                  $show['comma_leader'] = ($activeusers !=  '');
                  $templater = vB_Template::create('forumhome_loggedinuser');
                  $templater->register('loggedin', $loggedin);
                  $activeusers .= $templater->render ();
            }
      }

      // memory saving
      unset($userinfos, $loggedin);

      $db->free_result($forumusers);

      $totalonline = $numberregistered + $numberguest;
      $numberinvisible = $numberregistered - $numbervisible;

      // ### MAX LOGGEDIN USERS ################################
      if (intval($vbulletin->maxloggedin['maxonline']) <= $totalonline)
      {
            $vbulletin->maxloggedin['maxonline'] = $totalonline;
            $vbulletin->maxloggedin['maxonlinedate'] = TIMENOW;
            build_datastore('maxloggedin', serialize($vbulletin->maxloggedin), 1);
      }

      $recordusers = vb_number_format($vbulletin->maxloggedin['maxonline']);
      $recorddate = vbdate($vbulletin->options['dateformat'], $vbulletin->maxloggedin['maxonlinedate'], true);
      $recordtime = vbdate($vbulletin->options['timeformat'], $vbulletin->maxloggedin['maxonlinedate']);

      $show['loggedinusers'] = true;
}
else
{
      $show['loggedinusers'] = false;
}

// ### GET FORUMS & MODERATOR iCACHES ########################
cache_ordered_forums(1, 1);
if ($vbulletin->options['showmoderatorcolumn'])
{
      cache_moderators();
}
else if ($vbulletin->userinfo['userid'])
{
      cache_moderators($vbulletin->userinfo['userid']);
}

// define max depth for forums display based on $vbulletin->options[forumhomedepth]
define('MAXFORUMDEPTH', $vbulletin->options['forumhomedepth']);

$forumbits = construct_forum_bit($forumid);
$forumhome_markread_script = vB_Template::create('forumhome_markread_script')->render();
//////////////////
ASKER CERTIFIED SOLUTION
Avatar of Slimshaneey
Slimshaneey
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
From the code, I can see in this about half way down:

forumhome_loggedinuser

Thats the name of the template that would need to be modified, so you would need to also post the contents of that, and I may be able to help!
Avatar of xboxfun

ASKER

A