PDA

View Full Version : Need help getting THIS code into a plugin


Mobo
11-11-2009, 10:56 AM
I am trying to get the below code from vBExperience to show up in a new user profile tab I created using [How-to] Add more tabs to the vB 3.7 profile pages (https://vborg.vbsupport.ru/showthread.php?t=165554&highlight=profile*).

Here is the all of the code from the vBExperience template (xperience_memberinfo_block)

<style type="text/css" id="memberinfo_css">
<!--
/**
* Experience Tab
*/
#vBExperience fieldset.vbexperience_group {
margin-top:6px;
}
#vBExperience fieldset.vbexperience_group ul {
padding:6px;
}
#vBExperience fieldset.vbexperience_group ul li {
margin-bottom:3px;
}
-->
</style>

<div class="alt1 block_row">
<if condition="$block_data[xperience_points] > 0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_name]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points]:</span> $block_data[xperience_points]</li>
<li><span class="shade">$vbphrase[xperience_level]:</span> $block_data[xperience_level]</li>
<if condition="!$vboptions[xperience_hideprofilegfx]">
<table width="200" cellpadding="0" cellspacing="0" >
<tr style="background-image:url($vboptions[bburl]/xperience/images/red_faded.png)">
<td width="5" height="11"><img alt="$vbphrase[xperience_points]: $block_data[xperience_points], $vbphrase[xperience_level]: $block_data[xperience_level]" src="$vboptions[bburl]/xperience/images/red_left.png" height="11" /></td>
<td style="background-image:url($vboptions[bburl]/xperience/images/red_faded.png)" height="11"><img alt="$vbphrase[xperience_points]: $block_data[xperience_points], $vbphrase[xperience_level]: $block_data[xperience_level]" src="$vboptions[bburl]/xperience/images/red.png" width="$block_data[xperience_levelp]%" height="11" /></td>
<td width="1" height="11"><img alt="$vbphrase[xperience_points]: $block_data[xperience_points], $vbphrase[xperience_level]: $block_data[xperience_level]" src="$vboptions[bburl]/xperience/images/red_right.png" height="11" /></td>
</tr>
</table>
</if>
<li><span class="shade">$vbphrase[xperience_level_up]:</span> $block_data[xperience_level_up]%</li>
<li><span class="shade">$vbphrase[xperience_points_needed]:</span> $block_data[xperience_level_up_points]</li>
<if condition="!$vboptions[xperience_hideprofilegfx]">
<table width="200" cellpadding="0" cellspacing="0" >
<tr style="background-image:url($vboptions[bburl]/xperience/images/grey_faded.png)">
<td width="5" height="11"><img alt="$vbphrase[xperience_level_up]: $block_data[xperience_level_up]% - $block_data[xperience_level_up_points] $vbphrase[xperience_points_needed]" src="$vboptions[bburl]/xperience/images/grey_left.png" height="11" /></td>
<td style="background-image:url($vboptions[bburl]/xperience/images/grey_faded.png)" height="11"><img alt="$vbphrase[xperience_level_up]: $block_data[xperience_level_up]%" src="$vboptions[bburl]/xperience/images/grey.png" width="$block_data[xperience_level_up]%" height="11" /></td>
<td width="1" height="11"><img alt="$vbphrase[xperience_level_up]: $block_data[xperience_level_up]% - $block_data[xperience_level_up_points] $vbphrase[xperience_points_needed]" src="$vboptions[bburl]/xperience/images/grey_right.png" height="11" /></td>
</tr>
</table>
</if>
<li><span class="shade">$vbphrase[xperience_activity]:</span> $block_data[xperience_activity]%</li>
<if condition="!$vboptions[xperience_hideprofilegfx]">
<table width="200" cellpadding="0" cellspacing="0" >
<tr>
<td width="5" height="11"><img alt="$vbphrase[xperience_activity]: $block_data[xperience_activity]%" src="$vboptions[bburl]/xperience/images/green_left.png" height="11" /><td>
<td style="background-image:url($vboptions[bburl]/xperience/images/green_faded.png)" height="11"><img alt="$vbphrase[xperience_activity]: $block_data[xperience_activity]%" src="$vboptions[bburl]/xperience/images/green.png" height="11" width="$block_data[xperience_activity]%" /><td>
<td width="1" height="11"><img alt="$vbphrase[xperience_activity]: $block_data[xperience_activity]%" src="$vboptions[bburl]/xperience/images/green_right.png" /></td>
</tr>
</table>
</if>
</ul>
<if condition="$vboptions[xperience_use_gap]">
<ul class="list_no_decoration">
<li><span class="shade"><a href="xperience.php?go=gap">$vbphrase[xperience_gap]</a></span></li>
</ul>

</if>
</fieldset>

<else />
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_name]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_no_data]</span></li>
</ul>
</fieldset>
</if>
<if condition="$vboptions[xperience_use_awards]">
<if condition="$vboptions[xperience_award_block] == 0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_awards_short]</legend>
<ul class="list_no_decoration">
<li>
<if condition="$block_data[xperience_awards]">
$block_data[xperience_awards]
<else />
$vbphrase[xperience_awards_empty]
</if>
</li>
<li>
<a href="xperience.php?go=awards">$vbphrase[xperience_awards_list]</a>
</li>
</ul>
</fieldset>
</if>
</if>

<if condition="$block_data[xperience_points_user]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_points_for_user]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_user]:</span> $block_data[xperience_points_user]</li>
<if condition="$block_data[xperience_points_user_infractions] > 0"><li><span class="shade">$vbphrase[xperience_points_user_infractions]:</span> <if condition="$block_data[xperience_points_user_infractions]<0">-</if>$block_data[xperience_points_user_infractions]</li></if>
<if condition="$block_data[xperience_points_user_reputation] > 0"><li><span class="shade">$vbphrase[xperience_points_user_reputation]:</span> $block_data[xperience_points_user_reputation]</li></if>
<if condition="$block_data[xperience_points_user_reputation_use] > 0"><li><span class="shade">$vbphrase[xperience_points_user_reputation_use]:</span> $block_data[xperience_points_user_reputation_use]</li></if>
<if condition="$block_data[xperience_points_user_online] > 0"><li><span class="shade">$vbphrase[xperience_points_user_online]:</span> $block_data[xperience_points_user_online]</li></if>
<if condition="$block_data[xperience_points_user_socialgroup] > 0"><li><span class="shade">$vbphrase[xperience_points_user_socialgroup]:</span> $block_data[xperience_points_user_socialgroup]</li></if>
<if condition="$block_data[xperience_points_user_friends] > 0"><li><span class="shade">$vbphrase[xperience_points_user_friends]:</span> $block_data[xperience_points_user_friends]</li></if>
<if condition="$block_data[xperience_points_user_visitormessages] > 0"><li><span class="shade">$vbphrase[xperience_points_user_visitormessages]:</span> $block_data[xperience_points_user_visitormessages]</li></if>
<if condition="$block_data[xperience_points_user_albumpictures] > 0"><li><span class="shade">$vbphrase[xperience_points_user_albumpictures]:</span> $block_data[xperience_points_user_albumpictures]</li></if>
<if condition="$block_data[xperience_points_user_referrals] > 0"><li><span class="shade">$vbphrase[xperience_points_user_referrals]:</span> $block_data[xperience_points_user_referrals]</li></if>
<if condition="$block_data[xperience_points_user_profile] > 0"><li><span class="shade">$vbphrase[xperience_points_user_profile]:</span> $block_data[xperience_points_user_profile]</li></if>
$block_data[xperience_points_user_tpl]
</ul>
</fieldset>
</if>
<if condition="$block_data[xperience_points_thread]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_points_for_thread]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_thread]:</span> $block_data[xperience_points_thread]</li>
<if condition="$block_data[xperience_points_threads] > 0"><li><span class="shade">$vbphrase[xperience_points_threads]:</span> $block_data[xperience_points_threads]</li></if>
<if condition="$block_data[xperience_points_threads_sg] > 0"><li><span class="shade">$vbphrase[xperience_points_threads_sg]:</span> $block_data[xperience_points_threads_sg]</li></if>
<if condition="$block_data[xperience_points_thread_tags] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_tags]:</span> $block_data[xperience_points_thread_tags]</li></if>
<if condition="$block_data[xperience_points_thread_votes] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_votes]:</span> $block_data[xperience_points_thread_votes]</li></if>
<if condition="$block_data[xperience_points_thread_replycount] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_replycount]:</span> $block_data[xperience_points_thread_replycount]</li></if>
<if condition="$block_data[xperience_points_thread_views] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_views]:</span> $block_data[xperience_points_thread_views]</li></if>
<if condition="$block_data[xperience_points_thread_stickies] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_stickies]:</span> $block_data[xperience_points_thread_stickies]</li></if>
$block_data[xperience_points_thread_tpl]
</ul>
</fieldset>
</if>
<if condition="$block_data[xperience_points_post]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_points_for_post]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_post]:</span> $block_data[xperience_points_post]</li>
<if condition="$block_data[xperience_points_posts] > 0"><li><span class="shade">$vbphrase[xperience_points_posts]:</span> $block_data[xperience_points_posts]</li></if>
<if condition="$block_data[xperience_points_posts_sg] > 0"><li><span class="shade">$vbphrase[xperience_points_posts_sg]:</span> $block_data[xperience_points_posts_sg]</li></if>
<if condition="$block_data[xperience_points_post_attachment] > 0"><li><span class="shade">$vbphrase[xperience_points_post_attachment]:</span> $block_data[xperience_points_post_attachment]</li></if>
<if condition="$block_data[xperience_points_post_attachment_views] > 0"><li><span class="shade">$vbphrase[xperience_points_post_attachment_views]:</span> $block_data[xperience_points_post_attachment_views]</li></if>
<if condition="$block_data[xperience_points_post_thanks] > 0"><li><span class="shade">$vbphrase[xperience_points_post_thanks]:</span> $block_data[xperience_points_post_thanks]</li></if>
<if condition="$block_data[xperience_points_post_thanks_use] > 0"><li><span class="shade">$vbphrase[xperience_points_post_thanks_use]:</span> $block_data[xperience_points_post_thanks_use]</li></if>
<if condition="$block_data[xperience_points_post_avg] > 0"><li><span class="shade">$vbphrase[xperience_points_post_avg]:</span> $block_data[xperience_points_post_avg]</li></if>
$block_data[xperience_points_post_tpl]
</ul>
</fieldset>
</if>
<if condition="$block_data[xperience_points_misc]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_points_for_misc]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_misc]:</span> $block_data[xperience_points_misc]</li>
<if condition="$block_data[xperience_points_misc_ldm] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_ldm]:</span> $block_data[xperience_points_misc_ldm]</li></if>
<if condition="$block_data[xperience_points_misc_dl2] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_dl2]:</span> $block_data[xperience_points_misc_dl2]</li></if>
<if condition="$block_data[xperience_points_misc_ppd] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_ppd]:</span> $block_data[xperience_points_misc_ppd]</li></if>
<if condition="$block_data[xperience_points_misc_vbblog] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_vbblog]:</span> $block_data[xperience_points_misc_vbblog]</li></if>
<if condition="$block_data[xperience_points_misc_events] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_events]:</span> $block_data[xperience_points_misc_events]</li></if>
<if condition="$block_data[xperience_points_misc_custom]<>0"><li><span class="shade">$vbphrase[xperience_points_misc_custom]:</span> $block_data[xperience_points_misc_custom]</li></if>
$block_data[xperience_points_misc_tpl]
</ul>
</fieldset>
</if>
<if condition="$block_data[xperience_points_shop]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_shop]:</span> $block_data[xperience_points_shop]</li>
</ul>
<table>
<tr>
$block_data[xperience_shop_items]
</tr>
</table>
</fieldset>
</if>
<if condition="$block_data[xperience_shop_items_received] ">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop_items_received]</legend>
<table>
<tr>
$block_data[xperience_shop_items_received]
</tr>
</table>


</fieldset>
</if>

<if condition="$vboptions[xperience_use_activities]">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_activities]</legend>
<ul class="list_no_decoration">
<li><span class="shade"><a href="xperience.php?go=activities">$vbphrase[xperience_activities]</a></span></li>
</ul>
$block_data[xperience_activities]
</fieldset>
</if>

</div>


I'm pretty sure this is all the code that I need from that...

<if condition="$block_data[xperience_points_shop]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_shop]:</span> $block_data[xperience_points_shop]</li>
</ul>
<table>
<tr>
$block_data[xperience_shop_items]
</tr>
</table>
</fieldset>
</if>
<if condition="$block_data[xperience_shop_items_received] ">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop_items_received]</legend>
<table>
<tr>
$block_data[xperience_shop_items_received]
</tr>
</table>


</fieldset>
</if>

This is the code I have in my plugin...

$blocklist = array_merge($blocklist, array(
'mymodification' => array(
'class' => 'MyModification',
'title' => 'Planes Owned',
'hook_location' => 'profile_left_last'
)
));

class vB_ProfileBlock_MyModification extends vB_ProfileBlock
{
var $template_name = 'memberinfo_block_mymodification';

function confirm_empty_wrap()
{
return false;
}

function confirm_display()
{
return ($this->block_data['mymodification'] != '');
}

function prepare_output($id = '', $options = array())
{
$this->block_data['mymodification'] = '<if condition="$block_data[xperience_points_shop]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_shop]:</span> $block_data[xperience_points_shop]</li>
</ul>
<table>
<tr>
$block_data[xperience_shop_items]
</tr>
</table>
</fieldset>
</if>
<if condition="$block_data[xperience_shop_items_received] ">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop_items_received]</legend>
<table>
<tr>
$block_data[xperience_shop_items_received]
</tr>
</table>


</fieldset>
</if>';
}
}

And this is what gets displayed in my new tab (http://www.wingsofwar.org/forums/member.php?u=4), called Planes Owned...


$vbphrase[xperience_shop]

* $vbphrase[xperience_points_shop]: $block_data[xperience_points_shop]

$block_data[xperience_shop_items]
$vbphrase[xperience_shop_items_received] $block_data[xperience_shop_items_received]

Can anyone help me get this code working in a new tab please?

Thank you for your time and any help!

kh99
11-13-2009, 11:39 AM
I think the problem is that in your "prepare_output" function you can't just set "$this->block_data['mymodification']" to a template, it would have to be HTML at that point. So I think what you'd want to do is create a new template (in the Style Manager) and put your template code in there. Then make your prepare_output something like this:

function prepare_output($id = '', $options = array())
{
eval('$this->block_data[mymodification] ="' . fetch_template('new_template_name') . '";');
}

(but of course you want to replace new_template_name with whatever you actually name your template).

Mobo
11-13-2009, 02:30 PM
Thanks for the help kh99. Trying to follow what you suggested, I did this...

New template called exp_shop_tab containing:

<if condition="$block_data[xperience_points_shop]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_shop]:</span> $block_data[xperience_points_shop]</li>
</ul>
<table>
<tr>
$block_data[xperience_shop_items]
</tr>
</table>
</fieldset>
</if>
<if condition="$block_data[xperience_shop_items_received] ">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop_items_received]</legend>
<table>
<tr>
$block_data[xperience_shop_items_received]
</tr>
</table>


</fieldset>
</if>

Plugin edited to contain this code:

function prepare_output($id = '', $options = array())
{
eval('$this->block_data[mymodification] ="' . fetch_template('exp_shop_tab') . '";');
}

That returns this error on my page (page still loads, but many tabs are missing and error message is at the top of the page):

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /hermes/web05/b980/pow.mobowow/htdocs/forums/member.php(463) : eval()'d code on line 307

Lynne
11-13-2009, 02:41 PM
You can't just throw all that stuff into prepare_output when you haven't even 'prepared' it. Where is the variable "$block_data[xperience_shop_items]" (and similar) getting defined? You need to define them all.

Mobo
11-13-2009, 02:54 PM
Lynne, not sure what you mean by "getting defined". "$block_data[xperience_shop_items]" is located in the template "xperience_memberinfo_block" and has the following code:

<style type="text/css" id="memberinfo_css">
<!--
/**
* Experience Tab
*/
#vBExperience fieldset.vbexperience_group {
margin-top:6px;
}
#vBExperience fieldset.vbexperience_group ul {
padding:6px;
}
#vBExperience fieldset.vbexperience_group ul li {
margin-bottom:3px;
}
-->
</style>

<div class="alt1 block_row">
<if condition="$block_data[xperience_points] > 0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_name]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points]:</span> $block_data[xperience_points]</li>
<li><span class="shade">$vbphrase[xperience_level]:</span> $block_data[xperience_level]</li>
<if condition="!$vboptions[xperience_hideprofilegfx]">
<table width="200" cellpadding="0" cellspacing="0" >
<tr style="background-image:url($vboptions[bburl]/xperience/images/red_faded.png)">
<td width="5" height="11"><img alt="$vbphrase[xperience_points]: $block_data[xperience_points], $vbphrase[xperience_level]: $block_data[xperience_level]" src="$vboptions[bburl]/xperience/images/red_left.png" height="11" /></td>
<td style="background-image:url($vboptions[bburl]/xperience/images/red_faded.png)" height="11"><img alt="$vbphrase[xperience_points]: $block_data[xperience_points], $vbphrase[xperience_level]: $block_data[xperience_level]" src="$vboptions[bburl]/xperience/images/red.png" width="$block_data[xperience_levelp]%" height="11" /></td>
<td width="1" height="11"><img alt="$vbphrase[xperience_points]: $block_data[xperience_points], $vbphrase[xperience_level]: $block_data[xperience_level]" src="$vboptions[bburl]/xperience/images/red_right.png" height="11" /></td>
</tr>
</table>
</if>
<li><span class="shade">$vbphrase[xperience_level_up]:</span> $block_data[xperience_level_up]%</li>
<li><span class="shade">$vbphrase[xperience_points_needed]:</span> $block_data[xperience_level_up_points]</li>
<if condition="!$vboptions[xperience_hideprofilegfx]">
<table width="200" cellpadding="0" cellspacing="0" >
<tr style="background-image:url($vboptions[bburl]/xperience/images/grey_faded.png)">
<td width="5" height="11"><img alt="$vbphrase[xperience_level_up]: $block_data[xperience_level_up]% - $block_data[xperience_level_up_points] $vbphrase[xperience_points_needed]" src="$vboptions[bburl]/xperience/images/grey_left.png" height="11" /></td>
<td style="background-image:url($vboptions[bburl]/xperience/images/grey_faded.png)" height="11"><img alt="$vbphrase[xperience_level_up]: $block_data[xperience_level_up]%" src="$vboptions[bburl]/xperience/images/grey.png" width="$block_data[xperience_level_up]%" height="11" /></td>
<td width="1" height="11"><img alt="$vbphrase[xperience_level_up]: $block_data[xperience_level_up]% - $block_data[xperience_level_up_points] $vbphrase[xperience_points_needed]" src="$vboptions[bburl]/xperience/images/grey_right.png" height="11" /></td>
</tr>
</table>
</if>
<li><span class="shade">$vbphrase[xperience_activity]:</span> $block_data[xperience_activity]%</li>
<if condition="!$vboptions[xperience_hideprofilegfx]">
<table width="200" cellpadding="0" cellspacing="0" >
<tr>
<td width="5" height="11"><img alt="$vbphrase[xperience_activity]: $block_data[xperience_activity]%" src="$vboptions[bburl]/xperience/images/green_left.png" height="11" /><td>
<td style="background-image:url($vboptions[bburl]/xperience/images/green_faded.png)" height="11"><img alt="$vbphrase[xperience_activity]: $block_data[xperience_activity]%" src="$vboptions[bburl]/xperience/images/green.png" height="11" width="$block_data[xperience_activity]%" /><td>
<td width="1" height="11"><img alt="$vbphrase[xperience_activity]: $block_data[xperience_activity]%" src="$vboptions[bburl]/xperience/images/green_right.png" /></td>
</tr>
</table>
</if>
</ul>
<if condition="$vboptions[xperience_use_gap]">
<ul class="list_no_decoration">
<li><span class="shade"><a href="xperience.php?go=gap">$vbphrase[xperience_gap]</a></span></li>
</ul>

</if>
</fieldset>

<else />
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_name]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_no_data]</span></li>
</ul>
</fieldset>
</if>
<if condition="$vboptions[xperience_use_awards]">
<if condition="$vboptions[xperience_award_block] == 0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_awards_short]</legend>
<ul class="list_no_decoration">
<li>
<if condition="$block_data[xperience_awards]">
$block_data[xperience_awards]
<else />
$vbphrase[xperience_awards_empty]
</if>
</li>
<li>
<a href="xperience.php?go=awards">$vbphrase[xperience_awards_list]</a>
</li>
</ul>
</fieldset>
</if>
</if>

<if condition="$block_data[xperience_points_user]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_points_for_user]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_user]:</span> $block_data[xperience_points_user]</li>
<if condition="$block_data[xperience_points_user_infractions] > 0"><li><span class="shade">$vbphrase[xperience_points_user_infractions]:</span> <if condition="$block_data[xperience_points_user_infractions]<0">-</if>$block_data[xperience_points_user_infractions]</li></if>
<if condition="$block_data[xperience_points_user_reputation] > 0"><li><span class="shade">$vbphrase[xperience_points_user_reputation]:</span> $block_data[xperience_points_user_reputation]</li></if>
<if condition="$block_data[xperience_points_user_reputation_use] > 0"><li><span class="shade">$vbphrase[xperience_points_user_reputation_use]:</span> $block_data[xperience_points_user_reputation_use]</li></if>
<if condition="$block_data[xperience_points_user_online] > 0"><li><span class="shade">$vbphrase[xperience_points_user_online]:</span> $block_data[xperience_points_user_online]</li></if>
<if condition="$block_data[xperience_points_user_socialgroup] > 0"><li><span class="shade">$vbphrase[xperience_points_user_socialgroup]:</span> $block_data[xperience_points_user_socialgroup]</li></if>
<if condition="$block_data[xperience_points_user_friends] > 0"><li><span class="shade">$vbphrase[xperience_points_user_friends]:</span> $block_data[xperience_points_user_friends]</li></if>
<if condition="$block_data[xperience_points_user_visitormessages] > 0"><li><span class="shade">$vbphrase[xperience_points_user_visitormessages]:</span> $block_data[xperience_points_user_visitormessages]</li></if>
<if condition="$block_data[xperience_points_user_albumpictures] > 0"><li><span class="shade">$vbphrase[xperience_points_user_albumpictures]:</span> $block_data[xperience_points_user_albumpictures]</li></if>
<if condition="$block_data[xperience_points_user_referrals] > 0"><li><span class="shade">$vbphrase[xperience_points_user_referrals]:</span> $block_data[xperience_points_user_referrals]</li></if>
<if condition="$block_data[xperience_points_user_profile] > 0"><li><span class="shade">$vbphrase[xperience_points_user_profile]:</span> $block_data[xperience_points_user_profile]</li></if>
$block_data[xperience_points_user_tpl]
</ul>
</fieldset>
</if>
<if condition="$block_data[xperience_points_thread]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_points_for_thread]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_thread]:</span> $block_data[xperience_points_thread]</li>
<if condition="$block_data[xperience_points_threads] > 0"><li><span class="shade">$vbphrase[xperience_points_threads]:</span> $block_data[xperience_points_threads]</li></if>
<if condition="$block_data[xperience_points_threads_sg] > 0"><li><span class="shade">$vbphrase[xperience_points_threads_sg]:</span> $block_data[xperience_points_threads_sg]</li></if>
<if condition="$block_data[xperience_points_thread_tags] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_tags]:</span> $block_data[xperience_points_thread_tags]</li></if>
<if condition="$block_data[xperience_points_thread_votes] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_votes]:</span> $block_data[xperience_points_thread_votes]</li></if>
<if condition="$block_data[xperience_points_thread_replycount] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_replycount]:</span> $block_data[xperience_points_thread_replycount]</li></if>
<if condition="$block_data[xperience_points_thread_views] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_views]:</span> $block_data[xperience_points_thread_views]</li></if>
<if condition="$block_data[xperience_points_thread_stickies] > 0"><li><span class="shade">$vbphrase[xperience_points_thread_stickies]:</span> $block_data[xperience_points_thread_stickies]</li></if>
$block_data[xperience_points_thread_tpl]
</ul>
</fieldset>
</if>
<if condition="$block_data[xperience_points_post]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_points_for_post]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_post]:</span> $block_data[xperience_points_post]</li>
<if condition="$block_data[xperience_points_posts] > 0"><li><span class="shade">$vbphrase[xperience_points_posts]:</span> $block_data[xperience_points_posts]</li></if>
<if condition="$block_data[xperience_points_posts_sg] > 0"><li><span class="shade">$vbphrase[xperience_points_posts_sg]:</span> $block_data[xperience_points_posts_sg]</li></if>
<if condition="$block_data[xperience_points_post_attachment] > 0"><li><span class="shade">$vbphrase[xperience_points_post_attachment]:</span> $block_data[xperience_points_post_attachment]</li></if>
<if condition="$block_data[xperience_points_post_attachment_views] > 0"><li><span class="shade">$vbphrase[xperience_points_post_attachment_views]:</span> $block_data[xperience_points_post_attachment_views]</li></if>
<if condition="$block_data[xperience_points_post_thanks] > 0"><li><span class="shade">$vbphrase[xperience_points_post_thanks]:</span> $block_data[xperience_points_post_thanks]</li></if>
<if condition="$block_data[xperience_points_post_thanks_use] > 0"><li><span class="shade">$vbphrase[xperience_points_post_thanks_use]:</span> $block_data[xperience_points_post_thanks_use]</li></if>
<if condition="$block_data[xperience_points_post_avg] > 0"><li><span class="shade">$vbphrase[xperience_points_post_avg]:</span> $block_data[xperience_points_post_avg]</li></if>
$block_data[xperience_points_post_tpl]
</ul>
</fieldset>
</if>
<if condition="$block_data[xperience_points_misc]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_points_for_misc]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_misc]:</span> $block_data[xperience_points_misc]</li>
<if condition="$block_data[xperience_points_misc_ldm] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_ldm]:</span> $block_data[xperience_points_misc_ldm]</li></if>
<if condition="$block_data[xperience_points_misc_dl2] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_dl2]:</span> $block_data[xperience_points_misc_dl2]</li></if>
<if condition="$block_data[xperience_points_misc_ppd] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_ppd]:</span> $block_data[xperience_points_misc_ppd]</li></if>
<if condition="$block_data[xperience_points_misc_vbblog] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_vbblog]:</span> $block_data[xperience_points_misc_vbblog]</li></if>
<if condition="$block_data[xperience_points_misc_events] > 0"><li><span class="shade">$vbphrase[xperience_points_misc_events]:</span> $block_data[xperience_points_misc_events]</li></if>
<if condition="$block_data[xperience_points_misc_custom]<>0"><li><span class="shade">$vbphrase[xperience_points_misc_custom]:</span> $block_data[xperience_points_misc_custom]</li></if>
$block_data[xperience_points_misc_tpl]
</ul>
</fieldset>
</if>
<if condition="$block_data[xperience_points_shop]<>0">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop]</legend>
<ul class="list_no_decoration">
<li><span class="shade">$vbphrase[xperience_points_shop]:</span> $block_data[xperience_points_shop]</li>
</ul>
<table>
<tr>
$block_data[xperience_shop_items]
</tr>
</table>
</fieldset>
</if>
<if condition="$block_data[xperience_shop_items_received] ">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_shop_items_received]</legend>
<table>
<tr>
$block_data[xperience_shop_items_received]
</tr>
</table>


</fieldset>
</if>

<if condition="$vboptions[xperience_use_activities]">
<fieldset class="vbexperience_group">
<legend>$vbphrase[xperience_activities]</legend>
<ul class="list_no_decoration">
<li><span class="shade"><a href="xperience.php?go=activities">$vbphrase[xperience_activities]</a></span></li>
</ul>
$block_data[xperience_activities]
</fieldset>
</if>

</div>

I just pulled the code in red out as that was already displaying in the profile tab that the product created and tried plugging it into a new tab that I created.

kh99
11-13-2009, 03:01 PM
Thanks for the help kh99. Trying to follow what you suggested, I did this...


Hmm...well, I thought at first there was a typo in the code but I threw it in a test site and it works here without an error. I dont have the vBExperience stuff, but at least it's not a typo in the code.

Have you tried just using the example:

function prepare_output($id = '', $options = array())
{
$this->block_data['mymodification'] = 'Content to show in the tab.';
}
To see if that works at all?

ETA: Never mind - you that much working before we started.

Lynne may have a point, I was assuming that stuff was set elsewhere.

Mobo
11-13-2009, 03:06 PM
Yes, I was able to get "Content to show in the tab." to display following the example in the Tab Tutorial.

I would think all the necessary "parts" would have already been set/defined by the product vBExperience and that I would just need to call them some how in my new tab.

kh99
11-13-2009, 03:09 PM
Yeah, sorry - I realized after posting that that you already had it basically working.

OK, maybe try this - put back the code I suggested, but this time use the name of any other template (or create another new template with just some simple HTML).


I would think all the necessary "parts" would have already been set/defined by the product vBExperience and that I would just need to call them some how in my new tab.

It's possible that there needs to be more code to get everything in that template to work, but looking at the template, if stuff is undefined I think it should just end up being blank (rather than causing an error).

Mobo
11-13-2009, 03:17 PM
Okay, it put your suggestions back in and told it to fetch the "xperience_memberinfo_block" template... that's the one vBExperience makes on it's own and displays the section I want displayed. I got the same error as before.

Lynne
11-13-2009, 03:19 PM
The template just *uses* the variables, it doesn't define them. Where are you defining them? I've seen no code posted that actually calls the database or anything else that would define these variables. You need to define them before you can actually use them.

Mobo
11-13-2009, 03:20 PM
Would they be defined in the plugin for the vBExperience product?

kh99
11-13-2009, 03:21 PM
Hmm...OK, I guess that probably means there's something wrong with the little snippet of code I posted.

Try this instead:

function prepare_output($id = '', $options = array())
{
eval('$this->block_data[\'mymodification\'] ="' . fetch_template('exp_shop_tab') . '";');
}

Mobo
11-13-2009, 03:23 PM
The plugin is to large to qoute in the post, so here it is if anyone need to look into it

**plugin removed**

Mobo
11-13-2009, 03:25 PM
Hmm...OK, I guess that probably means there's something wrong with the little snippet of code I posted.

Try this instead:

function prepare_output($id = '', $options = array())
{
eval('$this->block_data[\'mymodification\'] ="' . fetch_template('exp_shop_tab') . '";');
}

Nope, same error.

kh99
11-13-2009, 03:41 PM
Well, I'm almost out of ideas. I tried to actually install that product but I guess there are other files that go with it.

Just to humor me - maybe try another template, this time a simple one, to try to track down whether it's related to the vBExperience stuff or the plugin code.

ETA: actually, also try this:

function prepare_output($id = '', $options = array())
{
$this->block_data['mymodification'] = fetch_template('exp_shop_tab') ;
}

which won't look right but might tell us something about the problem.

Mobo
11-13-2009, 03:42 PM
I'll try a simple template. You only need to install that plugin and a levels plugin that comes with it in the zip file... just fyi.

--------------- Added 1258134428 at 1258134428 ---------------

I tried putting the template "memberinfo_block_aboutme" which is straight vB and it returned the same error.

Maybe Lynne will take pity on me and look into it more. I've actually learned quite a bit form other things she has helped me on!

kh99
11-13-2009, 03:48 PM
OK - sorry I couldn't help.

Mobo
11-13-2009, 03:49 PM
No need to be sorry, thank you very much for trying to help!

Lynne
11-13-2009, 03:55 PM
I removed the plugin/product from your post. You may not post someone else's product without their permission.

Mobo
11-13-2009, 08:42 PM
Ahh, sorry about that and thanks!