Function Reference: geodir_get_default_package

Summary

This function has not been documented yet.

Filters

‘geodir_default_package_info’ [Line: 1277]

Source Code

function geodir_get_default_package($post_type){
	global $wpdb;
	
	$post_types = geodir_get_posttypes();
	
	if(!$wpdb->get_var($wpdb->prepare("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type=%s", array($post_type))) && in_array($post_type, $post_types))
	{			
					
		$price_insert = "INSERT INTO ".GEODIR_PRICE_TABLE." (`title`, `amount`, `days`, `status`, `is_default`, `cat`, `is_featured`, `title_desc`, `image_limit`, `cat_limit`, `google_analytics`, `sendtofriend`, `post_type`, `link_business_pkg`, `link_business_cpt`, `recurring_pkg`, `reg_desc_pkg`, `reg_fees_pkg`, `downgrade_pkg`) VALUES ('".__('Free', 'geodir_payments')."', 0.00, 0, 1, 1, '', 0, '".__('Free: number of publish days are unlimited (0.00 '.geodir_get_currency_type().')', 'geodir_payments')."', '', '', 0, 1, '".$post_type."', 0, 1, 0, 0, 0, '')";
		
		$wpdb->query($price_insert);
		
	}
	
	$pricesql = $wpdb->prepare("SELECT * FROM ".GEODIR_PRICE_TABLE." WHERE status = '1' AND is_default = '1' AND post_type = %s", array($post_type));
	
	$priceinfo = $wpdb->get_row($pricesql);
	
	if($priceinfo && !is_wp_error($priceinfo) )
		return apply_filters('geodir_default_package_info' , $priceinfo);
	else
		return false;	
}