Function Reference: geodir_diagnose_invoices_page

Summary

Check and add the payment invoices 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_invoices_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 Invoices Starts */
    //////////////////////////////////
    $option_value = get_option('geodir_invoices_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 .= "
  • " . __('Manage Invoices page exists with proper setting.', 'geodir_payments') . "
  • "; else { $is_error_during_diagnose = true; $output_str .= "
  • " . __('Manage Invoices page is missing.', 'geodir_payments') . "
  • "; if ($fix) { if (geodir_fix_virtual_page('gd-invoices', __('Manage Invoices', 'geodir_payments'), $page_found, 'geodir_invoices_page')) { $output_str .= "
  • " . __('-->FIXED: Manage Invoices page fixed', 'geodir_payments') . "
  • "; } else { $output_str .= "
  • " . __('-->FAILED: Manage Invoices page fix failed', 'geodir_payments') . "
  • "; } } } return array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose ); }