0

So I am in the middle of hosting a live wordpress site locally using XAMPP. The code is in a bitbucket repo and I have been given the database from the staging site to connect my local environment.

After renaming the database with the localhost links and cloning the repo, these errors popup when trying to access the WordPress back-end.

screenshot-error

the code for the respective errors in respective order of the screenshot are as follows:

1.C:\xampp\htdocs\careabout\wp-content\plugins\wp-mail-bank\includes\class-mail-bank-auth-host.php on line 336

$email_configuration_settings = maybe_unserialize( $email_configuration_data );
if ( 'smtp' === $email_configuration_settings['mailer_type'] ) {
    if ( ! function_exists( 'wp_mail' ) ) {
        /**
         * This function is used to send mail.
         *
         * @param string $to .
         * @param string $subject .
         * @param string $message .
         * @param string $headers .
         * @param string $attachments .
         */
        function wp_mail( $to, $subject, $message, $headers = '', $attachments = '' ) {
            /**
             * Filters the wp_mail() arguments.
             *
             * @since 2.2.0
             *
             * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
             *                    subject, message, headers, and attachments values.
             */
            $atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );

            if ( isset( $atts['to'] ) ) {
                $to = $atts['to'];
            }

            if ( ! is_array( $to ) ) {
                $to = explode( ',', $to );
            }

            if ( isset( $atts['subject'] ) ) {
                $subject = $atts['subject'];
            }

            if ( isset( $atts['message'] ) ) {
                $message = $atts['message'];
            }

            if ( isset( $atts['headers'] ) ) {
                $headers = $atts['headers'];
            }

            if ( isset( $atts['attachments'] ) ) {
                $attachments = $atts['attachments'];
            }

            if ( ! is_array( $attachments ) ) {
                $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
            }

            global $wpdb, $email_configuration_settings;
            $obj_send_test_mail = new Mail_Bank_Auth_Host( $email_configuration_settings );
            $result             = $obj_send_test_mail->send_test_mail_bank( $to, $subject, $message, $headers, $attachments, $email_configuration_settings );
            return $result;
        }
    }
}

2.C:\xampp\htdocs\careabout\wp-content\plugins\wp-schema-pro\classes\class-bsf-aiosrs-pro-admin.php on line 157

if ( is_admin() ) {
    add_action( 'wp_redirect', array( $this, 'redirect_menu_position' ), 10, 2 );
    add_action( 'init', array( $this, 'init_admin_settings' ) );

    add_filter( 'wp_schema_pro_menu_options', array( $this, 'setting_menu_options' ) );
    add_action( 'aiosrs_menu_settings_action', array( $this, 'setting_page' ) );

    if ( '' == self::$branding['sp_hide_label'] || 'disabled' == self::$branding['sp_hide_label'] && false == ( defined( 'WP_SP_WL' ) && WP_SP_WL ) ) {
        add_filter( 'wp_schema_pro_menu_options', array( $this, 'branding_settings_options' ) );
        add_action( 'aiosrs_menu_branding_settings_action', array( $this, 'load_branding_setting_page' ) );
        update_option( 'sp_hide_label', true );
    }
    if ( '1' == $settings['breadcrumb'] ) {
        add_filter( 'wp_schema_pro_menu_options', array( $this, 'breadcrumb_settings_options' ) );
        add_action( 'aiosrs_menu_breadcrumb_settings_action', array( $this, 'load_breadcrumb_setting_page' ) );
    }
}

3.C:\xampp\htdocs\careabout\wp-content\plugins\wp-schema-pro\classes\class-bsf-aiosrs-pro-markup.php on line 109

if ( isset( $_POST['post_id'] ) && isset( $_POST['rating'] ) && isset( $_POST['schema_id'] ) ) {
    $post_id    = absint( $_POST['post_id'] );
    $schema_id  = absint( $_POST['schema_id'] );
    $new_rating = absint( $_POST['rating'] );
    $new_rating = ( $new_rating > 5 ) ? 5 : ( $new_rating < 0 ) ? 0 : $new_rating;
    $client_ip  = $this->get_client_ip();

    $all_ratings = get_post_meta( $post_id, 'bsf-schema-pro-reviews-' . $schema_id, true );
    if ( empty( $all_ratings ) ) {
        update_post_meta( $post_id, 'bsf-schema-pro-rating-' . $schema_id, $new_rating );
        update_post_meta( $post_id, 'bsf-schema-pro-review-counts-' . $schema_id, 1 );
        update_post_meta( $post_id, 'bsf-schema-pro-reviews-' . $schema_id, array( $client_ip => $new_rating ) );

        $response['success']    = true;
        $response['rating']     = $new_rating;
        $response['rating-avg'] = sprintf(
            /* translators: 1: rating */
            _x( '%s/5', 'rating out of', 'wp-schema-pro' ),
            esc_html( $new_rating )
        );
        $response['review-count'] = __( '1 Review', 'wp-schema-pro' );
    } else {

        $all_ratings[ $client_ip ] = $new_rating;
        $all_ratings               = array_filter( $all_ratings );
        $review_count              = count( $all_ratings );
        $avg_rating                = round( array_sum( $all_ratings ) / $review_count, 1 );

        update_post_meta( $post_id, 'bsf-schema-pro-rating-' . $schema_id, $avg_rating );
        update_post_meta( $post_id, 'bsf-schema-pro-review-counts-' . $schema_id, $review_count );
        update_post_meta( $post_id, 'bsf-schema-pro-reviews-' . $schema_id, $all_ratings );

        $response['success']    = true;
        $response['rating']     = $avg_rating;
        $response['rating-avg'] = sprintf(
            /* translators: 1: rating */
            _x( '%s/5', 'rating out of', 'wp-schema-pro' ),
            esc_html( $avg_rating )
        );
        $response['review-count'] = sprintf(
            /* translators: 1: number of reviews */
            _n( '(%1s Review)', '(%1s Reviews)', absint( $review_count ), 'wp-schema-pro' ),
            absint( $review_count )
        );
    }
}

Help with this would be appreciated. Please let me know if anymore details required

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
WP_dev
  • 3
  • 3
  • 1
    `$new_rating = $new_rating > 5 ? 5 : ( $new_rating < 0 ? 0 : $new_rating );` – Iłya Bursov Oct 26 '22 at 04:35
  • @IłyaBursov thank you so much it worked. I could access the backend now. However there is an error when trying to view the site as follows: "Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "wp_custom_sizes" not found or invalid function name". This is the code related to the error: $value = call_user_func_array( $the_['function'], $args ); Could you help me with this please – WP_dev Oct 26 '22 at 05:22
  • 1
    Does this answer your question? [PHP Error : Unparenthesized \`a ? b : c ? d : e\` is deprecated. Use either \`(a ? b : c) ? d : e\` or \`a ? b : (c ? d : e)\`](https://stackoverflow.com/questions/61432488/php-error-unparenthesized-a-b-c-d-e-is-deprecated-use-either-a) – Anna Gevel Oct 27 '22 at 20:08
  • If this is code form an existing plugin, you should check for updates. Don't try to change any plugin code on your own – Nico Haase Feb 21 '23 at 19:12

1 Answers1

-1

Try to use PHP Version 7.4 Possibly a plugin you are using does not support newer versions than 7.4

  • 4
    Please add some explanation to your answer such that others can learn from it. PHP 7.4 is out of support since last year, and downgrading to an unsupported version is never a good idea – Nico Haase Feb 21 '23 at 19:14
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33895436) – GuedesBF Feb 27 '23 at 21:38