View Full Version : PM 'You have X New Message(s)' relocation
imageconstrux
02-02-2003, 02:08 AM
I'm wanting to relocate just the text and variable from the forumhome_pmloggedin template (You have $newpm[messages] new message(s) since your last visit) to the header.
I'm relatively new at this, so I just copied
<b>$bbuserinfo[username]</b> - You have $newpm[messages] new message(s) since your last visit.
And pasted it into the header template. Everything showed up of course, except the variable $newpm.
What else do I need to call out in from the forumhome_pmloggedin template to make the # of new messages show up?
Thanks,
Jeff
Tony G
02-02-2003, 02:58 AM
Hacking is probably required as that variable is only coded to work in that one template.
imageconstrux
02-02-2003, 03:05 AM
Would it be possible to have the header call out a new template, and then make that new template just like forumhome_pmloggedin, without any of the formatting?
Would that work?
Dean C
02-02-2003, 10:38 AM
No this is a hacking issue.
Try this but it's not tested.
In global.php find:
eval("\$headnewpm = \"".gettemplate('head_newpm')."\";");
}
Below it add:
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages,
SUM(IF(dateline>$bbuserinfo[lastvisit] AND folderid=0,1,0)) AS newpm,
SUM(IF(messageread=0 AND folderid=0,1,0)) AS unreadpm
FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm['messages']=intval($allpm['newpm']);
$unreadpm['messages']=intval($allpm['unreadpm']);
BEWARE! THIS WILL ADD 1 QUERY TO EVERY PAGE ON YOUR SITE!
- miSt
AussieSat
02-02-2003, 10:30 PM
This what i use (no seperate template):
Place this in your phpinclude template..
$headpms=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
$headpmsmessage= "You have $headpms[messages] new message(s)";
Place $headpmsmessage in your header (or anywhere else) to show the text "You have X new messages" (X being the new message count).
It does add a query to every page.
Just to hijack this thread for a related question..
I use images that change if there are new PMs (using a variant of the above code) - I want to have $headpmsmessage as the alt text for the images but I cant seem to get it to parse the variable. I know it can be done (a variable as alt text) as the header image uses $bbtitle for it's alt text.
Any ideas? Thanks.
anders
02-27-2003, 04:17 PM
Im having the same problem but with the following.
<tr id="cat">
<td bgcolor="{categorybackcolor}" colspan="6"><a href="private.php?s=$session[sessionhash]" title="Click Here to Open Your Private Messages $inboxname"><normalfont color="{categoryfontcolor}"><b>Private Messages</normalfont></b></a></td>
</tr>
<tr>
<td width="50" bgcolor="{secondaltcolor}" align="center" valign="top">
<img src="{imagesfolder}/$lightbulb.gif" alt=""></td>
<td width="453" bgcolor="{firstaltcolor}" align="left" valign="top">
<smallfont>$welcometext <b>$newposts</b></smallfont>
$headpmsmessage= "You have $headpms[messages] new message(s)";
<smallfont>Members: $numbermembers , Threads: $totalthreads , Posts: $totalposts<br>
Welcome to our newest member, <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a>
</smallfont>
</td>
<td bgcolor="{firstaltcolor}" colspan="5"><smallfont>
Your current private message status.<br>
<a href="private.php?s="><b>$newpm[messages]</b> : New messages.</a><br>
<a href="private.php?s="><b>$unreadpm[messages]</b> : Unread messages<br></a>
</smallfont></td>
</tr>
the pm part works but nr of posts, ?atest member, Threads etc dont.
and this is located inside "forumhome_pmloggedin"
Dean C
02-27-2003, 05:42 PM
You can't use the number of threads and posts etc in the forumhome_pmloggedin template. You can only use them in your forumhome template :)
Regards
- miSt
anders
02-27-2003, 11:48 PM
impossible to make it work ? becouse i want that info to be seen ONLY by the registered ppl thats logged in besides the pm info,
Dean C
03-02-2003, 10:58 AM
It's not impossible to make it work. It just requires hacking and this is not the correct forum for hacking ;). I'm sure if you make a request in the requests forum for this someone wil help you out :D
- miSt
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.