<?php
// Ensure we have everything in order
$thread['userid'] = $thread['postuserid'];
VBSHOP::verify_purchases($thread);

foreach ($thread['dbtech_vbshop_purchase'] as $purchaseid => $purchase)
{
	if ($purchase['feature'] != 'item' OR $purchase['userid'] != $thread['userid'])
	{
		// Skip the feature
		continue;
	}
	
	if (!$purchase['active'])
	{
		// Skip the feature
		continue;
	}
	
	if (!$item = VBSHOP::$cache[$purchase['feature']][$purchase['featureid']])
	{
		// Skip this
		continue;
	}

	if (!$item['active'])
	{
		// Skip this
		continue;
	}
	
	// Init item
	$itemobj = VBSHOP::init_item(array_merge($item, $purchase));
	
	if (method_exists($itemobj, 'fetch_mthread'))
	{
		// Override permissions caching
		$itemobj->fetch_mthread($thread);
	}
}
?>