joshskeety
01-06-2010, 10:43 AM
No matter what I do I can't get this CDP to award points or achievements for users who have vBookie cash. Here is the code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="xpvbookie" active="1">
<title>vBExperience Vbookie Points</title>
<description>Example of use of vBExperience Hooks to include a custom data provider</description>
<version>1.2.0</version>
<dependencies>
<dependency dependencytype="product" parentproductid="xperience38" minversion="3.8.0" maxversion="" />
</dependencies>
<codes>
<code version="1.0.0">
<installcode><![CDATA[
if (!field_exists('xperience_stats', 'points_misc_vbookie')) $vbulletin->db->query_write("ALTER TABLE " . TABLE_PREFIX . "xperience_stats ADD points_misc_vbookie BIGINT DEFAULT '0'");
function field_exists($table, $field)
{
global $vbulletin;
return ($vbulletin->db->num_rows($vbulletin->db->query_read("SHOW COLUMNS FROM `" . TABLE_PREFIX .$table."` LIKE '".$field."'"))> 0);
}
]]></installcode>
<uninstallcode><![CDATA[
if (field_exists('xperience_stats', 'points_misc_vbookie')) $vbulletin->db->query_write("ALTER TABLE " . TABLE_PREFIX . "xperience_stats DROP points_misc_vbookie");
function field_exists($table, $field)
{
global $vbulletin;
return ($vbulletin->db->num_rows($vbulletin->db->query_read("SHOW COLUMNS FROM `" . TABLE_PREFIX .$table."` LIKE '".$field."'"))> 0);
}]]></uninstallcode>
</code>
</codes>
<templates>
<template name="xpvbookie_profile" templatetype="template" date="1205333644" username="Phalynx" version="1.0.0"><![CDATA[
<if condition="$xperience_points_misc_vbookie<>0"><li><span class="shade">$vbphrase[xperience_points_misc_vbookie]:</span> $xperience_points_misc_vbookie/li></if>
]]></template>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>vBExperience Vbookie Points (xperience_calcdata)</title>
<hookname>xperience_calcdata</hookname>
<phpcode><![CDATA[
if ($vbulletin->options['xperience_points_vbookie'] > 0)
{
if ($DoDebug==1) echo "<br/>Vbookie Points";
$attq = $vbulletin->db->query_read("SELECT
vbookie_cash
FROM " . TABLE_PREFIX . "user
WHERE userid=".$user['userid']."
if ($vbulletin->db->num_rows($attq) > 0)
{
$att = $vbulletin->db->fetch_array($attq);
$xperience['count_misc_vbookie'] = $att['sum_cash'] * $vbulletin->options['xperience_points_vbookie'];
$xperience['count_misc'] += $xperience['count_misc_vbookie'];
}
}
]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title><![CDATA[vBExperience Vbookie Points (xperience_earn_misc)]]]></title>
<hookname>xperience_earn_misc</hookname>
<phpcode><![CDATA[
$earnpoints .= ResolveAssociation("xperience_points_vbookie, "", "points_misc_vbookie");
]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title><![CDATA[vBExperience Vbookie Points (xperience_memberprofile)]]]></title>
<hookname>xperience_memberprofile</hookname>
<phpcode><![CDATA[
global $vbphrase;
$xperience_points_misc_vbookie = vb_number_format($stat_q['points_misc_vbookie']);
eval('$this->block_data[xperience_points_misc_tpl] .= " ' . fetch_template('xpvbookie_profile') . '";');
]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>vBExperience Vbookie Points (cache_templates)</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[
if ($vbulletin->options['xperience_enabled']) {
$globaltemplates = array_merge($globaltemplates, array(
'xpvbookie_profile'
));
}
]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="GLOBAL" fieldname="global">
<phrase name="xperience_points_misc_vbookie" date="0" username="Phalynx" version="1.0.0"><![CDATA[Vbookie Points]]></phrase>
</phrasetype>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_xperience_points_vbookie_desc" date="1205333644" username="Phalynx" version="1.0.0"><![CDATA[How many points should be given for Vbookie?]]></phrase>
<phrase name="setting_xperience_points_vbookie_title" date="1205333644" username="Phalynx" version="1.0.0"><![CDATA[Points for Vbookie]]></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="xperience_points" displayorder="7502">
<setting varname="xperience_points_vbookie" displayorder="300">
<defaultvalue>2</defaultvalue>
</setting>
</settinggroup>
</options>
</product>
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="xpvbookie" active="1">
<title>vBExperience Vbookie Points</title>
<description>Example of use of vBExperience Hooks to include a custom data provider</description>
<version>1.2.0</version>
<dependencies>
<dependency dependencytype="product" parentproductid="xperience38" minversion="3.8.0" maxversion="" />
</dependencies>
<codes>
<code version="1.0.0">
<installcode><![CDATA[
if (!field_exists('xperience_stats', 'points_misc_vbookie')) $vbulletin->db->query_write("ALTER TABLE " . TABLE_PREFIX . "xperience_stats ADD points_misc_vbookie BIGINT DEFAULT '0'");
function field_exists($table, $field)
{
global $vbulletin;
return ($vbulletin->db->num_rows($vbulletin->db->query_read("SHOW COLUMNS FROM `" . TABLE_PREFIX .$table."` LIKE '".$field."'"))> 0);
}
]]></installcode>
<uninstallcode><![CDATA[
if (field_exists('xperience_stats', 'points_misc_vbookie')) $vbulletin->db->query_write("ALTER TABLE " . TABLE_PREFIX . "xperience_stats DROP points_misc_vbookie");
function field_exists($table, $field)
{
global $vbulletin;
return ($vbulletin->db->num_rows($vbulletin->db->query_read("SHOW COLUMNS FROM `" . TABLE_PREFIX .$table."` LIKE '".$field."'"))> 0);
}]]></uninstallcode>
</code>
</codes>
<templates>
<template name="xpvbookie_profile" templatetype="template" date="1205333644" username="Phalynx" version="1.0.0"><![CDATA[
<if condition="$xperience_points_misc_vbookie<>0"><li><span class="shade">$vbphrase[xperience_points_misc_vbookie]:</span> $xperience_points_misc_vbookie/li></if>
]]></template>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>vBExperience Vbookie Points (xperience_calcdata)</title>
<hookname>xperience_calcdata</hookname>
<phpcode><![CDATA[
if ($vbulletin->options['xperience_points_vbookie'] > 0)
{
if ($DoDebug==1) echo "<br/>Vbookie Points";
$attq = $vbulletin->db->query_read("SELECT
vbookie_cash
FROM " . TABLE_PREFIX . "user
WHERE userid=".$user['userid']."
if ($vbulletin->db->num_rows($attq) > 0)
{
$att = $vbulletin->db->fetch_array($attq);
$xperience['count_misc_vbookie'] = $att['sum_cash'] * $vbulletin->options['xperience_points_vbookie'];
$xperience['count_misc'] += $xperience['count_misc_vbookie'];
}
}
]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title><![CDATA[vBExperience Vbookie Points (xperience_earn_misc)]]]></title>
<hookname>xperience_earn_misc</hookname>
<phpcode><![CDATA[
$earnpoints .= ResolveAssociation("xperience_points_vbookie, "", "points_misc_vbookie");
]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title><![CDATA[vBExperience Vbookie Points (xperience_memberprofile)]]]></title>
<hookname>xperience_memberprofile</hookname>
<phpcode><![CDATA[
global $vbphrase;
$xperience_points_misc_vbookie = vb_number_format($stat_q['points_misc_vbookie']);
eval('$this->block_data[xperience_points_misc_tpl] .= " ' . fetch_template('xpvbookie_profile') . '";');
]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>vBExperience Vbookie Points (cache_templates)</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[
if ($vbulletin->options['xperience_enabled']) {
$globaltemplates = array_merge($globaltemplates, array(
'xpvbookie_profile'
));
}
]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="GLOBAL" fieldname="global">
<phrase name="xperience_points_misc_vbookie" date="0" username="Phalynx" version="1.0.0"><![CDATA[Vbookie Points]]></phrase>
</phrasetype>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_xperience_points_vbookie_desc" date="1205333644" username="Phalynx" version="1.0.0"><![CDATA[How many points should be given for Vbookie?]]></phrase>
<phrase name="setting_xperience_points_vbookie_title" date="1205333644" username="Phalynx" version="1.0.0"><![CDATA[Points for Vbookie]]></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="xperience_points" displayorder="7502">
<setting varname="xperience_points_vbookie" displayorder="300">
<defaultvalue>2</defaultvalue>
</setting>
</settinggroup>
</options>
</product>