About
Pricing
Community
Teams
Start Free Trial
Log in
xboxfun
asked on
7/6/2012
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("SEL
ECT field3 FROM `userfield` WHERE userid = '{$loggedin['userid']}'");
$fil = $db->fetch_array($fil);
$loggedin['field3'] = $fil['field3'];
$numbervisible++;
$show['comma_leader'] = ($activeusers != '');
PHP
MySQL Server
HTML
8
1
Last Comment
xboxfun
8/22/2022 - Mon
Slimshaneey
7/6/2012
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>
Select all
Open in new window
Slimshaneey
7/6/2012
Alternately, to using red, use #FF0000
xboxfun
7/6/2012
ASKER
sorry i shoudl have said, its vbulliten whoisonline mod, its forum.php
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Slimshaneey
7/6/2012
Ah, sorry, cant help you there!
xboxfun
7/6/2012
ASKER
full code, please can you show me where to input the color code, cheers
/////////////////
// ### LOGGED IN USERS ##########################
##########
##########
###
$activeusers = '';
if (($vbulletin->options['dis
playlogged
in'] == 1 OR $vbulletin->options['displ
ayloggedin
'] == 2 OR ($vbulletin->options['disp
layloggedi
n'] > 2 AND $vbulletin->userinfo['user
id'])) AND !$show['search_engine'])
{
$datecut = TIMENOW - $vbulletin->options['cooki
etimeout']
;
$numbervisible = 0;
$numberregistered = 0;
$numberguest = 0;
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook(
'forumhome
_loggedinu
ser_query'
)) ? eval($hook) : false;
$forumusers = $db->query_read_slave("
SELECT
user.username, (user.options & " . $vbulletin->bf_misc_userop
tions['inv
isible'] . ") 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['d
isplaylogg
edin'] == 1 OR $vbulletin->options['displ
ayloggedin
'] == 3, "ORDER BY username ASC") . "
");
if ($vbulletin->userinfo['use
rid'])
{
// fakes the user being online for an initial page view of index.php
$vbulletin->userinfo['join
groupid'] = iif($vbulletin->userinfo['
displaygro
upid'], $vbulletin->userinfo['disp
laygroupid
'], $vbulletin->userinfo['user
groupid'])
;
$userinfos = array
(
$vbulletin->userinfo['user
id'] => array
(
'userid' =>& $vbulletin->userinfo['user
id'],
'username' =>& $vbulletin->userinfo['user
name'],
'invisible' =>& $vbulletin->userinfo['invi
sible'],
'inforum' => 0,
'lastactivity' => TIMENOW,
'lastvisit' =>& $vbulletin->userinfo['last
visit'],
'usergroupid' =>& $vbulletin->userinfo['user
groupid'],
'displaygroupid' =>& $vbulletin->userinfo['disp
laygroupid
'],
'infractiongroupid' =>& $vbulletin->userinfo['infr
actiongrou
pid'],
)
);
}
else
{
$userinfos = array();
}
$inforum = array();
while ($loggedin = $db->fetch_array($forumuse
rs))
{
$userid = $loggedin['userid'];
if (!$userid)
{ // Guest
$numberguest++;
if (!isset($inforum["$loggedi
n[inforum]
"]))
{
$inforum["$loggedin[inforu
m]"] = 0;
}
if (!$loggedin['badlocation']
)
{
$inforum["$loggedin[inforu
m]"]++;
}
}
else if (empty($userinfos["$userid
"]) OR ($userinfos["$userid"]['la
stactivity
'] < $loggedin['lastactivity'])
)
{
$userinfos["$userid"] = $loggedin;
}
}
if (!$vbulletin->userinfo['us
erid'] AND $numberguest == 0)
{
$numberguest++;
}
foreach ($userinfos AS $userid => $loggedin)
{
$numberregistered++;
if ($userid != $vbulletin->userinfo['user
id'] AND !$loggedin['badlocation'])
{
if (!isset($inforum["$loggedi
n[inforum]
"]))
{
$inforum["$loggedin[inforu
m]"] = 0;
}
$inforum["$loggedin[inforu
m]"]++;
}
fetch_musername($loggedin)
;
($hook = vBulletinHook::fetch_hook(
'forumhome
_loggedinu
ser')) ? eval($hook) : false;
if (fetch_online_status($logg
edin))
{
$fil = $db->query_read_slave("SEL
ECT 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('forum
home_logge
dinuser');
$templater->register('logg
edin', $loggedin);
$activeusers .= $templater->render ();
}
}
// memory saving
unset($userinfos, $loggedin);
$db->free_result($forumuse
rs);
$totalonline = $numberregistered + $numberguest;
$numberinvisible = $numberregistered - $numbervisible;
// ### MAX LOGGEDIN USERS ##########################
######
if (intval($vbulletin->maxlog
gedin['max
online']) <= $totalonline)
{
$vbulletin->maxloggedin['m
axonline']
= $totalonline;
$vbulletin->maxloggedin['m
axonlineda
te'] = TIMENOW;
build_datastore('maxlogged
in', serialize($vbulletin->maxl
oggedin), 1);
}
$recordusers = vb_number_format($vbulleti
n->maxlogg
edin['maxo
nline']);
$recorddate = vbdate($vbulletin->options
['dateform
at'], $vbulletin->maxloggedin['m
axonlineda
te'], true);
$recordtime = vbdate($vbulletin->options
['timeform
at'], $vbulletin->maxloggedin['m
axonlineda
te']);
$show['loggedinusers'] = true;
}
else
{
$show['loggedinusers'] = false;
}
// ### GET FORUMS & MODERATOR iCACHES ########################
cache_ordered_forums(1, 1);
if ($vbulletin->options['show
moderatorc
olumn'])
{
cache_moderators();
}
else if ($vbulletin->userinfo['use
rid'])
{
cache_moderators($vbulleti
n->userinf
o['userid'
]);
}
// define max depth for forums display based on $vbulletin->options[forumh
omedepth]
define('MAXFORUMDEPTH', $vbulletin->options['forum
homedepth'
]);
$forumbits = construct_forum_bit($forum
id);
$forumhome_markread_script
= vB_Template::create('forum
home_markr
ead_script
')->render
();
//////////////////
ASKER CERTIFIED SOLUTION
Slimshaneey
7/6/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Slimshaneey
7/6/2012
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!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
xboxfun
7/6/2012
ASKER
A
In general, you could use CSS, in this case inline using a span or some other element like so:
Open in new window