vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   how to get a list of notifications (https://vborg.vbsupport.ru/showthread.php?t=321204)

bradthor 12-28-2015 01:51 AM

how to get a list of notifications
 
expounding on Markfl's answer given in the following getting the total number of notifications and this thread Adding a notification.how would I get a dynamic array of all the notifications or of each of the notification types in vbulletin so that I can create a dynamic list of notifications?
Also If there is any documentation about the various userinfo ,activity and notification types and the functions that are used to instantiate them that would be really helpful.
Thanks a ton in advance.

Dave 12-28-2015 01:55 AM

If you check the "user" table, you will see columns such as "vmunreadcount", "friendreqcount", etc. I think you can access those variables in the $vbulletin->userinfo array to then process them to your needs.

bradthor 12-28-2015 02:08 AM

Thanks for the answer:)....how would I do this exactly?

MarkFL 12-28-2015 02:40 AM

In my reply in the other thread, I think I gave you all of the notification types intrinsic to vB 4. You would then have to look at your "user" table to see if any of your installed products have added any of their own, such as "DragonByte Tech: Advanced Post Thanks / Like (Pro)" does.

Then once you have determined all of the notification types on your site, you would add them all up to get the total. :)

bradthor 12-28-2015 12:11 PM

I dont need the total any more ...the message you sent hlped me figure that out ... I need to make a dynamic list from each of those so I can make a notifications list

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

I need to find out how to use those functions you mentioned to make a dynamic list

MarkFL 12-28-2015 01:24 PM

Well, in your PHP code, you could do something like:

PHP Code:

$notifications '';

//Only display for non-zero values.

if ($vbulletin->userinfo['pmunread'])
{
    
$notifications .= 'Unread PMs: ' $vbulletin->userinfo['pmunread'] . PHP_EOL;
}

//Check for other notifications in the same way. 

Then you could wrap the $notifications string in the appropriate HTML before appending it to a template hook or you might have a custom template designed that you would simply register this string so it can by output there.

bradthor 12-28-2015 02:20 PM

Quote:

Originally Posted by MarkFL (Post 2561280)
Well, in your PHP code, you could do something like:

PHP Code:

$notifications '';

//Only display for non-zero values.

if ($vbulletin->userinfo['pmunread'])
{
    
$notifications .= 'Unread PMs: ' $vbulletin->userinfo['pmunread'] . PHP_EOL;
}

//Check for other notifications in the same way. 

Then you could wrap the $notifications string in the appropriate HTML before appending it to a template hook or you might have a custom template designed that you would simply register this string so it can by output there.

Thanks for the reply BUT i noticed that perhaps I haven't explained what i'm trying to achieve properly.
I understand that
PHP Code:

$vbulletin->userinfo['pmunread'

fetches the number of "pmunread" notifications however lets say that there is 1 "pmunread" notification ,what would be the best way to go about retrieving information about this 1 "pmunread" notification eg:- pmtextid, messageread, fromusername, pmid and the associated (serialized) format for that notification type eg:-('user X has just messaged you Re:pmtext');
and then display that in a foreach loop which accounts for a dynamic list of notifications, just like the facebook notifications dropdown.
I hope this makes more sense.
Thanks again for the reply:)

Dave 12-28-2015 02:22 PM

You will have to query the pm/pmtext table in that case. As far as I know vBulletin doesn't provide a function or array that contains all the information you need.


All times are GMT. The time now is 08:27 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.02519 seconds
  • Memory Usage 1,742KB
  • 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_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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