Support » Plugin: My Custom Functions » White Screen of Death

  • Resolved kathaleinie

    (@kathaleinie)


    Hello,

    I have got problems with this plugin.
    First I started to use this code to make a PopUp screen for pages which appears if a websitevisitor isn’t logged in:
    add_action(‘template_redirect’,’check_if_logged_in’);
    function check_if_logged_in()
    {
    if(!is_user_logged_in() && is_page( array(2651, 2987, 3021, 2152, 2241, 2164, 2245, 2181, 2067, 2198, 2225, 2233, 2202, 2347, 2079, 2090, 2283, 2330, 2314, 2974, 2322) ))
    {

    ?>
    <script src=”http://www.well.co.at/dev/wp-content/uploads/sweetalert-master/dist/sweetalert.min.js”></script>
    <script src=”https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.js”></script>
    <link rel=”stylesheet” type=”text/css” href=”http://www.well.co.at/dev/wp-content/uploads/sweetalert-master/dist/sweetalert.css”>
    <script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js”
    type=”text/javascript”></script>
    <script>
    //setTimeout(function(){
    //$(window).load( function() {
    $( document ).ready(function() {
    //window.onload = function () {
    //document.addEventListener(‘DOMContentLoaded’, function() {
    swal({
    title: ”,
    text: ‘Der Inhalt dieser Seite steht für unsere registrierten Besucher zur Verfügung.’,
    imageUrl: ‘http://www.well.co.at/dev/wp-content/uploads/2017/05/well_logo1.png’,
    imageWidth: 50,
    imageHeight: 50,
    allowOutsideClick: false,
    animation: false,
    confirmButtonColor: “#f18500”,
    confirmButtonText: “Zur kostenlosen Registrierung”,
    closeOnConfirm: false
    }, function (isConfirm) {
    location.href = “https://well.co.at/mein-konto”
    });
    });
    </script>
    <?php
    exit;
    }
    }

    It worked great and I thought I could use this plugin for more functions, so I made another function for integrating custom fields to my woo commerce login:

    function wooc_extra_register_fields() {
    ?>
    <p class=”form-row form-row-wide”>
    <label for=”reg_billing_titel”><?php _e( ‘Titel’, ‘woocommerce’ ); ?></label>
    <input type=”text” class=”input-text” name=”billing_titel” id=”reg_billing_titel” value=”<?php esc_attr_e( $_POST[‘billing_titel’] ); ?>” />
    </p>
    <p class=”form-row form-row-first”>
    <label for=”reg_billing_first_name”><?php _e( ‘Vorname’, ‘woocommerce’ ); ?><span class=”required”>*</span></label>
    <input type=”text” class=”input-text” name=”billing_first_name” id=”reg_billing_first_name” value=”<?php if ( ! empty( $_POST[‘billing_first_name’] ) ) esc_attr_e( $_POST[‘billing_first_name’] ); ?>” />
    </p>
    <p class=”form-row form-row-last”>
    <label for=”reg_billing_last_name”><?php _e( ‘Nachname’, ‘woocommerce’ ); ?><span class=”required”>*</span></label>
    <input type=”text” class=”input-text” name=”billing_last_name” id=”reg_billing_last_name” value=”<?php if ( ! empty( $_POST[‘billing_last_name’] ) ) esc_attr_e( $_POST[‘billing_last_name’] ); ?>” />
    </p>
    <p class=”form-row form-row-wide”>
    <label for=”reg_billing_firma”><?php _e( ‘Firma’, ‘woocommerce’ ); ?></label>
    <input type=”text” class=”input-text” name=”billing_firma” id=”reg_billing_firma” value=”<?php esc_attr_e( $_POST[‘billing_firma’] ); ?>” />
    </p>
    <div class=”clear”></div>
    <?php
    }
    add_action( ‘woocommerce_register_form_start’, ‘wooc_extra_register_fields’ );

    This also worked great, but I had to make another function to integrate the input data of these fields into my database so I made this function:

    function wooc_save_extra_register_fields( $customer_id ) {
    if ( isset( $_POST[‘billing_titel’] ) ) {
    // Phone input filed which is used in WooCommerce
    update_user_meta( $customer_id, ‘billing_titel’, sanitize_text_field( $_POST[‘billing_titel’] ) );
    }
    if ( isset( $_POST[‘billing_first_name’] ) ) {
    //First name field which is by default
    update_user_meta( $customer_id, ‘first_name’, sanitize_text_field( $_POST[‘billing_first_name’] ) );
    // First name field which is used in WooCommerce
    update_user_meta( $customer_id, ‘billing_first_name’, sanitize_text_field( $_POST[‘billing_first_name’] ) );
    }
    if ( isset( $_POST[‘billing_last_name’] ) ) {
    // Last name field which is by default
    update_user_meta( $customer_id, ‘last_name’, sanitize_text_field( $_POST[‘billing_last_name’] ) );
    // Last name field which is used in WooCommerce
    update_user_meta( $customer_id, ‘billing_last_name’, sanitize_text_field( $_POST[‘billing_last_name’] ) );
    }
    if ( isset( $_POST[‘billing_firma’] ) ) {
    // Phone input filed which is used in WooCommerce
    update_user_meta( $customer_id, ‘billing_firma’, sanitize_text_field( $_POST[‘billing_firma’] ) );
    }

    }
    add_action( ‘woocommerce_created_customer’, ‘wooc_save_extra_register_fields’ );

    After that my page turned white. I thought I could make it working again if I just delete these two new functions. That didn’t work. After that I tried to delete all functions in the code area of the plugin. Then I tried to delete the plugin. I also had a backup of my functions.php so I gave my actual functions.php another name (just in case if I would need it again) and used the backup version. Didn’t work either. So I reinstalled the plugin and tried to fix it with deleting my functions in the database “Database —> Table “wp_options” —> Option “anarcho_cfunctions_settings” —> “option_value”.” . I also tried to find MCFunctions_exec(); in my-custom-functions.php so i could comment it, but I didn’t find it.

    Please help me! I have no clue what I could try to fix this

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘White Screen of Death’ is closed to new replies.