Function Reference: geodir_get_post_package_info

Summary

This function has not been documented yet.

Source Code

function geodir_get_post_package_info( $pkg_id = '', $pid = '' ) {	
	global $wpdb;
	
	$post_type = '';
	if( $pkg_id == '' && $pid != '' ) {
		$gd_post_info = geodir_get_post_info( $pid );
		if ( !empty( $gd_post_info ) && isset( $gd_post_info->package_id ) && $gd_post_info->package_id > 0 ) {
			$pkg_id = $gd_post_info->package_id;
			$post_type = $gd_post_info->post_type;
		}
	}
	
	// get price package info
	$priceinfo = geodir_get_package_info( $pkg_id );
	
	if ( !empty($priceinfo) && is_array( $priceinfo ) ) {
		$priceinfo = (object)$priceinfo;
	}
		
	$info = array();
	if( !empty( $priceinfo ) ) {
		$priceinfoObj = $priceinfo;
		$info['pid'] = $priceinfoObj->pid;
		$info['title'] = __(stripslashes_deep($priceinfoObj->title), 'geodirectory');
		$info['amount'] = $priceinfoObj->amount;
		$info['cat'] =$priceinfoObj->cat;
		$info['status'] = $priceinfoObj->status;
		$info['days'] = $priceinfoObj->days;	
		$info['is_default'] = $priceinfoObj->is_default;	
		$info['is_featured'] = $priceinfoObj->is_featured;
		$info['title_desc'] = __(stripslashes_deep($priceinfoObj->title_desc), 'geodirectory');
		$info['image_limit'] = $priceinfoObj->image_limit;
		$info['cat_limit'] = $priceinfoObj->cat_limit;
		$info['post_type'] = $priceinfoObj->post_type;
		$info['link_business_pkg'] = $priceinfoObj->link_business_pkg;
		$info['link_business_cpt'] = $priceinfoObj->link_business_cpt;
		$info['recurring_pkg'] = $priceinfoObj->recurring_pkg;
		$info['reg_desc_pkg'] = $priceinfoObj->reg_desc_pkg;
		$info['reg_fees_pkg'] = $priceinfoObj->reg_fees_pkg;
		$info['downgrade_pkg'] = $priceinfoObj->downgrade_pkg;
		$info['sub_active'] = $priceinfoObj->sub_active;
		$info['sub_units'] = $priceinfoObj->sub_units;
		$info['sub_units_num'] = $priceinfoObj->sub_units_num;
		$info['sub_num_trial_days'] = $priceinfoObj->sub_num_trial_days;
		$info['sub_num_trial_units'] = isset( $priceinfoObj->sub_num_trial_units ) && !empty( $priceinfoObj->sub_num_trial_units ) ? $priceinfoObj->sub_num_trial_units : 'D';
		$info['sub_units_num_times'] = $priceinfoObj->sub_units_num_times;
		$info['google_analytics'] = $priceinfoObj->google_analytics;
		$info['sendtofriend'] = $priceinfoObj->sendtofriend;
		$info['use_desc_limit'] = $priceinfoObj->use_desc_limit;
		$info['desc_limit'] = $priceinfoObj->desc_limit;
		$info['use_tag_limit'] = $priceinfoObj->use_tag_limit;
		$info['tag_limit'] = $priceinfoObj->tag_limit;
		$info['hide_related_tab'] = isset( $priceinfoObj->hide_related_tab ) ? (int)$priceinfoObj->hide_related_tab : 0;
		$info['has_upgrades'] = isset($priceinfoObj->has_upgrades) ? (int)$priceinfoObj->has_upgrades : 1;
		$info['disable_coupon'] = isset($priceinfoObj->disable_coupon) ? (bool)$priceinfoObj->disable_coupon : 0;
	}
	return $info;
}