vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   exclude private messages from notifications total (https://vborg.vbsupport.ru/showthread.php?t=322304)

Dr.CustUmz 04-06-2016 12:22 AM

exclude private messages from notifications total
 
im trying to exclude PMs from the total count of notifications and the list.

<if condition="$notification['total'] > 0">

i know it would be built off this, i just have no idea how to set it up

example

<if condition="$notification['total'] > 0"> (AND IS NOT A $bbuserinfo[pmunread] NOTIFICATION)
show all other notifications
<else />
NO NEW NOTIFICATIONS
</if>

*note !$bbuserinfo[pmunread] was tried, but failed

i found $notifications['pmunread']
but still cant figure out how to not show them in the notifications

MarkFL 04-06-2016 12:24 AM

Have you tried to use the difference:

PHP Code:

$notification['total'] - $bbuserinfo['pmunread'


Dr.CustUmz 04-06-2016 01:16 AM

i have not
but i found a plugin that might do the job i just need help converting one line

Code:

vB_Template::preRegister('header', array('newmessages' => $vbulletin->userinfo['pmunread']));
Im no good when it comes to vb4 code, and I think this needs to be an eval. Im just not sure how exactly to convert it to vb3

this (along with the rest of the code) unsets pmunread from notifications and creates it individually.

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

i did manage to get the correct if statement

PHP Code:

<if condition="$vbulletin->userinfo['pmunread'] != $notifications_total"

that removes pm notifications from the notifications list, but the notification still remains in the total count, and if i can get that code in my previous post converted it should solve it

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

I GOT IT =P lmao was so easy -_-

plugin:

in notifications_list
Code:

unset($notifications[pmunread]);
the rest was achieved by the original if conditions

templates:

Code:

<if condition="$notifications_total">
  <span>$notifications_total</span>
</if>

shows total notifications OTHER THAN PMS since we unset them

Code:

<if condition="$bbuserinfo[pmunread]">
  <span>($bbuserinfo[pmunread])</span>
</if>

shows amount of pms

that'll do it =)

MarkFL 04-06-2016 02:07 AM

I think I would use the difference rather than unsetting a variable...that may cause issues...:)

Dr.CustUmz 04-06-2016 02:29 AM

im only unseting it in the notifications_list, what potential issues could there be? i tried the difference but couldnt get that to work.

the end goal is: (not implemented in these codes)

NOTIFICATIONS LIST (no pm)
Code:

<if condition="$notification['total'] > 0">
<li><a href="$notification[link]"><span>$notification[total]</span> $notification[phrase]</a></li>
</if>

notification total (no pm)
Code:

<if condition="$notifications_total">
  <span>$notifications_total</span>
</if>

pm total
Code:

$bbuserinfo[pmunread]
--------------- Added [DATE]1459917142[/DATE] at [TIME]1459917142[/TIME] ---------------

btw
Code:

<if condition="$notifications_total - $bbuserinfo['pmunread']">
<span>$notifications_total</span>
</if>

is the way i thought it would work =/ no luck

MarkFL 04-06-2016 02:33 AM

I was assuming both variables mentioned were available and that you wanted to take action only if there were non-pm related notifications.


All times are GMT. The time now is 03:50 PM.

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.02472 seconds
  • Memory Usage 1,728KB
  • 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
  • (8)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete