Quote:
Originally Posted by MrShides
we got it all working, its www.free-collective.us.
it just began working on its own, maybe armory lag?
What I'd really like to do is get this added to the postbit using a custom profile field. That would be slick.
|
Create a new plugin, make sure that you select the WoW BB Code product
HookLocation: postbit_display_start
title : WoW Char Postbit
PHP code is as follows
Code:
// Change the Field2 to whatever custom profile field your have setup in the admincp.
// If your server field is 7 and your character field is 8, you would use
// $wowchar_server = $post['field7'];
// $wowchar_charname = $post['field8'];
////////////////////////////////////////////////////////////////////////////////////////
$wowchar_server = $post['field1'];
$wowchar_charname = $post['field2'];
global $vbulletin;
$wowchar_use_default = false;
if(!$wowchar_server)
{
$wowchar_server = $vbulletin->options['wowcharcode_default_realm'];
$wowchar_use_default = true;
}
if($wowchar_charname != false or $server != false)
{
$wowchar_charname = trim($wowchar_charname);
$wowchar_server = trim($wowchar_server);
//override default armory URL.
preg_match("/(EU|US)-(.*)/", $wowchar_server, $match);
if($match[1] == true)
{
$armory_locale = strtolower($match[1]);
$armory_server = $match[2];
} else {
$armory_locale = strtolower($vbulletin->options['wowcharcode_locale']);
$armory_server = $wowchar_server;
}
switch($armory_locale)
{
case 'eu':
$armoryurl = 'http://eu.wowarmory.com';
break;
case 'us':
$armoryurl = 'http://www.wowarmory.com';
break;
}
//$wowchar_code = "<img src='clientscript/wowbbcode_js/char.gif' border='0' align='middle'>";
$wowchar_code .= "<a href=\"".$armoryurl."/character-sheet.xml?r=".str_replace(" ","+",$armory_server)."&n=".$wowchar_charname."\"";
$wowchar_code .= " target=\"new\"";
$wowchar_code .= " onmouseover='ajax_showTooltip(\"".$vbulletin->options['bburl']."/ajax.php?do=wowcharcode&server={xserver}&char={charname}\",this);";
$wowchar_code .= " return false' onmouseout='ajax_hideTooltip()'>";
if($vbulletin->options['wowcharcode_display_realm'] == 0 && $wowchar_use_default == true)
{
$wowchar_code .= "<strong><{charname}></strong></a>";
} else {
$wowchar_code .= "<strong><{server}: {charname}></strong></a>";
}
$wowchar_server = str_replace("'","'",$wowchar_server);
$wowchar_code = str_replace("{xserver}",str_replace(" ","+",$wowchar_server), $wowchar_code);
$wowchar_code = str_replace("{server}",$wowchar_server, $wowchar_code);
$wowchar_code = str_replace("{charname}",$wowchar_charname, $wowchar_code);
} else {
$wowchar_code = false;
}
Be sure to read and edit the first few lines of the plugin code.
Save
The variable $wowchar_code is now avialable to use in the postbit (or postbit_legacy). The output is something like "<Vek'nilash: Azaril>"
It where ever you see fit.
The other error, you can fix it by opening up the functions_wowcharcode.php and replacing line 743
Code:
unset($char['characterinfo']['charactertab']['items']);
with
Code:
if(is_array($char['characterinfo']['charactertab']['items']))
{
unset($char['characterinfo']['charactertab']['items']);
}