vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I display notifications total - New PM # ? (https://vborg.vbsupport.ru/showthread.php?t=266398)

MikesSite 07-07-2011 12:56 AM

How do I display notifications total - New PM # ?
 
In the notification menu where it says Your Notifications: #, is it possible to display the total notification # minus the PM total? So if you have 6 notifications but 2 are PM's the # would display 4. I ask because I plan on showing the PM total separate.

Thanks.

MikesSite 07-19-2011 03:50 AM

Can somebody help me with this?

Thanks.

--------------- Added [DATE]1311135185[/DATE] at [TIME]1311135185[/TIME] ---------------

Is it possible to take $notifications_total and subtract $vbphrase[unread_x_nav_compiled] (I think thats the variable for PM total)??

MikesSite 10-20-2011 12:51 AM

Still want to do this.

Lynn?!

kh99 10-20-2011 01:12 AM

I think you can do what you want if you edit the header template and replace {vb:raw notifications_total} with

Code:

{vb:math {vb:raw notifications_total} - {vb:raw bbuserinfo.pmunread}}

Edit: ...except that's for vb4, as pointed out in the next post...

MikesSite 10-20-2011 01:22 AM

For vb3?

kh99 10-20-2011 01:44 AM

Oh...oops. Maybe $notifications_total - $bbuserinfo[pmunread] ?

Sorry, I'll have to look again, at the right code this time. :o

MikesSite 10-20-2011 01:54 AM

Thanks! LMK if you come up with anything :)

kh99 10-20-2011 02:08 AM

OK, I got confused with the vb4 stuff and forgot that you can't do math like that in a template. So you'd have to use a plugin and create a new variable. I think you can use hook location global_setup_complete and code like:

Code:

$notifications_not_pm = $notifications_total - $vbulletin->userinfo['pmunread'];

then use $notifications_not_pm (or whatever you want to call it) in the navbar template in place of $notifications_total (the first time it appears, not the one in the 'if' condition).

But that's for if you want the notifications to show up normally but the count to not include pms. If you want the notifications to disappear if there are only pm notifications (so that the count is 0), you should just change $notifications_total and reset $show['notifications'] if necessary, like:

Code:

$notifications_total -= $vbulletin->userinfo['pmunread'];
if ($notifications_total == 0)
    $show['notifications'] = false;


and of course then you don't need to change the navbar template.

MikesSite 10-20-2011 02:22 AM

Thanks. Unfortunately it doesn't seem to be working, it's outputting nothing. Possibly wrong hook location?

kh99 10-20-2011 02:24 AM

Well, I did try both of those before posting and they seemed to work. Which one did you try?


All times are GMT. The time now is 03:28 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.00955 seconds
  • Memory Usage 1,726KB
  • 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
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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