if($checkauthor != null) { // author check is ok. now update ad status
if($checkauthor != null) { // author check is ok. now update ad status } endif;
if ($d == 'pause') { $my_ad = array(); $my_ad['ID'] = $aid; $my_ad['post_status'] = 'draft'; wp_update_post($my_ad); $pagemessage = 'Paused ad with ID: ' . $aid; } elseif ($d == 'restart') { $my_ad = array(); $my_ad['ID'] = $aid; $my_ad['post_status'] = 'publish'; wp_update_post($my_ad); $pagemessage = 'Resumed ad with ID: ' . $aid; } elseif ($d == 'freerenew') { $my_ad = array(); $pagemessage = cp_renew_ad_listing($aid); } else { //echo "nothing here"; }
<?php _e('Below you will find a listing of all your classified ads. Click on one of the options to perform a specific task. If you have any questions, please contact the site administrator.','cp');?></p>
<?php if(isset($pagemessage)) echo '<div class="pagemessage">' . $pagemessage . '</div>'; ?>
if (get_option('cp_allow_relist') == 'yes') {
echo 'Free Ad Renewal';
} else { echo 'Free Ad Renewal'; } } else { echo '—'; }
/** * add any of your custom functions below this section */
function cp_renew_ad_listing ( $ad_id ) { $listfee = (float)get_post_meta($ad_id, 'cp_sys_total_ad_cost', true); if ($listfee == 0) { $ad_length = get_post_meta($ad_id, 'cp_sys_ad_duration', true); if(isset($ad_length)) $ad_length = $ad_length; else $ad_length = get_option('cp_prun_period'); // set the ad listing expiration date $ad_expire_date = date('m/d/Y H:i:s', strtotime('+' . $ad_length . ' days')); // don't localize the word 'days' //now update the expiration date on the ad update_post_meta($ad_id, 'cp_sys_expire_date', $ad_expire_date); return 'Advertisement Renewed and will now expire on: ' . $ad_expire_date . '. The renewed ad has been paused, you can edit the ad or reduce the price before resuming the ad. Do not forget that you ad will not be live until you click the resume button in the ad options column.'; } else //attempt to relist a paid ad { return 'You cannot relist this using this function, most likely the ad must be relisted by using the paypal link.'; } }
There are currently 1 users browsing this thread. (0 members and 1 guests)