vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Building a plugin need help (https://vborg.vbsupport.ru/showthread.php?t=287520)

demo7up 09-06-2012 11:22 AM

Building a plugin need help
 
I would like to build a plugin based on the following code

Code:

$json = file_get_contents("http://us.battle.net/api/wow/character/Shattered%20Hand/". $vbulletin->userinfo['username']."?fields=guild,items,professions,reputation,stats", true);
$decode = json_decode($json, true);
$name = " ". $decode[name] ."";
$realm = " ". $decode[realm] ."";
$ailevel = " ". $decode[items][averageItemLevel] ."";
$aeilevel = " ". $decode[items][averageItemLevelEquipped] ."";
$helm = " ". $decode[items][head][name] ."";
$Thumbnail = "". $decode[thumbnail] ."";
$guild_name = " ". $decode[guild][name] ."";

echo "<img src=\"http://us.battle.net/static-render/us/".$Thumbnail."\">";

It loads sucessfully but all the way at the top of the forum and pushes the board down.

doesnt matter where i add {vb:raw wowapi}

nhawk 09-06-2012 11:32 AM

Not knowing where you want it to appear makes it hard to help.

But the echo is what's doing it.

Change the echo to a template hook where you want it to appear.

ie:
Code:

$template_hook['postbit_userinfo_right'] .= "<img src=\"http://us.battle.net/static-render/us/".$Thumbnail."\">";

demo7up 09-06-2012 12:06 PM

How would i make this show under or above toplinks?

Thanks for your quick response

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

I think i figured it out i just have one problem....

Code:

$json = file_get_contents("http://us.battle.net/api/wow/character/Shattered%20Hand/". $vbulletin->userinfo['username']."?fields=guild,items,professions,reputation,stats", true);
the code above requires members to sign up with their character name..

how can i tell the script to die if the link fails to load?

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

Okay my plugin is working awesome with your guidance justt need help with on piece of code... please :)

what do i need to add to my code to not display the plugin if user is not logged in?

nhawk 09-07-2012 12:09 PM

Something like this would work...

PHP Code:

if ($vbulletin->userinfo['userid']) 

     
//Your Code Here




All times are GMT. The time now is 01:41 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.00981 seconds
  • Memory Usage 1,717KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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