Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
diabluntd
Hangin' Around



Joined: Mar 19, 2004
Posts: 31

PostPosted: Thu Sep 30, 2004 11:35 am Reply with quote

I use popular User Info block on my site, although i've modded it a bit to work with the Site Messenger module but that's irrelevent. I'd like to make it so scroll bars could be put in for the "Online Now" area because sometimes there are 50-100+ names listed and it takes up a LOT of room. Here is a screenshot.

Image

Here is a link to the code of a default under_info block
http://www.diabluntd.com/randomshit/user-info.txt

Could someone out there help me out? I think I'd like to limit it to 20 people before it scrolls. An edited version of this with comment lines would be amazing! I have little to no php coding skills so i'm at a loss by myself. Thanks.
 
View user's profile Send private message
beetraham
Regular
Regular



Joined: Dec 13, 2003
Posts: 94
Location: Finland (EU)

PostPosted: Fri Oct 01, 2004 12:34 pm Reply with quote

Please find below inline a DHTML TABLE insertion based *table height constrained* workaround.

What basically happens due the presented block modification, is that your PHP-Nuke will utilize the original block structure as long as the number of ONLINE MEMBERS does not exceed (20).

Should the number of ONLINE MEMBERS exceed (20), in that case the *original* block structure will be replaced by an active use of *HEIGHT CONSTRAINED DHTML TABLE* containing the member information inside a scrollable DHTML table.

In case that there are no ONLINE MEMBERS, neither of the approaches will be used (this being 100% identical to original functionality).

I just tested this workaround with successful outcome.

*** beginning of workaround description ***


| ---> FIND ORIGINAL CODE:

---> (the bottom-most (4) lines of code)

Quote:

if ($member_online_num > 0) {
$content .= "<hr>\n<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
}
$content .= "</form>";

--->

| ---> REPLACE WITH FOLLOWING CODE
[this is a fully functional piece of code, but considered as a relic due to received enhancement request]

--->
Quote:

status : [non-valid, as per enhancement request on OCT-5TH-2004]

Quote:

if ($member_online_num > 0) {
if ($member_online_num < 21) {
$content .= "<hr>\n<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
} else {
$content .= "<DIV STYLE=\"overflow: auto; width: 150px; height: 150;
border-left: 0px gray solid; border-bottom: 0px gray solid;
border-right: 0px gray solid; border-top: 0px gray solid;
padding:0px; margin: 0px\">";
$content .= "<TABLE cellspacing=0 cellpadding=2>
<COL WIDTH=100><COL WIDTH=150><COL WIDTH=200>
<tr>
<td width=100% valign=\"top\" nowrap>";
$content .= "<hr>\n<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
$content .= " </td>
</tr>
</TABLE>";
}
}
$content .= "</form>";


[/color]
Quote:
colour code RED == "removed"
Notice : there apparently some overflow regarding the <COL> declarations, which however did not cause any issues related enhancement request. Still, the overflow declarations were removed as obsolete code relics.



| ---> REPLACE WITH FOLLOWING CODE [GIVEN SOLUTION OCT-5TH-2004]

Quote:

status : [valid as per request on OCT-5TH-2004]

Quote:

$content .= "<hr>\n";
if ($member_online_num > 0) {
if ($member_online_num < 21) {
$content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
} else {
$content .= "<DIV STYLE=\"overflow: auto; width: 140px; height: 150;
border-left: 0px gray solid; border-bottom: 0px gray solid;
border-right: 0px gray solid; border-top: 0px gray solid;
padding:0px; margin: 0px\">";
$content .= "<TABLE cellspacing=0 cellpadding=2> <COL WIDTH=140>
<tr>
<td width=100% valign=\"top\" nowrap>";
$content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
$content .= " </td>
</tr>
</TABLE>";
$content .= "</DIV>";
}
}
$content .= "</form>";
$content .= "<br><br>";
$content .= "<font color=\"#666666\" size=\"-2\"><b> Nuke's Dynamite!</font><br>";
$content .= "<font color=\"#969696\" size=\"-2\">";
$content .= date("F j, Y, g:i a");
$content .= "</font>";


Quote:

colour code ORANGE == "missing TAG"

Quote:

colour code BLUE == "added"/"value changed"

Quote:

colour code DARK BLUE == "optionally added code AFTER first closing the DHTML table"



Additional info:
Quote:

So, what performed was that the *horizontal line and the line break(s)* were removed from internal code parts to be instantiated earlier, this having an effect to get the *horizontal line* ivisualized higher in the block's active outlook.

Secondly, the DHTML table width of (150) pixels was reduced to (140) pixels - should this reduction not be enough from yours perspective, please try reducing it by iterative reduction at both *colour blue flavoured instances*.l

[as a third and final operation, the MISSING closing TAG was added to DHTML code struct - additionally, a piece of example code was provided along with it to *visualize* the proper placement of additional *$content* related sections]




--->

Should you wish to change the "DHTML TABLE" height in order to allow more members to be shown as a default [CASE: number of ONLINE MEMBERS exceed (20)], then please edit the following line regarding the declared table HEIGHT;


| ----> FIND AND EDIT THE NEXT LINE SUITABLE FOR YOUR PURPOSES:

Quote:
$content .= "<DIV STYLE=\"overflow: auto; width: 150px; height: 150;


Additionally, should you dislike the used decorative 1px border framing, then simply change the *1px* border width declarations to *0px* found in the following lines of code;


| ----> FIND AND EDIT THE NEXT LINES SUITABLE FOR YOUR PURPOSES:

Quote:
border-left: 1px gray solid; border-bottom: 1px gray solid;
border-right: 1px gray solid; border-top: 1px gray solid;


*** end of workaround description ***

Thanks,

BR,

-beetraham


Last edited by beetraham on Tue Oct 05, 2004 12:29 am; edited 8 times in total 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sun Oct 03, 2004 6:38 pm Reply with quote

Where can I get this block? I tried installing Raven's Site Info block and it doesn't look anything like what is on his site nor yours. I really like it.

TIA,
montego
 
View user's profile Send private message Visit poster's website
montego







PostPosted: Sun Oct 03, 2004 10:20 pm Reply with quote

My appologies, Raven, I downloaded the Who is Where block. Where can I get the Site Info block that is on your site and seemingly referred to above?
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Oct 03, 2004 10:54 pm Reply with quote

Try searching for 'Site Info' (w/o quotes) on the download page.
 
View user's profile Send private message
diabluntd







PostPosted: Mon Oct 04, 2004 2:23 pm Reply with quote

Thanks a bunch for the code! It's gotten me a lot further then i've gotten before but things still look a bit weird. I'm hoping you can help since i'm at a loss. I will continue to mess around but may need the help.

The scroll bar below... is there any way to make it start lower in the block? As you can see it seems a bit off. It also hangs out over the width of the block so is there any way to bring it in to it all fits inside the normal width of the block?

Image
 
beetraham







PostPosted: Mon Oct 04, 2004 4:07 pm Reply with quote

diabluntd wrote:
Thanks a bunch for the code! It's gotten me a lot further then i've gotten before but things still look a bit weird. I'm hoping you can help since i'm at a loss. I will continue to mess around but may need the help.

The scroll bar below... is there any way to make it start lower in the block? As you can see it seems a bit off. It also hangs out over the width of the block so is there any way to bring it in to it all fits inside the normal width of the block?



My thanks to you - glad you've found it as a "partially" successful quickhack.

Please see the added *quoted blue flavoured code section* in the 1st post by yours truly - it should provide you a substantially clear basis for performing the copy/paste modification resulting to requested enhancements - i.e. you should replace *the original code* with that lately provided piece of code.

Please let me know, in case that the latest code line-up does not provide an outcome considered to meet your needs from functionality/aesthetics point of view.

Your notices/remarks were excellent, I would have also needed those being present as well in case that I'd be actively using the block with performed modifications on it.

Thanks a lot,

BR,

-beetraham
 
diabluntd







PostPosted: Mon Oct 04, 2004 10:47 pm Reply with quote

wow. awesome man! ok, now i'm pushin it but i have ONE more thing. Smile
if i put any $content line after the two }'s and /form they show inside the scroll bars. i would think as long as it's outside the brackets, table, form, etc it should show below the horiztonal scroll bar but it's getting lumped in with it. any idea?
 
beetraham







PostPosted: Tue Oct 05, 2004 12:11 am Reply with quote

diabluntd wrote:
wow. awesome man! ok, now i'm pushin it but i have ONE more thing. Smile
if i put any $content line after the two }'s and /form they show inside the scroll bars. i would think as long as it's outside the brackets, table, form, etc it should show below the horiztonal scroll bar but it's getting lumped in with it. any idea?


What a marvellous findings - thanks a lot for your notice! Smile Very Happy

You were most sharp eyed with this matter - indeed, what you did expect was exactly the same that I would have expected myself too.

As a result of closer investigation, it showed up that there was a missing closing tag (</DIV>), which caused the browser to figure that the DHTML table is *still open* (that's how I understand it) - well, now it's closed. Embarassed

I have now marked the correction(s)/additions with following colour codes in the above original *code's post*:

colour code ORANGE == "added missing TAG"
colour code DARK BLUE == "additional code placement example (placeholder sections for additional content)

Let's see how things turn out now - it tested it locally with succesful outcome.

Thanks!

BR,

-beetraham


Last edited by beetraham on Tue Oct 05, 2004 1:27 am; edited 1 time in total 
Raven







PostPosted: Tue Oct 05, 2004 12:43 am Reply with quote

Great! Would someone please post the entire new block code using the code blocks?
 
beetraham







PostPosted: Tue Oct 05, 2004 12:52 am Reply with quote

Raven wrote:
Great! Would someone please post the entire new block code using the code blocks?


As per request, please find inline the *DHTML Table* added User Info Block structure.

The added code section has been tagged with colour code BLUE usage.

Please note that there are sections, as described in earlier postings, that will get replaced by the added code.

|------> BOI

<?php

/************************************************************/
/* Description.: User Info Block */
/* */
/* [dev.vers. "DHTML TABLE SECTION ADDED" - OCT-05th-2004] */
/* */
/* Version.....: v0.3.1 */
/* File Name...: block-User_Info.php */
/* Last Updated: 10 December 2003 */
/* */
/* Update Release - 19 Jan 2004 - chatserv */
/* Website [ Only registered users can see links on this board! Get registered or login! ] */
/* 19/01/2004 - Added Points Needed For Group Membership */
/* 19/01/2004 - Added Missing Language Definitions */
/* */
/* Updated for PHP-Nuke 7.x - 10 Dec 2003 - chatserv */
/* Website [ Only registered users can see links on this board! Get registered or login! ] */
/* 10/12/2003 - Added Point Total Display */
/* 10/12/2003 - Added Site Groups list w/ points needed */
/* */
/* Updated for PHP-Nuke 6.x - 22/07/2003 - NukeZone */
/* Website [ Only registered users can see links on this board! Get registered or login! ] */
/* 22/07/2003 - Added Security Check Image */
/* 22/07/2003 - Added User logout Link */
/* 22/07/2003 - Added Admin Logout - Visible to Admin Only */
/* ------------ */
/* Updated for PHP-Nuke 5.6 - 18 Jun 2002 NukeScripts */
/* website [ Only registered users can see links on this board! Get registered or login! ] */
/* ------------ */
/* Updated for PHP-Nuke 5.5 - 24/03/2002 Rugeri */
/* website [ Only registered users can see links on this board! Get registered or login! ] */
/* ------------ */
/* (C) 2002 */
/* All rights beyond the GPL are reserved */
/* */
/************************************************************/
/* Additional security checking code 2003 by chatserv */
/* [ Only registered users can see links on this board! Get registered or login! ] -- [ Only registered users can see links on this board! Get registered or login! ] */
/************************************************************/

if (eregi("block-User_Info.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
}

$content = "";

global $user, $admin, $cookie, $prefix, $user_prefix, $db, $anonymous, $sitekey;
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 10);
cookiedecode($user);
$uname = $cookie[1];

$lasturow = $db->sql_fetchrow($db->sql_query("SELECT username FROM $user_prefix"._users." ORDER BY user_id DESC LIMIT 0,1"));
$lastuser = $lasturow['username'];
$numrows = $db->sql_numrows($db->sql_query("SELECT user_id FROM $user_prefix"._users.""));

$result = $db->sql_query("SELECT uname, guest FROM $prefix"._session." WHERE guest='0'");
$member_online_num = $db->sql_numrows($result);
$who_online_now = "";
$i = 1;
while ($session = $db->sql_fetchrow($result)) {
if (isset($session["guest"]) and $session["guest"] == 0) {
if ($i < 10) {
$who_online_now .= "&nbsp;&nbsp;0$i:&nbsp;<A

HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$session[uname]\">$session[uname]</a><br>\n";
} else {
$who_online_now .= "&nbsp;&nbsp;$i:&nbsp;<A

HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$session[uname]\">$session[uname]</a><br>\n";
}
$who_online_now .= ($i != $member_online_num ? " " : "");
$i++;
}
}
$Today = getdate();
//Formatting Current Date
$month = $Today['month'];
$mday = $Today['mday'];
$year = $Today['year'];
//Formatting Previous Date
$pmonth = $Today['month'];
$pmday = $Today['mday'];
$pmday = $mday-1;
$pyear = $Today['year'];
//Month conversion into numeric mode
if ($pmonth=="January") { $pmonth=1; } else
if ($pmonth=="February") { $pmonth=2; } else
if ($pmonth=="March") { $pmonth=3; } else
if ($pmonth=="April") { $pmonth=4; } else
if ($pmonth=="May") { $pmonth=5; } else
if ($pmonth=="June") { $pmonth=6; } else
if ($pmonth=="July") { $pmonth=7; } else
if ($pmonth=="August") { $pmonth=8; } else
if ($pmonth=="September") { $pmonth=9; } else
if ($pmonth=="October") { $pmonth=10; } else
if ($pmonth=="November") { $pmonth=11; } else
if ($pmonth=="December") { $pmonth=12; };
$test = mktime (0,0,0,$pmonth,$pmday,$pyear,1);

//Creating SQL parameter
$curDate2 = "%".$month[0].$month[1].$month[2]."%".$mday."%".$year."%";
$preday = strftime ("%d",$test);
$premonth = strftime ("%B",$test);
$preyear = strftime ("%Y",$test);
$curDateP = "%".$premonth[0].$premonth[1].$premonth[2]."%".$preday."%".$preyear."%";

//Executing SQL Today
$row = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDate2'"));
$userCount = $row['userCount'];
//end

//Executing SQL Today
$row2 = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDateP'"));
$userCount2 = $row2['userCount'];
//end

$guest_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest='1'"));
$member_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest='0'"));

$who_online_num = $guest_online_num + $member_online_num;
$grpcnt = "";
$i = 1;
$gresult = $db->sql_query("SELECT name, points FROM " . $prefix . "_groups ORDER BY points");
while ($grow = $db->sql_fetchrow($gresult)) {
$grname = $grow['name'];
$grpoints = intval($grow['points']);
$users_num = $db->sql_numrows($db->sql_query("SELECT * FROM " . $user_prefix . "_users WHERE points>='$grpoints'"));
if ($i < 10) {
$grpcnt .= "&nbsp;&nbsp;<b>0$i:&nbsp;<u>$grname</u></b><br>&nbsp;&nbsp;"._NPOINTS.": <b>$grpoints</b><br>&nbsp;&nbsp;"._SGMEMBERS.":

<b>$users_num</b><br>\n";
} else {
$grpcnt .= "&nbsp;&nbsp;<b>$i:&nbsp;<u>$grname</u></b><br>&nbsp;&nbsp;"._SGMEMBERS.": <b>$users_num</b><br>\n";
}
$i++;
}
$numpoints = $db->sql_fetchrow($db->sql_query("SELECT points FROM ".$user_prefix."_users WHERE username='$uname'"));
$npoints = intval($numpoints['points']);
$content .= "<form action=\"account.html\" method=\"post\">";

if (is_user($user)) {
$content .= "<br><img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$uname</b>.<br>\n";

$content .= "<center>[ <a href=\"modules.php?name=Your_Account&amp;op=logout\">"._LOGOUT."</a> ]</center>\n";
if (is_admin($admin) AND is_user($user)) {
$content .= "<br><center>"._ADMIN."<br>[ <a href=\"admin.php?op=logout\">"._LOGOUT."</a> ]</center>\n";
}
$content .= "<hr>\n";
$row3 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM $user_prefix"._users." WHERE username='$uname'"));
$uid = $row3['user_id'];
$newpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='5'

OR privmsgs_type='1')"));
$oldpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND

privmsgs_type='0'"));
$content .= "<img src=\"images/blocks/email-y.gif\" height=\"10\" width=\"14\"> <a

href=\"messages.html\"><b>"._BPM."</b></a><br>\n";
$content .= "<img src=\"images/blocks/email-r.gif\" height=\"10\" width=\"14\"> "._BUNREAD.": <b>$newpms</b><br>\n";
$content .= "<img src=\"images/blocks/email-g.gif\" height=\"10\" width=\"14\"> "._BREAD.": <b>$oldpms</b><br>\n<hr>\n";
$content .= "<img src=\"images/blocks/icon_poll.gif\" height=\"14\" width=\"17\">

<b><u>"._TPOINTS.":</u></b><br>&nbsp;&nbsp;<b><strong><big>&middot;</big></strong>&nbsp;".$npoints."&nbsp;<strong><big>&middot;</big></strong></b><hr>\n";
} else {
$content .= "<center><img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$anonymous</b>\n<hr>";
$content .= ""._NICKNAME."<br><input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"><br>";
$content .= ""._PASSWORD."<br><input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\"><br>";
if (extension_loaded("gd")) {
$content .= ""._SECURITYCODE.": <img src='modules.php?name=Your_Account&op=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."'

title='"._SECURITYCODE."'><br>\n";
$content .= ""._TYPESECCODE."<br><input type=\"text\" NAME=\"gfx_check\" SIZE=\"7\" MAXLENGTH=\"6\">\n";
$content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\"><br>\n";
} else {
$content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">";
$content .= "<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">";
}
$content .= "<input type=\"hidden\" name=\"op\" value=\"login\">";

$content .= "<input type=\"submit\" value=\""._LOGIN."\">\n (<a

href=\"forums.html?file=profile&mode=register\">"._BREG."</a>)</center><hr>";
}
$content .= "<img src=\"images/blocks/icon_members.gif\" height=\"14\" width=\"17\"> <b><u>"._SITEGROUPS.":</u></b><br>$grpcnt<hr>\n";
$content .= "<img src=\"images/blocks/group-2.gif\" height=\"14\" width=\"17\"> <a

href=\"members.html\"><b><u>"._BMEMP.":</u></b></a><br>\n";
$content .= "<img src=\"images/blocks/ur-moderator.gif\" height=\"14\" width=\"17\"> "._BLATEST.": <A

HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$lastuser\"><b>$lastuser</b></a><br>\n";
$content .= "<img src=\"images/blocks/ur-author.gif\" height=\"14\" width=\"17\"> "._BTD.": <b>$userCount</b><br>\n";
$content .= "<img src=\"images/blocks/ur-admin.gif\" height=\"14\" width=\"17\"> "._BYD.": <b>$userCount2</b><br>\n";
$content .= "<img src=\"images/blocks/ur-guest.gif\" height=\"14\" width=\"17\"> "._BOVER.": <b>$numrows</b><br>\n<hr>\n";
$content .= "<img src=\"images/blocks/group-3.gif\" height=\"14\" width=\"17\"> <b><u>"._BVISIT.":</u></b>\n<br>\n";
$content .= "<img src=\"images/blocks/ur-anony.gif\" height=\"14\" width=\"17\"> "._BVIS.": <b>$guest_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/ur-member.gif\" height=\"14\" width=\"17\"> "._BMEM.": <b>$member_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/ur-registered.gif\" height=\"14\" width=\"17\"> "._BTT.": <b>$who_online_num</b><br>\n";
$content .= "<hr>\n";
if ($member_online_num > 0) {
if ($member_online_num < 21) {
$content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
} else {
$content .= "<DIV STYLE=\"overflow: auto; width: 140px; height: 150;
border-left: 0px gray solid; border-bottom: 0px gray solid;
border-right: 0px gray solid; border-top: 0px gray solid;
padding:0px; margin: 0px\">";
$content .= "<TABLE cellspacing=0 cellpadding=2> <COL WIDTH=140><tr><td width=100% valign=\"top\" nowrap>";
$content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
$content .= " </td></tr></TABLE>";
$content .= "</DIV>";
}

}
$content .= "</form>";
?>

|------> EOI



BR,

-beetraham
 
diabluntd







PostPosted: Tue Dec 07, 2004 7:40 pm Reply with quote

ok, another big favor to ask of you gurus.
as you can see from the photo below my userinfo block (the same i posted about above) "online now" section is lacking the ability to cut off usernames longer then certain characters. Instead it's extending the area and pushing the whole main side of my side in a bit to the right (hopefully visible in the picture). Any idea on how i can cut off characters after a certain amount?

Image
 
Raven







PostPosted: Tue Dec 07, 2004 8:41 pm Reply with quote

Find this code
Code:
while ($session = $db->sql_fetchrow($result)) { 

if (isset($session["guest"]) and $session["guest"] == 0) {
if ($i < 10) {
$who_online_now .= "&nbsp;&nbsp;0$i:&nbsp;<A

HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$session[uname]\">$session[uname]</a><br>\n";
} else {
$who_online_now .= "&nbsp;&nbsp;$i:&nbsp;<A

HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$session[uname]\">$session[uname]</a><br>\n";
}
$who_online_now .= ($i != $member_online_num ? " " : "");
$i++;
}
}

and change it to
Code:
$shortLength = 15;  //make this whatever length you want

while ($session = $db->sql_fetchrow($result)) {
if (isset($session["guest"]) and $session["guest"] == 0) {
$shortName = substr($session['uname'],0,$shortLength);
if ($i < 10) {
$who_online_now .= "&nbsp;&nbsp;0$i:&nbsp;<A

HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$session[uname]\">$shortName</a><br>\n";
} else {
$who_online_now .= "&nbsp;&nbsp;$i:&nbsp;<A

HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$session[uname]\">$shortName</a><br>\n";
}
$who_online_now .= ($i != $member_online_num ? " " : "");
$i++;
}
}


Last edited by Raven on Wed Dec 08, 2004 12:00 pm; edited 1 time in total 
diabluntd







PostPosted: Wed Dec 08, 2004 10:48 am Reply with quote

thx for the reply but when i use that code the usernames don't show up at all next to the numbers now. So, if there's 4 people online it just shows

01:
02:
03:
04:

*edit - i'm not sure if it has to do with my modified version of this file though. i linked the contents of it above. maybe that has something to do with it. i know the A HREF links in mine are changed from pointing to the Your_Account module but that's no big deal for me to work around.

*edit #2 - think i got it.

Code:
$shortName = substr($session['name'],0,$shortLength);

needed to be
Code:
$shortName = substr($session['uname'],0,$shortLength);
 
Raven







PostPosted: Wed Dec 08, 2004 11:59 am Reply with quote

Sorry! That was a typo. I have corrected my post also.
 
diabluntd







PostPosted: Wed Dec 08, 2004 12:40 pm Reply with quote

Thanks a bunch man. I also adapted the code to work with the area that says
"Welcome,
________."

where___ is the username. that was pushing it out also (obviously only for that user since it's displaying their name) but now i'm totally good to go. you rule!
 
Trubador
Regular
Regular



Joined: Dec 28, 2004
Posts: 94

PostPosted: Wed Feb 02, 2005 3:34 pm Reply with quote

Just wondering Raven, is there anyway of combining this into your own User_info block?
I'd like to limit the level to 10 before it starts scrolling and I cant seem to incorporate this code into your block.

Cheers

Trub
 
View user's profile Send private message
Trubador







PostPosted: Fri Feb 04, 2005 7:50 am Reply with quote

Wow..... I cant believe I did it.... simple for you guys, but hey, a big step for me. I just removed the
Code:
   if ($member_online_num > 0 || is_admin($admin)) {

      $content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\" align=\"middle\"> <b><u>"._BON.":</u></b><br />$who_online_now";
      $hr = "\n<hr noshade>\n";
   }


and replaced with
Code:
if ($member_online_num > 0 || is_admin($admin)) { 

if ($member_online_num < 11) {
$content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
} else {
$content .= "<DIV STYLE=\"overflow: auto; width: 150px; height: 160;
border-left: 0px gray solid; border-bottom: 0px gray solid;
border-right: 0px gray solid; border-top: 0px gray solid;
padding:0px; margin: 0px\">";
$content .= "<TABLE cellspacing=0 cellpadding=2> <COL WIDTH=150><tr><td width=100% valign=\"top\" nowrap>";
$content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now\n";
$content .= " </td></tr></TABLE>";
$content .= "</DIV>";
}
      $hr = "\n<hr noshade>\n";
}


Im off to give myself a big star to wear.... lol

This is for Ravens User_info block.
Thanks Raven and beetraham for the incentive.
Hope you dont mind me altering your work m8.
 
Trubador







PostPosted: Mon Nov 12, 2007 6:27 am Reply with quote

Update for Ravens block-User_Info.php version 2.2.2 (comes packed with RavenNuke 2.10.01)


Replace
Code:
    if ($member_online_num > 0 OR is_admin($admin)) {

        $content .= '<img src="images/blocks/group-1.gif" height="14" width="17" align="middle" alt="" /> <b><u>'._BON.':</u></b><br />'.$who_online_now;
        $hr = "\n".'<hr noshade="noshade" />'."\n";
    }


with

Code:
/***** Scrolling hack *****/

if ($member_online_num > 0 OR is_admin($admin)) {
if ($member_online_num < 9) {
        $content .= '<img src="images/blocks/group-1.gif" height="14" width="17" align="middle" alt="" /> <b><u>'._BON.':</u></b><br />'.$who_online_now;
} else {
$content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br />\n";
$content .= "<div STYLE=\"overflow: auto; height: 152px; border-left: 0px gray solid; border-bottom: 0px gray solid;
border-right: 0px gray solid; border-top: 0px gray solid;
padding:0px; margin: 0px\">";
$content .= "<table cellspacing=0 cellpadding=2><tr><td width=100% valign=\"top\" nowrap>";
$content .= "\n$who_online_now\n";
$content .= " </td></tr></table>";
$content .= "</div>";
}
      $hr = "\n<hr noshade>\n";
}
/***** End Scrolling hack *****/


Edit
Code:
$member_online_num < 9

to activate the scroll at a certain membership point. Default to 9 (will activate when member level hits 10) eg <15 it will activate when members online reach 16.

Edit
Code:
height: 152px;

to adjust the box height for the scroll to suit your theme.

I think this is W3C compliant.

Any feedback most welcome Smile

TTFN

Trub
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©