vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Google Chart Integration (https://vborg.vbsupport.ru/showthread.php?t=316061)

gfran5 12-17-2014 12:53 PM

i tried:
HTML Code:

<div class="body_measurements">
<vb:if condition="$post['field8']">
<h2 style="display: inline;">H: {userdata.field8}cm |&nbsp</h2>
<vb:else />
<h2 style="display: inline;">H: -- |&nbsp</h2>
</vb:if>
<vb:if condition="$post['field7']">
<h2 style="display: inline;">W: {userdata.field7} Lbs</h2>
<vb:else />
<h2 style="display: inline;">W: -- </h2>
</vb:if>   
</div>

but the numbers still didn't show up on the page, anything else i could try?

kh99 12-17-2014 12:55 PM

Did you create a plugin like that guide showed? What code do you have in your plugin?

gfran5 12-17-2014 01:01 PM

my plugin is this:
PHP Code:

if (isset($vbulletin->GPC['tab']))
{
    
$selected_tab $vbulletin->GPC['tab'];
}
$blockinfo['title'] = "My Bodyspace";
$blockid "my_bodyspace";
$taburl $memberurl fetch_seo_url('member'$prepared) . "&amp;tab=my_bodyspace#my_bodyspace";

$templater vB_Template::create('memberinfo_tab');
$templater->register('selected_tab'$selected_tab);
$templater->register('relpath'$relpath);
$templater->register('blockinfo'$blockinfo);
$templater->register('blockid'$blockid);
$templater->register('taburl'$taburl);
$template_hook['profile_tabs_last'] .= $templater->render();  

// ### Your code to fill the tab ###
// Don't forget you need to register any variables for use in templates 

$test_tab_content "Congratulations, you can see me, I'm your PHP Code!";

$templater vB_Template::create('memberinfo_block_test');
$templater->register('selected_tab'$selected_tab);
$templater->register('test_tab_content'$test_tab_content);
$templater->register('userdata'$prepared);
$template_hook['profile_tabs'] .= $templater->render(); 

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

Any other ideas for how i can get my custom field data into my bodyspace profile page Kevin?

kh99 12-17-2014 03:30 PM

Sorry, I lost my internet connection for a couple hours. Anyway, I copied your plugin code to create a new plugin using hook member_complete, and I created a template called memberinfo_block_test using the code from the guide page you linked to, but I get a blank tab. I haven't had a chance to figure out why yet.

Are you seeing anything from your template? I think I might have been wrong about using $prepared, I think you might want to use $userdata instead. So maybe change the added line to:
Code:

$templater->register('userinfo', $userinfo);

then use {userinfo.field8}, etc. But if you're having the same issue I am with the tab being entirely blank then you probably still won't see the profile fields.

gfran5 12-17-2014 10:09 PM

I tried that but that didn't work either, i am able to see "Congratulations, you can see me, I'm your PHP Code!" on the profile tab page, therefore it should work if it is right.

Not sure why this is so hard to do.

kh99 12-17-2014 11:13 PM

Yeah, I can't even get that message to show up and it's frustrating me. I don't think I can deal with it any more tonight.

I noticed that the template uses $userinfo in a condition, but for some reason it's not registered in the example plugin. Maybe it's preRegistered somewhere else or something. But that does mean that {userinfo.fieldX} would work if the profile fields are actually there (and since this is the profile page you'd think they would be).

Did you create those fields as private? Even if you did they should appear when you're looking at your own profile. You have data entered for those fields, right? I just can't think of any other reason right now.

Anyway, I'll look at it again in the morning if you haven't figured it out by then. If I can get the template to appear then I can figure out the field value problem.

ozzy47 12-17-2014 11:24 PM

Yeah Kevin, sometimes it is best to step back for the night, and come at it fresh in the morning.

gfran5 12-18-2014 01:35 AM

1 Attachment(s)
Yeah, i have entered data and i am even displaying this information on my postbit_legacy template with all the numbers showing up, but for some reason when i try the same thing on a member profile tab, nothing shows up.

I'm still trying to look for a way.. i know you can go into custom "profile field categories" and set it to display on it's own tab...i think it uses the template "memberinfo_block_profilefield" but even using that template the numbers don't show up in the code i used for postbit_legacy.

Thanks for helping me out on this! do you have any ideas Chris?

kh99 12-18-2014 10:21 AM

OK, I have no idea what my problem was yesterday, but I went back to using the plugin code and template code from the guide and got it to appear. Then I added a register line for userinfo, like:
Code:

$templater->register('userinfo', $userinfo);
(that goes near the bottom, registering to the memberinfo_block_test template).

Now here's where I might have steered you wrong, just because I was spacing out - you should add {vb:raw userinfo.field7} in the template (I don't know why I was forgetting the vb:raw part). Anyway, if that was the only problem you were having, I'm really sorry about that.

So if you can get those values displaying then you probably would want to add code to the plugin to calculate whatever values you need for the chart and register them to the template, then you just have to copy that chart html to your template and insert the parameters.

gfran5 12-18-2014 11:33 AM

You were pretty close, just forgot to mention to change (if $post) to (if $userinfo)... but thanks for your help. I will try get this chart working, if i have any questions i will post back.


All times are GMT. The time now is 12:16 PM.

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.01129 seconds
  • Memory Usage 1,756KB
  • 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
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete