vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   [VB4] Need help with variables (https://vborg.vbsupport.ru/showthread.php?t=276467)

HolySell 01-04-2012 10:53 PM

[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 :(

kh99 01-05-2012 01:26 AM

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

Edit: oops - the :p in vB_Template::preRegister was changed to a smilie. I meant that you should be using vB_Template::preRegister().

HolySell 01-05-2012 11:05 AM

ok I try it ;)

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

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

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

sry I have found it yay :D

kh99 01-05-2012 11:25 AM

nvm

HolySell 01-05-2012 11:57 AM

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 :(

kh99 01-05-2012 12:05 PM

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::preRegister() 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));


HolySell 01-05-2012 12:17 PM

thaaaaanks !!! :D I wanna marry you !!! :DDD ;D


All times are GMT. The time now is 12:53 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.01016 seconds
  • Memory Usage 1,726KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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