Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 05-30-2011, 10:04 PM
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Adding quick moderation to header template

I'm trying to add everything back to a few of my sites since I've upgraded everything to vBulletin 4+...

I had all of my moderation links display in the header template if I had anything that needed to be moderated.

Basically, the idea is pretty much: Moderation link replaces logo if there are items to be moderated.

I'm currently using the following code in the global_start hook:

Code:
$modlinks = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "adv_links WHERE valid = 0");

vB_Template::preRegister('header',array('modlinks' => $modlinks));
This plugin doesn't seem to push the $modlinks variable through to the header template. I'm using this code in the header template:
Code:
<vb:if condition="$modlinks">Test</vb:if>
It doesn't work though, and I definitely have links that are in need of being moderated.

I have also tried the parse_templates hook, which works for some things, however, when using that hook instead of global_start... I get a blank page.

Any help would be appreciated!
Reply With Quote
  #2  
Old 05-30-2011, 10:43 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I try this plugin code:

Code:
$modlinks = array("foo");
vB_Template::preRegister('header',array('modlinks' => $modlinks));
And your template code in the header template, I see "Test" appear in my header. So that would seem to indicate that the query is failing. I don't have any adv_links table in my database, so maybe that's changed? (Although I don't have it in my vb3.8.3 database either).
Reply With Quote
  #3  
Old 05-31-2011, 08:49 PM
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

adv_links is an addon vBadvanced Links Directory.

I'm trying to do the same thing with everything else... you could also try with this:

Code:
$modthreads = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "thread WHERE visible = 0");
The query should work as it works in other places, but for some reason it's not.

Thanks for your help!
Reply With Quote
  #4  
Old 05-31-2011, 11:28 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...I may be wrong. I'm not sure if there is any condition where $db->query_first returns something that would cause the conditional to be false. I put a different query in there like you suggested and it worked.

So could you problem be that something else is changing the value of $modthreads before you get to the header template render()?
Reply With Quote
  #5  
Old 06-01-2011, 02:11 AM
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm... well, I'm glad you said that, however there isn't anything else changing the value of it. It seems to have been the execution order for some reason. Anything 5+ doesn't work, less than 5, it works just fine.

Thank you!

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

Err... looks like I actually spoke too soon. When changing to execution order to 4 or below, all of the variables have a value of "Array" instead of the actual number.
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 01:18 AM.


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.04129 seconds
  • Memory Usage 2,197KB
  • 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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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