Function Reference: geodir_del_coupon

Summary

This function has not been documented yet.

Source Code

function geodir_del_coupon()
{
	global $wpdb, $price_db_table_name;
	
	if(current_user_can( 'manage_options' )){

		if($_REQUEST['pagetype'] == 'delete' && $_REQUEST['id'] != '' && isset($_REQUEST['_wpnonce']))
		{
			
			if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'coupon_code_delete_'.$_REQUEST['id'] ) )
						return;
			
						
			$cid = $_REQUEST['id'];
			
			$wpdb->query($wpdb->prepare("delete from ".COUPON_TABLE." where cid=%d",array($cid)));
			
			$msg = __('Coupon deleted successfully.', 'geodir_payments');
			
			$msg = urlencode($msg);
			$location = admin_url()."admin.php?page=geodirectory&tab=paymentmanager_fields&subtab=geodir_coupon_manager&success_msg=success&success_msg=".$msg;
			wp_redirect($location);
			exit;
		}
	
	}else{
		
		wp_redirect(geodir_login_url());
		exit();
	}

}