Function Reference: geodir_diagnose_checkout_page

Summary

Check and add the payment checkout page if not exists.

Global Values

$wpdb
(object) (required) WordPress Database object.

Default: None

Change Log

Since: 1.2.6

Source Code

function geodir_diagnose_checkout_page($page_chk_arr) {
    global $wpdb;

    $fix = isset($_POST['fix']) ? true : false;
    $output_str = $page_chk_arr['output_str'];
    $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];

    //////////////////////////////////
    /* Diagnose GD Checkout Starts */
    //////////////////////////////////
    $option_value = get_option('geodir_checkout_page');
    $page = get_post($option_value);
    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}

    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
        $output_str .= "
  • " . __('GD Checkout page exists with proper setting.', 'geodir_payments') . "
  • "; else { $is_error_during_diagnose = true; $output_str .= "
  • " . __('GD Checkout page is missing.', 'geodir_payments') . "
  • "; if ($fix) { if (geodir_fix_virtual_page('gd-checkout', __('GD Checkout', 'geodir_payments'), $page_found, 'geodir_checkout_page')) { $output_str .= "
  • " . __('-->FIXED: GD Checkout page fixed', 'geodir_payments') . "
  • "; } else { $output_str .= "
  • " . __('-->FAILED: GD Checkout page fix failed', 'geodir_payments') . "
  • "; } } } return array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose ); }