vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   PM RedAlert - show unread PMs on every page (https://vborg.vbsupport.ru/showthread.php?t=35607)

Overgrow 03-01-2002 10:00 PM

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

Overgrow 03-02-2002 04:54 PM

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.

Psychdrone 03-02-2002 04:58 PM

its nice, and thanks!

but I think I will stick with fireflys hack

Overgrow 03-02-2002 05:00 PM

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.

DjSap 03-02-2002 05:55 PM

thanks, was planing on doing this for my board but now it dont have to, very nice

mvigod 03-02-2002 06:41 PM

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:


 
// Start Glow PM in Header Hack
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[user
id] AND messageread=0 AND folderid=0 
$ignoreusers");
if (
$unreadpm['messages']==0) {
$pmglow='PM';
} else { 
$pmglow='<font color="red">New PM\'s</font>'


then in the header file just replace where the text that says PM is with the variable $pmglow and if the messages are unread it glows in red New PM's and if all messages have been read than it just reads "PM" in the regular color.

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.

Overgrow 03-02-2002 06:45 PM

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..

mvigod 03-02-2002 06:52 PM

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.

Overgrow 03-02-2002 06:52 PM

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.

mvigod 03-02-2002 07:01 PM

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. :)


All times are GMT. The time now is 12:31 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
  • Page Generation 0.01033 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete