GeoDirectory SupportUpgrade place selects free always as default – GeoDirectory Support https://wpgeodirectory.com/support/topic/upgrade-place-selects-free-always-as-default/feed Mon, 23 Feb 2026 23:07:15 +0000 http://bbpress.org/?v=2.5.14-6684 en-US https://wpgeodirectory.com/support/topic/upgrade-place-selects-free-always-as-default/#post-32794 <![CDATA[Upgrade place selects free always as default]]> https://wpgeodirectory.com/support/topic/upgrade-place-selects-free-always-as-default/#post-32794 Tue, 03 Mar 2015 19:10:43 +0000 P O I created a free package to have some listings and a payed one so users can upgrade. I hided the free one with css so new users don’t see it and by default the payed one is selected.

1- When a new user comes, he can create an account, add a listing and by default the payed one is selected. (the free one is hidden with css)

2- When someone claims a place and they hit upgrade. The free is hidden, but its the default selected. So they have to click the payed one by hand.

Why is the payed not selected by default when upgrading and how can I fix it ?

Thanks.

]]>
https://wpgeodirectory.com/support/topic/upgrade-place-selects-free-always-as-default/#post-32802 <![CDATA[Reply To: Upgrade place selects free always as default]]> https://wpgeodirectory.com/support/topic/upgrade-place-selects-free-always-as-default/#post-32802 Tue, 03 Mar 2015 20:06:58 +0000 Paolo Please add this to your theme functions.php


remove_action('geodir_after_edit_post_link', 'geodir_display_post_upgrade_link', 1); 
add_action('geodir_after_edit_post_link', 'my_geodir_display_post_upgrade_link', 1); 

function my_geodir_display_post_upgrade_link(){
	
	global $post,$preview; 
	
	if(!$preview){
	
		if(is_user_logged_in() && $post->post_author == get_current_user_id()){
								
				$post_id = $post->ID;
				$post_package_id = isset($post->package_id) ? $post->package_id : '';
				if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
					$post_id = $_REQUEST['pid'];
					
					if(empty($post_package_id))
						$post_package_id = geodir_get_post_meta($post_id,'package_id',true);
				}
				
				$postlink = get_permalink( get_option('geodir_add_listing_page') );
				$editlink = geodir_getlink($postlink,array('pid'=>$post_id),false);
				
				
				$post_status = get_post_status( $post_id );
				
				// show renew link before pre expiry days * 2
				$post_expire_date = isset($post->expire_date) ? $post->expire_date : '';
				$preexpiry_notice = false;
				if (get_option('geodir_listing_preexpiry_notice_disable') && get_option('geodir_listing_preexpiry_notice_days')!='' && $post_expire_date != '0000-00-00' && $post_expire_date != '' && strtolower($post_expire_date) != 'never' && strtotime($post_expire_date) > strtotime(date('01-01-1970')))  {
					$preexpiry_date = strtotime($post_expire_date) - (DAY_IN_SECONDS * get_option('geodir_listing_preexpiry_notice_days') * 2);
					$preexpiry_notice = $preexpiry_date <= strtotime(date('Y-m-d')) ? true : false;
				}
				
				$action_link = __('Upgrade Listing', GEODIRPAYMENT_TEXTDOMAIN);
				if($post_status == 'draft' || $preexpiry_notice){
					$action_link = __('Renew Listing', GEODIRPAYMENT_TEXTDOMAIN);
				}
		
				$upgradelink = geodir_getlink($editlink,array('package_id'=>'ADD_YOUR_ID_HERE'),false);  
				
				echo '<p class="geodir_upgrade_link"><i class="fa fa-chevron-circle-up"></i> <a href="'.$upgradelink.'">'.$action_link.'</a></p>';
		}
		
	}

	
}

Change where it says ADD_YOUR_ID_HERE with the price package ID needed for the upgrade.

I’ve tested it in our demo and works, however if you have more than one CPT this will not work and will have to be extended with a little extra conditional function.

Let us know,

]]>