/**
 * Activates membership order if has been completed.
 *
 * @param object $order
 */
function cp_payments_handle_membership_completed($order)
{
    if ($order->get_items(CP_ITEM_MEMBERSHIP)) {
        $order->activate();
        if (!is_admin()) {
            $order_url = $order->get_url($order->get_id());
            if (did_action('wp_head')) {
                cp_js_redirect($order_url);
            } else {
                wp_redirect($order_url);
            }
        }
    }
}
Exemple #2
0
/**
 * Activates membership order if has been completed.
 *
 * @param object $order
 *
 * @return void
 */
function cp_payments_handle_membership_completed($order)
{
    $package = cp_get_membership_package_from_order($order);
    if ($package) {
        $order->activate();
        if (!is_admin()) {
            $order_url = $order->get_return_url();
            if (did_action('wp_head')) {
                cp_js_redirect($order_url);
            } else {
                wp_redirect($order_url);
            }
        }
    }
}
    echo appthemes_locate_template_uri('images/step3.gif');
    ?>
" alt="" class="stepimg" />
            
                <div class="thankyou">
            
                    <?php 
    // call in the selected payment gateway as long as the price isn't zero
    if (cp_payments_is_enabled() && $order['total_cost'] > 0) {
        $membership_order = appthemes_new_order();
        $membership_order->add_item(CP_ITEM_MEMBERSHIP, $order['total_cost']);
        do_action('appthemes_create_order', $membership_order);
        echo html('h3', __('Payment', APP_TD));
        echo html('p', __('Please wait while we redirect you to our payment page.', APP_TD));
        echo html('p', html('small', __('(Click the button below if you are not automatically redirected within 5 seconds.)', APP_TD)));
        cp_js_redirect($membership_order->get_return_url(), __('Continue to Payment', APP_TD));
        //process the "free" orders on this page
    } else {
        $order_processed = appthemes_process_membership_order($current_user, $order);
        //send email to user
        if ($order_processed) {
            cp_owner_activated_membership_email($current_user, $order_processed);
        }
        ?>
            
                        <h3><?php 
        _e('Your order has been completed and your membership status should now be active.', APP_TD);
        ?>
</h3>
            
                        <p><?php 
/**
 * Execute changes made in ClassiPress 3.3.2.
 *
 * @since 3.3.2
 */
function cp_upgrade_332()
{
    global $wpdb;
    // remove old table index
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    drop_index($wpdb->cp_ad_geocodes, 'id');
    // drop 'category' and 'id' columns from geocodes table
    $wpdb->query("ALTER TABLE {$wpdb->cp_ad_geocodes} DROP COLUMN category");
    $wpdb->query("ALTER TABLE {$wpdb->cp_ad_geocodes} DROP COLUMN id");
    update_option('cp_db_version', '2103');
    // redirect to run dbDelta again, on first pass it fail to create index
    cp_js_redirect(admin_url('admin.php?page=app-settings&firstrun=1'), __('Continue Upgrading', APP_TD));
    exit;
}