Justice
11-02-2001, 02:06 AM
I just wrote a hack, sort of, but before I impliment it, I wanted to ask if it would cause too much server strain.
Basically, I want a Private Message notice on my forumdisplay.php page.
I have the PM pop-up notices turned off, but I do want my members notified when they get new messages. So, I used some of the code from index.php and placed in forumdisplay.php.
Right under
$getperms=getpermissions($forumid,-1,-1,$foruminfo['parentlist']);
if (!$getperms[canview]) {
show_nopermission();
}
I added...
//check usergroup of user to see if they can use PMs
//$permissions=getpermissions($forumid);
if ($enablepms==1 and $permissions['canusepm'] and $bbuserinfo['receivepm']) {
$ignoreusers="";
if (trim($bbuserinfo['ignorelist'])!="") {
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' ',$bbuserinfo[ignorelist]));
}
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
if ($newpm['messages']==0) {
$lightbulb='off';
} else {
$lightbulb='on';
}
eval("\$pminfo = \"".gettemplate('forumdisplay_pmloggedin')."\";");
} else {
$pminfo='';
}
I created a new template called "forumdisplay_pmloggedin," and everything works fine.
Now, it looks like this would call from the private message table every time the user loads the forumdisplay.php. Would this use more or less resources than the pop-up feature, or is the amount virtually negligible?
Basically, I want a Private Message notice on my forumdisplay.php page.
I have the PM pop-up notices turned off, but I do want my members notified when they get new messages. So, I used some of the code from index.php and placed in forumdisplay.php.
Right under
$getperms=getpermissions($forumid,-1,-1,$foruminfo['parentlist']);
if (!$getperms[canview]) {
show_nopermission();
}
I added...
//check usergroup of user to see if they can use PMs
//$permissions=getpermissions($forumid);
if ($enablepms==1 and $permissions['canusepm'] and $bbuserinfo['receivepm']) {
$ignoreusers="";
if (trim($bbuserinfo['ignorelist'])!="") {
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' ',$bbuserinfo[ignorelist]));
}
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
if ($newpm['messages']==0) {
$lightbulb='off';
} else {
$lightbulb='on';
}
eval("\$pminfo = \"".gettemplate('forumdisplay_pmloggedin')."\";");
} else {
$pminfo='';
}
I created a new template called "forumdisplay_pmloggedin," and everything works fine.
Now, it looks like this would call from the private message table every time the user loads the forumdisplay.php. Would this use more or less resources than the pop-up feature, or is the amount virtually negligible?