![]() |
PM RedAlert - show unread PMs on every page
Disclaimer:
-No support is offered for this hack. If you PM or email for support, it will be joyfully ignored. When I have time, I will answer questions in this thread. PM RedAlert Problem: PM Popups are OK but not everyone likes them or uses them. Sometimes you'll cancel them and forget you have new ones to read. Solution: If your site has a "Private Messages" link on every page, like mine, then an effective way to notify people that they have new PMs is to subtly change that link. PM Popup will still work if they have that activated.. and this is not like Chen's hack since that is only concerned with the index page. This hack is meant for site wide private message links that you would likely have in the header. (See attached screenshot) Design Spec: Alert users that they have new PMs on every page by subtly changing a link style. Steps for installation: -add one field to table user 'unreadpm' -edit two files 'private.php' 'private2.php' -upload the two files -edit header Tested on: 2.2.1 |
screenshot-- when a user has a new private message, the "Private Msgs" link will turn yellow and stay yellow until the user goes into Private Messaging. Of course it doesn't have to be "yellow" -- by checking the new variable $bbuserinfo[pmunread], you can do whatever you want.. make something animate, blink, turn fuscia, etc.
|
its nice, and thanks!
but I think I will stick with fireflys hack |
Two different goals with two different hacks.. Firefly's affects the index.php home page. Mine is meant if you have a "Private Messaging" link in your header on every page.
|
thanks, was planing on doing this for my board but now it dont have to, very nice
|
I wrote this hack for my board but didn't add another table to the database...think my way is a little more simple since it requires no DB change but the end result is the same.
In global.php after: // parse PHP include ################## eval(gettemplate('phpinclude',0,0)); I put: PHP Code:
If you are using an image you can change the attribute for $pmglow to swap out the image or put an effect on it...whatever you like. |
Got a link to it? Or mind describing what you checked to see if there were unread PMs? I didn't use the pmpopup since it gets turned off once the javascript runs. If you don't use a new field (not a table) then you have to query the PM table each page load, which would be rough on a big site. I'm curious to your solution! thanks..
|
Overgrow,
Yes my solution does add that one extra query to each page. Guess it's a tradeoff depending on your site load versus wanting to add the extra DB field? It's fast query as userid is an indexed key in the pm table though. |
Ah yea, I avoided the extra query by including it in $bbuserinfo. For sites concerned about their database load, adding a new user field is preferable to adding a new query.. though your solution works just as well! Thanks.
And as Freddie pointed out to me somewhere else, I should remember to check what fields are indexed before determining what would be a slow query or not. |
Just read through your hack and that extra query will be saved as you said. Just 2 different ways to skin a cat.
If a site is really loaded heavy I'd go Overgrow's route to save the one query but otherwise either works nicely. :) |
excellent hack! i'll test it later when i get time, but it sounds really good.
|
Is it absolutly mandatory that we shut down our vb to run the query?
|
>>Is it absolutly mandatory that we shut down our vb to run the query?
hahah no, that is your choice! It's advised but not mandatory. |
I get this error after running the query:
Error SQL-query : [Edit] ALTER TABLE 'user' ADD 'pmunread' SMALLINT(6) DEFAULT "0" NOT NULL MySQL said: You have an error in your SQL syntax near ''user' ADD 'pmunread' SMALLINT(6) DEFAULT "0" NOT NULL' at line 1 |
Sorry, extra quotes got in there somehow. This is the correct query:
ALTER TABLE user ADD pmunread SMALLINT(6) DEFAULT "0" NOT NULL; That works and I've updated the text file. Thanks. |
this is a great hack.. :) i think a good mod would be to have it blink in a little table, right beside the nav bar. alot more visible. just a suggestion.
regards, nakkid. |
Thanks man. Nice new logo up top there.. If you want to make your site blink, more power to ya ;) Most people use image buttons and not text links like I do, so substituting a GIF with an animated new PM gif would be the way to go.
|
excellent point.. and thanks for the logo thing.. ;)
|
this works great! thanks overgrow!
|
i like the looks of this. i did everythin up til this point here:
"4) Change your site-wide Private Messaging link. Mine is located in my PHP parsed header file and I do something like this: if ($bbuserinfo[userid] > 0 and $bbuserinfo[pmunread]==1) $pmstyle=" style=\"color:#ffdc00;\"";" I am terribly n00b on that. I honestly have no clue what that means or where to look for it. <shame> haha |
could someone explain how to use a image? i can not figure it out and would really like to add this to my site
right now i have a image in the header that points to the members PM. how would i change this to another image (a flashing image) when that user has a new PM this is a great hack just stuck on the end part thanks |
Quote:
already have a PM image and a flashing PM image all ready to go! maybe some of the more experience guys can help us out. |
bump to the top for some answers
thanks |
went with just the straight text to make sure this hack was working correctly before trying to change it over to a gif.
the text highlights only on the first page loaded when there is a new PM. hit i hit another page then the text is no longer highlighted even when i still have unread PM's any suggestions or ideas? |
anyone?
|
To Trainer:
This is how u add the blinking imgae: PHP Code:
|
Quote:
how do i call it in the header? using pm-button.gif as the non-flashing button using pm-button_ani.gif as the flashing button |
Still no straight answer..
Where is this supposed to go!?? 4) Change your site-wide Private Messaging link. Mine is located in my PHP parsed header file and I do something like this: if ($bbuserinfo[userid] > 0 and $bbuserinfo[pmunread]==1) $pmstyle=" style=\"color:#ffdc00;\"";" |
Anyone?
I don't understand how this can be called a final release when there are no instructions on where to place the last peice of code. I'm using an animated .gif. Currently I just have a simple edited header template that shows a button and link to PM's. I've tried to place Code:
if ($bbuserinfo[userid] > 0 and $bbuserinfo[pmunread]==1) Into the header but as you can tell it will not work. Any help on this half released mod would be appreciative. |
Quote:
Your hack works well if you're a registered user on the forum. But when you're not logged in (guest user), the status will show, that you have unread private messages! Weird :-) I don't think thats ok, do you think you can solve that matter/problem? Thanks in advance... |
Quote:
https://vborg.vbsupport.ru/showthrea...=&pagenumber=1 Thanks for sharing though. |
will this hack work with 2.2.9? I can't find the FIRST CODE in the FIRST STEP in the global.php
|
All times are GMT. The time now is 02:45 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|