/*======================================================================*\
|| #################################################################### ||
|| # vBExperience 3.8                                                 # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2006-2009 Marius Czyz. All Rights Reserved.           # ||
|| #################################################################### ||
\*======================================================================*/

This document is an addendum to the readme of vBExperience 3.8 and it's purpose is to explain the hooks needed to enable own custom data providers. Please study the product "product_vbexperience_cdp_example.xml" which contains a Custom Data Provider on base of attachmentviews.

Database
	- Setup
		For your own custom data provider you will need to setup the database:
		
		[CODE]
		if (!field_exists('xperience_stats', 'points_misc_YOURPROVIDER')) $vbulletin->db->query_write("ALTER TABLE " . TABLE_PREFIX . "xperience_stats ADD points_misc_YOURPROVIDER BIGINT DEFAULT '0'");
		[/CODE]


Code Hooks
	- xperience_calcdata
		This hook can be used to calculate own data and add it to existing main provider count_misc
		
		To add points to misc:
		[CODE]
		$xperience['count_misc'] += $xperience['count_misc_YOURPROVIDER'];
		[/CODE]

		To get the updates to the database, we need to update the SQL command.
		"$additionalsql" will contain the needed SQL command to enable the update of the provider:
		[CODE]
		points_misc_YOURPROVIDER=".$xperience['count_misc_YOURPROVIDER'].",
		[/CODE]
	
	
	- xperience_memberprofile
		You will have to pull the data from the database and prepare it:
		[CODE]
		global $vbphrase;
		$xperience_points_misc_YOURPROVIDER = vb_number_format($stat_q['points_misc_YOURPROVIDER']);
		eval('$this->block_data[xperience_points_misc_tpl] .= " ' . fetch_template('xpcdp_profile') . '";');
		[/CODE]
		
		You can use these variables to hook in the place you need:
		$block_data[xperience_points_user_tpl], $block_data[xperience_points_thread_tpl], $block_data[xperience_points_post_tpl], $block_data[xperience_points_misc_tpl]
		
		
		
	- xperience_earn_thread
	- xperience_earn_post
	- xperience_earn_misc
	- xperience_earn_user
		These hooks are used to display earn points to the user
		Use this call:
		[CODE]
		$earnpoints .= ResolveAssociation("xperience_points_cdp");
		[/CODE]
		
		"xperience_points_cdp" is the name of the setting. If your CDP is using a table you can check that also by adding the name of the table as a second parameter to ResolveAssociation.