vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Can't get $notifications_total variable. (https://vborg.vbsupport.ru/showthread.php?t=212211)

Essencee 04-26-2009 01:29 PM

Can't get $notifications_total variable.
 
Hello guys.
I am trying to edit "Cyb - PM System Enhancements" and add some part to it via the $notifications_total, but it seems that it's not working at all. My code is below:

PHP Code:

            if ((($vbulletin->userinfo['pmunread']>'0') AND ($vbulletin->options['cyb_pme_newpmsig_color']!='')) OR ($notifications_total 0)) 
            { 
                eval(
'$cybpmblink = "' fetch_template('cyb_pme_blink') . '";'); 
                
$vbphrase[your_notifications] = $cybpmblink
            } 

What can I do?
Thank you!

Lynne 04-26-2009 02:06 PM

You need to make sure that $notifications_total has already been defined before you go use it in a plugin. So, you need to pick your plugin hook location to be after the variable is defined. Go find it in the code and then look at where your plugin is location and figure out if it's before or after the variable was defined and move it if necessary.

Essencee 04-26-2009 02:25 PM

Quote:

Originally Posted by Lynne (Post 1799346)
You need to make sure that $notifications_total has already been defined before you go use it in a plugin. So, you need to pick your plugin hook location to be after the variable is defined. Go find it in the code and then look at where your plugin is location and figure out if it's before or after the variable was defined and move it if necessary.

I didn't understand what you said.
Can you simplify it for me?

Thank you! :)

Lynne 04-26-2009 02:44 PM

Hmmm, I don't know that I can simplify that much. Basically, you are trying to use a variable, $notifications_total, which is probably not defined. It's like doing algebra - you can do this:
Code:

a=1
b=2
what is a+b

but you can't do:
Code:

b=2
what is a+b

because a isn't defined.

You need to make sure $notifications_total is defined before you can go use it in an 'equation'.

Essencee 04-26-2009 02:47 PM

Quote:

Originally Posted by Lynne (Post 1799372)
Hmmm, I don't know that I can simplify that much. Basically, you are trying to use a variable, $notifications_total, which is probably not defined. It's like doing algebra - you can do this:
Code:

a=1
b=2
what is a+b

but you can't do:
Code:

b=2
what is a+b

because a isn't defined.

You need to make sure $notifications_total is defined before you can go use it in an 'equation'.

Man, the $notifications_total variable is a base variable in vBulletin, I don't need to define it at all. It just brings me the number of notifications per user. Any help?

Lynne 04-27-2009 01:38 AM

I'm sorry, I thought you were originally saying that $notifications_total was the problem (someone else had a similar problem recently), but I guess that isn't it. I must admit that I don't understand what you are trying to do here. I don't know what hook location you are using nor what output you are trying to achieve. Maybe an image would help out?

Essencee 04-27-2009 09:22 AM

Quote:

Originally Posted by Lynne (Post 1799717)
I'm sorry, I thought you were originally saying that $notifications_total was the problem (someone else had a similar problem recently), but I guess that isn't it. I must admit that I don't understand what you are trying to do here. I don't know what hook location you are using nor what output you are trying to achieve. Maybe an image would help out?

The mod blinks the title of "Your Notifications" when there are more than 0 (1 and more) new privare messages. I am trying to convert it that it will blink also for other notifications (new messages, posts etc...).

Lynne 04-27-2009 01:44 PM

Well, I'll post the code I use on one of my mods to put in an extra line in the Notifications box and you can change it for your own needs.

location - notifications_list
PHP Code:

if ($vbulletin->userinfo['ttdtrader_s'] >= '1') { 
    
// add notification
    
$notifications['threadattention'] = array(
        
'phrase' => 'Threads Needing Attention',
        
'link'   => 'verifythreads.php?' $vbulletin->session->vars['sessionurl'] . 'do=list',
        
'order'  => 12
    
);

.... 
my query to get the count ....

$vbulletin->userinfo['threadattention'] = intval($holdquery['count']);


You can, of course, use a phrase where it says 'phrase' up there, but I didn't for this. It was just a quick plugin I just wanted to work at the time. One of these days I'll fix it.


All times are GMT. The time now is 08:39 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.02048 seconds
  • Memory Usage 1,743KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)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