WPMUDEV Support, Unfortunately I have reached the limit

Hi WPMUDEV Support,
Unfortunately I have reached the limit of my knowledge with a couple issues which seem to be tied together.

I am using wooCommerce to process payments and memberships ( I know... I tried to use Membership2 but it wouldn't work for me and couldn't be integrated with my tracking system payments).
So, *WooCommerce was working fine but when I updated to WP v.4.3.2 - it seems I am getting DOING_AJAX error. But the error ONLY appears after clicking to process an order from the cart (which should send me to paypal to process payment) - after clicking to order, my site shows these errors (and does not redirect me to paypal):

Notice: Undefined index: DOING_AJAX in /home/paidlink/public_html/wp-content/mu-plugins/grd_functions.php on line 153

Warning: Cannot modify header information - headers already sent by (output started at /home/paidlink/public_html/wp-content/mu-plugins/grd_functions.php:153) in /home/paidlink/public_html/wp-includes/pluggable.php on line 1196

I can't find the problem. My Mu-Plugins were fine before. Not sure what's going on now.
I have Debug on because My WooCommerce was not clicking through to PayPal.

Anyone have any insite?
Maybe someone know this has happened before?

Anything would be a help. All of my work doesn't matter if I can't even process payments properly.

Thanks again for your time.

  • Vinod Dalvi
    • WP Unicorn

    Hi Paul,

    Sorry to hear of the problem you are having.

    It seems the error is occurring due to the following mu plugin.

    /home/paidlink/public_html/wp-content/mu-plugins/grd_functions.php

    Why are you using that plugin?

    Could you please try temporary disabling that plugin by removing it from the above path?

    Kind Regards,
    Vinod Dalvi

  • Paul
    • The Crimson Coder

    It's just a host plugin for me.
    I will go now and separate each function into a different plugin. I was intending to do this before but I feel now is the time.

    I will do this and conduct my tests again to see which function is causing the error.

    Thanks for the reminder.

  • Paul
    • The Crimson Coder

    @Vinod Dalvi,

    It seems your simple reply lead me to the fix. Thank you very much!
    I separated all functions into different php files and was able to pinpoint the issue.

    I had added a code which didn't need to be there.

    Thank you again.

    Paul

  • Paul
    • The Crimson Coder

    FYI to anyone:
    The code was:

    add_action('admin_init', 'no_mo_dashboard');
    function no_mo_dashboard() {
    if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
    wp_redirect(home_url()); exit;
    }
    }

    It tells the admin dashboard to direct any primary site admin menu items to main site url. Best I can describe it. Works well but was causing issues for me.

    Have to find another solution.

  • Paul
    • The Crimson Coder

    Found FAR better solution - Just remove primary site blog from mySites menu for non-Network Admins!

    So if you too are having problems with DOING_AJAX - Try this - Perfect for me:

    <?php
    // Remove Blog 1 main site from mysites list.
    function remove_main_blog_from_get_blogs($blogs) {
    	// check that user is not Network Admin
    	if ( !is_super_admin() ) {
    		// remove first item from $blogs array, which should always be main blog
    		array_splice($blogs, 0, 1);
    	}
    	return $blogs;
    }
    add_filter( 'get_blogs_of_user', 'remove_main_blog_from_get_blogs' );

    Hope it helps.

    Paul

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.