Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2012, 10:53 PM
HolySell HolySell is offline
 
Join Date: Nov 2011
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [VB4] Need help with variables

Hey vBulletin.org-Community

I have a problem with my variables

I want to "echo" a variable called "gfxpoints"(numeric) in my template "memberinfo_block_ministats", the variable "gfxpoints" should read out with a mysql_query from table user, my question, where I must register the variable gfxpoints that this code in the "memberinfo_block_ministats" works ?
Quote:
<dl class="stats">
<dt>GFX-Points</dt>
<dd>{vb:raw gfxpoints}</dd>
</dl>
i have tried to register the variable "gfxpoints" in the member.php but it won?t work
Reply With Quote
  #2  
Old 01-05-2012, 01:26 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try creating a plugin using hook member_execute_start. And you're using vB_Template:reRegister, right?

Edit: oops - the in vB_Template:reRegister was changed to a smilie. I meant that you should be using vB_Template:reRegister().
Reply With Quote
  #3  
Old 01-05-2012, 11:05 AM
HolySell HolySell is offline
 
Join Date: Nov 2011
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok I try it

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

member_execute_start I dont?t find the hook what I do wrong ?

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

sry I have found it yay
Reply With Quote
  #4  
Old 01-05-2012, 11:25 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nvm
Reply With Quote
  #5  
Old 01-05-2012, 11:57 AM
HolySell HolySell is offline
 
Join Date: Nov 2011
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, it don?t work

this is my code in the "memberinfo_block_ministats".
<dl class="stats">
<dt>GFX-Points</dt>
<dd>{vb:raw gfxpoints}</dd>
</dl>

and This I have placed in the member.php on line 140+141
Quote:
($hook = vBulletinHook::fetch_hook('member_execute_start')) ? eval($hook) : false;
$templater->register('gfxpoints', $gfxpoints);
an this is the php-plugin:
Addon: vBulletin
Hook: member_execute_start
Title: gfxpoints
"Reihenfolge": 5
Quote:
$usrid = $vbulletin->userinfo['userid'];
$gfxpquery = $db->query_read("SELECT gfxpoints FROM user WHERE userid = '".$usrid."'")or die(mysql_error());
$gfxpoints = mysql_result($gfxpquery,0);
but I can?t see the reuslt
Reply With Quote
  #6  
Old 01-05-2012, 12:05 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK - this line:

Code:
($hook = vBulletinHook::fetch_hook('member_execute_start')) ? eval($hook) : false;

is the place where the plugin code gets executed (if hook location member_execute_start is selected). So you don't need to edit member.php (at least to do what you're trying to do here), you can just put the code in the plugin. Also, you need to use vB_Template:reRegister() because at the point that the plugin code is run, you don't have $templater set yet.

So, take that code out of member.php and try this as your plugin code:

Code:
$usrid = $vbulletin->userinfo['userid'];
$gfxpquery = $db->query_read("SELECT gfxpoints FROM user WHERE userid = '".$usrid."'")or die(mysql_error());
$gfxpoints = mysql_result($gfxpquery,0);
vB_Template::preRegister('memberinfo_block_ministats', array('gfxpoints' => $gfxpoints));
Reply With Quote
  #7  
Old 01-05-2012, 12:17 PM
HolySell HolySell is offline
 
Join Date: Nov 2011
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thaaaaanks !!! I wanna marry you !!! DD ;D
Reply With Quote
Reply


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 02:02 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.03999 seconds
  • Memory Usage 2,218KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_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