Home
>
Outdated forums
>
Phorum 3 forums (READ ONLY)
>
Finished Mods and Plug-ins (READ ONLY)
>
Topic
Display moderators for the forum
Posted by easyexpat
Display moderators for the forum June 14, 2003 07:32AM |
Registered: 20 years ago Posts: 10 |
Hi,
I wrote a simple function to display the list of moderators for each forum.
Tested on Phorum 3.4.3a - index.php
-------------------
in the if(!$rec["folder"]){ section about line 150
-----------------
//MODIF->Add list of moderators
$pho_mod = $PHORUM['mod_table'];
$sSQL="Select moderation from $pho_main where id=$num";
$mq = new query($DB, $sSQL);
$mrec=$mq->getrow();
$mod=$mrec["moderation"];
if($mod != "n")
{
$modnames = "";
$sSQL="SELECT user_id FROM $pho_mod WHERE forum_id=$num";
$mq= new query($DB, $sSQL);
$i=0;
$sep = "";
while($mrec=$mq->getrow())
{
$i++;
$pho_auth = $PHORUM['auth_table'];
$modo_id = $mrec['user_id'];
$sSQL = "SELECT username from $pho_auth WHERE id=$modo_id";
$zq = new query($DB, $sSQL);
$zrec=$zq->getrow();
$modo_name = $zrec["username"];
if ($i > 1)
$sep = ", ";
$modnames .= $sep."<a href='profile.$ext?f=$num&id=$modo_id$GetVars'>$modo_name</a>";
}
}
------------------
And about line 220 in the text:
------------------
<!--MODIF: display the moderators-->
<?php
if(!empty($modnames))
{
?>
<tr>
<td colspan=3 bgcolor="<?php echo $table_body_color_1; ?>"><FONT color="<?php echo $ForumNavFontColor; ?>"><blockquote><?php echo $lModerator; ?>: <b><?php echo $modnames ?><b></blockquote></font></td>
</tr>
<?php
}
Post Edited (06-14-03 07:07)
I wrote a simple function to display the list of moderators for each forum.
Tested on Phorum 3.4.3a - index.php
-------------------
in the if(!$rec["folder"]){ section about line 150
-----------------
//MODIF->Add list of moderators
$pho_mod = $PHORUM['mod_table'];
$sSQL="Select moderation from $pho_main where id=$num";
$mq = new query($DB, $sSQL);
$mrec=$mq->getrow();
$mod=$mrec["moderation"];
if($mod != "n")
{
$modnames = "";
$sSQL="SELECT user_id FROM $pho_mod WHERE forum_id=$num";
$mq= new query($DB, $sSQL);
$i=0;
$sep = "";
while($mrec=$mq->getrow())
{
$i++;
$pho_auth = $PHORUM['auth_table'];
$modo_id = $mrec['user_id'];
$sSQL = "SELECT username from $pho_auth WHERE id=$modo_id";
$zq = new query($DB, $sSQL);
$zrec=$zq->getrow();
$modo_name = $zrec["username"];
if ($i > 1)
$sep = ", ";
$modnames .= $sep."<a href='profile.$ext?f=$num&id=$modo_id$GetVars'>$modo_name</a>";
}
}
------------------
And about line 220 in the text:
------------------
<!--MODIF: display the moderators-->
<?php
if(!empty($modnames))
{
?>
<tr>
<td colspan=3 bgcolor="<?php echo $table_body_color_1; ?>"><FONT color="<?php echo $ForumNavFontColor; ?>"><blockquote><?php echo $lModerator; ?>: <b><?php echo $modnames ?><b></blockquote></font></td>
</tr>
<?php
}
Post Edited (06-14-03 07:07)
me
Re: Display moderators for the forum July 24, 2003 09:40AM |
Re: Display moderators for the forum August 01, 2003 04:39PM |
Registered: 20 years ago Posts: 10 |
I attached the file to the post.
Because I've done some URL rewriting and other changes, you will see other comments. Just ignore them and focus on the comments for moderators (the line number is not always correct because lines moved when I make the changes, but it gives you an idea where to look at).
In addition in your lang file I added the variable: $lModeratorp = "Moderators"; for the plurial of moderator when needed.
If you want to see the results go to my forum: [www.easyexpat.com]
Cyril
Because I've done some URL rewriting and other changes, you will see other comments. Just ignore them and focus on the comments for moderators (the line number is not always correct because lines moved when I make the changes, but it gives you an idea where to look at).
In addition in your lang file I added the variable: $lModeratorp = "Moderators"; for the plurial of moderator when needed.
If you want to see the results go to my forum: [www.easyexpat.com]
Cyril
Have 3.4.5, but I couldn't find the proper things to put that in...could you email me your index.php file, and I can test it that way, and if it works, I'll use it? Email is cliekid@the-barracks.org . Thanks!
Re: Display moderators for the forum January 01, 2004 05:12PM |
Re: Display moderators for the forum February 06, 2004 07:03AM |
Hi,
I'm going to install it with 3.4.6., but when I look at your site I see a cool Who's online hack...is it possible to send also that code ?
I mean this one : [www.easyexpat.com]
grtz,
sammy
I'm going to install it with 3.4.6., but when I look at your site I see a cool Who's online hack...is it possible to send also that code ?
I mean this one : [www.easyexpat.com]
grtz,
sammy
Re: Display moderators for the forum February 07, 2004 05:26AM |
Re: Display moderators for the forum February 07, 2004 05:43AM |
Registered: 20 years ago Posts: 10 |
Re: Display moderators for the forum February 07, 2004 02:09PM |
Re: Display moderators for the forum February 14, 2004 06:59AM |
Registered: 20 years ago Posts: 10 |
Hi,
Sorry to be so long to answer but we had tremendous problems with our hosting provider and finally it was fixed by ...changing to an new one hopefully more relliable on a dedicated server.
The code for the Who's on line has been given by Vulpes here: [phorum.org].
The only thing that I did is to change it a bit to make it similar to phpBB.
You will find attached my index.php with the functions.
In addition at the same level I've got the Whosonline.php and callscript.php.
Eventually you need to had in your include/footer.php the following:
======
footer.php
======
<?php
//MODIF-> add the whoisoline plugin
include "callscript.php";
?>
=======
Of course you need also to modify your lang scritps, with additional variable. I give an example in english:
======
langen.php
=======
$lWho_title = "Who is Online?";
$lWho_nbposts1 = "Our users have posted a total of";
$lWho_nbposts2 = "messages";
$lWho_nbuser1 = "We have";
$lWho_nbuser2 = "registered users";
$lWho_newest = "The newest registered user is";
$lWho_on1 = "In total there are";
$lWho_on2 = "users online :: ";
$lWho_on3 = "Registered,";
$lWho_on4 = "Guests";
$lWho_most = "Most users ever online at the same time was";
$lWho_reg = "Registered Users:";
$lWho_elapsed = "This data is based on users active over the past 3 minutes";
==========
Voila, I think that's it.
Good luck
Cyril
Post Edited (02-14-04 05:59)
Sorry to be so long to answer but we had tremendous problems with our hosting provider and finally it was fixed by ...changing to an new one hopefully more relliable on a dedicated server.
The code for the Who's on line has been given by Vulpes here: [phorum.org].
The only thing that I did is to change it a bit to make it similar to phpBB.
You will find attached my index.php with the functions.
In addition at the same level I've got the Whosonline.php and callscript.php.
Eventually you need to had in your include/footer.php the following:
======
footer.php
======
<?php
//MODIF-> add the whoisoline plugin
include "callscript.php";
?>
=======
Of course you need also to modify your lang scritps, with additional variable. I give an example in english:
======
langen.php
=======
$lWho_title = "Who is Online?";
$lWho_nbposts1 = "Our users have posted a total of";
$lWho_nbposts2 = "messages";
$lWho_nbuser1 = "We have";
$lWho_nbuser2 = "registered users";
$lWho_newest = "The newest registered user is";
$lWho_on1 = "In total there are";
$lWho_on2 = "users online :: ";
$lWho_on3 = "Registered,";
$lWho_on4 = "Guests";
$lWho_most = "Most users ever online at the same time was";
$lWho_reg = "Registered Users:";
$lWho_elapsed = "This data is based on users active over the past 3 minutes";
==========
Voila, I think that's it.
Good luck
Cyril
Post Edited (02-14-04 05:59)
Re: Display moderators for the forum February 15, 2004 08:54PM |
Re: Display moderators for the forum February 16, 2004 06:34PM |
Re: Display moderators for the forum February 17, 2004 05:33AM |
Re: Display moderators for the forum February 17, 2004 01:14PM |
Re: Display moderators for the forum February 18, 2004 10:08AM |
Re: Display moderators for the forum February 18, 2004 04:20PM |
Registered: 20 years ago Posts: 10 |
Sorry guys, but I forgot that a lot of my functions are actually in common.php. This includes the get_regonline function that you are missing Sammy.
It might sort out also other problems.
Check line 218->Whoisonline script with the 2 get_ fucntions afterwards...
Cyril
Post Edited (02-19-04 02:08)
It might sort out also other problems.
Check line 218->Whoisonline script with the 2 get_ fucntions afterwards...
Cyril
Post Edited (02-19-04 02:08)
Re: Display moderators for the forum February 18, 2004 08:05PM |
Re: Display moderators for the forum February 19, 2004 03:09AM |
Registered: 20 years ago Posts: 10 |
Sorry for the link, I tried to put it again but it doesn't work... maybe it's too big.
Anywway the functions to add in your common.php are below:
---------
//MODIF->Whoisonline script
function get_location($PHP_SELF,$REQUEST_URI,$title,$ForumName)
{
switch(basename($PHP_SELF))
{
case "post.php":
$pagename="Posting Now Topic in <b><a href=\"$REQUEST_URI\">".$ForumName."</a></b>";
break;
case "whoisonline.php":
$pagename="Viewing this page";
break;
case "index.php":
$pagename="Viewing: <b><a href=\"$REQUEST_URI\">".$title."</a></b>";
break;
case "list.php":
$pagename="Reading: <b><a href=\"$REQUEST_URI\">".$ForumName."</a></b> Forum";
break;
case "read.php":
$readtitle=$title;
$readtitle=str_replace("-"," ",$readtitle);
$pagename="Reading: <b><a href=\"$REQUEST_URI\">".$readtitle."</a></b> in <b>".$ForumName."</b> Forum";
break;
}
return $pagename;
}
function get_whosonline($IP, $username, $pagename)
{
global $DB,$q;
//Kill Old guys
$sql="delete from whosonline where ts < DATE_SUB(NOW(), INTERVAL 3 MINUTE) and ip!='record'";
$q->query($DB, $sql);
//Replace each entry with new one...if it doest exist it creates new one
$sql="replace INTO whosonline (ip, username, forum) VALUES('$IP', '$username', '$pagename')";
$q->query($DB, $sql);
//count them
$sql="SELECT count(*) as total FROM whosonline where ip!='record'";
$q->query($DB, $sql);
$users=$q->field("total", 0);
//count guest number
$sql="SELECT count(*) as total FROM whosonline where ip!='record' and (username='Guest' or username='')";
$q->query($DB, $sql);
$guests=$q->field("total", 0);
//count member number
$sql="SELECT count(*) as total FROM whosonline where ip!='record' and username<>'Guest'";
$q->query($DB, $sql);
$members=$q->field("total", 0);
$userframe[users]=$users;
$userframe[guests]=$guests;
$userframe[members]=$members;
//check record table
$sql="SELECT username FROM whosonline WHERE ip='record'";
$q->query($DB, $sql);
$record=$q->getrow();
if($record[username] < $users)
{
$sql="UPDATE whosonline set username='$users' WHERE ip='record'";
$q->query($DB, $sql);
}
return $userframe;
}
function get_regonline($f)
{
global $DB, $q, $ext;
$sSQL="SELECT ip, username FROM whosonline WHERE username<>\"Guest\" and ip<>\"record\"";
$q->query($DB, $sSQL);
$sep = "";
while($record=$q->getrow())
{
$i++;
if ($i > 1)
$sep = ", ";
$id=$record['ip'];
$name=$record['username'];
$members .= $sep."<a href='profile.$ext?f=$f&id=$id$GetVars'>$name</a>";
}
return $members;
}
--------------
The stuff won't work without them, so put them in the file, it's not complicated.
Cyril
Post Edited (02-19-04 02:13)
Anywway the functions to add in your common.php are below:
---------
//MODIF->Whoisonline script
function get_location($PHP_SELF,$REQUEST_URI,$title,$ForumName)
{
switch(basename($PHP_SELF))
{
case "post.php":
$pagename="Posting Now Topic in <b><a href=\"$REQUEST_URI\">".$ForumName."</a></b>";
break;
case "whoisonline.php":
$pagename="Viewing this page";
break;
case "index.php":
$pagename="Viewing: <b><a href=\"$REQUEST_URI\">".$title."</a></b>";
break;
case "list.php":
$pagename="Reading: <b><a href=\"$REQUEST_URI\">".$ForumName."</a></b> Forum";
break;
case "read.php":
$readtitle=$title;
$readtitle=str_replace("-"," ",$readtitle);
$pagename="Reading: <b><a href=\"$REQUEST_URI\">".$readtitle."</a></b> in <b>".$ForumName."</b> Forum";
break;
}
return $pagename;
}
function get_whosonline($IP, $username, $pagename)
{
global $DB,$q;
//Kill Old guys
$sql="delete from whosonline where ts < DATE_SUB(NOW(), INTERVAL 3 MINUTE) and ip!='record'";
$q->query($DB, $sql);
//Replace each entry with new one...if it doest exist it creates new one
$sql="replace INTO whosonline (ip, username, forum) VALUES('$IP', '$username', '$pagename')";
$q->query($DB, $sql);
//count them
$sql="SELECT count(*) as total FROM whosonline where ip!='record'";
$q->query($DB, $sql);
$users=$q->field("total", 0);
//count guest number
$sql="SELECT count(*) as total FROM whosonline where ip!='record' and (username='Guest' or username='')";
$q->query($DB, $sql);
$guests=$q->field("total", 0);
//count member number
$sql="SELECT count(*) as total FROM whosonline where ip!='record' and username<>'Guest'";
$q->query($DB, $sql);
$members=$q->field("total", 0);
$userframe[users]=$users;
$userframe[guests]=$guests;
$userframe[members]=$members;
//check record table
$sql="SELECT username FROM whosonline WHERE ip='record'";
$q->query($DB, $sql);
$record=$q->getrow();
if($record[username] < $users)
{
$sql="UPDATE whosonline set username='$users' WHERE ip='record'";
$q->query($DB, $sql);
}
return $userframe;
}
function get_regonline($f)
{
global $DB, $q, $ext;
$sSQL="SELECT ip, username FROM whosonline WHERE username<>\"Guest\" and ip<>\"record\"";
$q->query($DB, $sSQL);
$sep = "";
while($record=$q->getrow())
{
$i++;
if ($i > 1)
$sep = ", ";
$id=$record['ip'];
$name=$record['username'];
$members .= $sep."<a href='profile.$ext?f=$f&id=$id$GetVars'>$name</a>";
}
return $members;
}
--------------
The stuff won't work without them, so put them in the file, it's not complicated.
Cyril
Post Edited (02-19-04 02:13)
Re: Display moderators for the forum February 19, 2004 04:38AM |
great job it works perfectly after some searching beacause i'am not very good in php.
some additions to the comments for beginner like me:
do not forget to create the table whoisonline ;-)
CREATE TABLE whosonline (
ip char(15) NOT NULL default '',
ts timestamp(14) NOT NULL,
username char(255) NOT NULL default '',
forum char(250) NOT NULL default '',
PRIMARY KEY (ip),
KEY ts (ts),
KEY forum (forum)
) TYPE=MyISAM;
INSERT INTO whosonline VALUES ('record', 20011118030340, '1', 'Whatever');
if you read 0 registered user and not last registered user ...
.....check in the callscript.php it was forum_auth intead of phorum_auth for me ....
$tsql="SELECT count(*) as total FROM phorum_auth";
$q->query($DB, $tsql);
$who_nbusers=$q->field("total", 0);
$usql="SELECT username, id FROM phorum_auth ORDER BY id DESC";
$q->query($DB, $usql);
$record2=$q->getrow();
$who_lastid=$record2['id'];
$who_lastuser=$record2['username'];
now it's working great !!! at:
<www.mammillarias.net/phorum/>
thanks to all !!!
Franck
(from France)
some additions to the comments for beginner like me:
do not forget to create the table whoisonline ;-)
CREATE TABLE whosonline (
ip char(15) NOT NULL default '',
ts timestamp(14) NOT NULL,
username char(255) NOT NULL default '',
forum char(250) NOT NULL default '',
PRIMARY KEY (ip),
KEY ts (ts),
KEY forum (forum)
) TYPE=MyISAM;
INSERT INTO whosonline VALUES ('record', 20011118030340, '1', 'Whatever');
if you read 0 registered user and not last registered user ...
.....check in the callscript.php it was forum_auth intead of phorum_auth for me ....
$tsql="SELECT count(*) as total FROM phorum_auth";
$q->query($DB, $tsql);
$who_nbusers=$q->field("total", 0);
$usql="SELECT username, id FROM phorum_auth ORDER BY id DESC";
$q->query($DB, $usql);
$record2=$q->getrow();
$who_lastid=$record2['id'];
$who_lastuser=$record2['username'];
now it's working great !!! at:
<www.mammillarias.net/phorum/>
thanks to all !!!
Franck
(from France)
Who is online like BB February 19, 2004 04:40AM |
Sorry, you do not have permission to post/reply in this forum.