Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 04-26-2009, 02:29 PM
Essencee Essencee is offline
 
Join Date: May 2008
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 04-26-2009, 03:06 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 04-26-2009, 03:25 PM
Essencee Essencee is offline
 
Join Date: May 2008
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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!
Reply With Quote
  #4  
Old 04-26-2009, 03:44 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'.
Reply With Quote
  #5  
Old 04-26-2009, 03:47 PM
Essencee Essencee is offline
 
Join Date: May 2008
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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?
Reply With Quote
  #6  
Old 04-27-2009, 02:38 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #7  
Old 04-27-2009, 10:22 AM
Essencee Essencee is offline
 
Join Date: May 2008
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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...).
Reply With Quote
  #8  
Old 04-27-2009, 02:44 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:11 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06768 seconds
  • Memory Usage 2,235KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete