Warning: Cannot modify header information for membership plugin

Hi there.

I have upgraded to the latest Wordpress 3.5.1 and the Membership Pro 3.4.3.1

I only have one subscription and it's set up as free ($0) as it's for 'clients only' content.

I'm getting warnings when registering and looks really bad for new clients.

I thought it might be my modified child 'Twenty Ten' theme, so activated the default 'Twenty Ten' but still getting the warnings when registering

Please help. This is what I'm getting after registering (actual names replaced with XXXX)

Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/twentyten/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 680

Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/twentyten/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 681

Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/twentyten/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 682

    Ian

    twentyten/header.php on Line 12 is:
    <html <?php language_attributes(); ?>>

    wp-includes/pluggable.php on line 680, 681 and 682 are:

    setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    	setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    	setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
    Ian

    Also get lots of warnings when a user updates their details on the account page.

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 697

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 698

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 699

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 700

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 701

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 702

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 705

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 706

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 707

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 708

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 711

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 712

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 713

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 714

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 680

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 681

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-content/themes/XXXXXXXX/header.php:12) in /home/XXXX/domains/XXXX.com/public_html/XXXX/wp-includes/pluggable.php on line 682

    Ian

    Hi Tom, thanks for the advice, however I couldn't see any empty lines.

    I also did the reinstall wordpress link in backend just incase it didn't do it right the first time.

    And also then downloaded the wordpress-3.5.1.zip to compare the pluggable.php file to my one in WinMerge and it said the selected files are identical.

    I have tested the site again but I'm still getting the warnings when registering

    Any other ideas?
    It seems to be something to do with the cookie part of the code.

    Tom Eagles

    @Ian

    Ok next things to check

    Make sure not even a space before the opening <?php or after the closing ?>

    the problem is the php engine parses everything so even white spaces can cause errors.

    also make sure that the set cookie is above the first html element like this. Check header.php

    <?php
     $value = 'something from somewhere';
    
     setcookie("TestCookie", $value);
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    Let me know how you get on.

    Cheers

    Tom

    Ian

    Hi again Tom.
    What seems odd is there is no closing php tag.
    I checked other files in the default wordpress zip file and most don't have it ?

    Is that ok to do that?

    I have attached it, but don't see anything else wrong?

    My header.php file doesn't seem to have any cookie code?
    My theme is a slightly modified child theme of twenty ten. Is this theme still compatible with wordpress 3.5.1 and membership pro?

    Ian

    On the account page when updating the password it says this:

    Account page
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 697
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 698
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 699
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 700
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 701
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 702
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 705
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 706
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 707
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 708
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 711
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 712
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 713
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 714
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 680
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 681
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-content/themes/twentytwelve/header.php:13) in /home/XXXXX/domains/XXXXXr.com/public_html/treatment/wp-includes/pluggable.php on line 682
    
    Your details have been updated.
    Ian

    Quite a few.

    Akismet
    BackUpWordPress
    BM Custom Login
    Contact Form 7
    Dave's WordPress Live Search
    Export Users to CSV (Deactivated)
    Membership Premium
    Members Only (Deactivated, was going to use to redirect after login)
    Relevanssi
    Search By Category
    Snapshot
    Ultimate Google Analytics
    User Activity
    WPMU DEV Dashboard
    WP Realtime Sitemap
    WP SlimStat
    WP SlimStat Dashboard Widgets

    Barry

    Ok, pluggable.php line 697 is in the wp_clear_auth_cookie function. I've done a code search on my system and that function isn't in the membership plugin. It's used in our domain mapping plugin, but I don't see that in your list.

    Not sure if you have an editor that can do a full search of your system (I tend to download all the source to a folder and then use something like textmate to do a project search of the directory), but if you do and can, then can you search for that function name and it will get us on the road to finding what is calling it, when and why.

    Ian

    Thanks @Barry.

    I have downloaded the latest backup of site and did an extended search for 'wp_clear_auth_cookie' and it found 10 places in 4 files.

    Hope this helps you further to track where the warnings are coming from.

    Not sure what this all means, but hopefully you will

    The files were:
    wp-login.php
    pluggable.php
    pluggable-deprecated.php
    user.php

    Let me know if you need the files zipped up and loaded somewhere for you to check, but think they are just the default WordPress files found in any install.

    Cheers, Ian

    Barry

    Not, in any of the plugins files then?

    To quickly fix it, you can either edit pluggable.php, or you can do the following.

    Check if you have a folder in your wp-content directory called mu-plugins, if there isn't then create one. Create a file in that folder called something like newpluggable.php

    In that file add the following:

    <?php
    if ( !function_exists('wp_clear_auth_cookie') ) :
    function wp_clear_auth_cookie() {
    	do_action('clear_auth_cookie');
    
    	@setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
    	@setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
    	@setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
    	@setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
    	@setcookie( LOGGED_IN_COOKIE,   ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,          COOKIE_DOMAIN );
    	setcookie( LOGGED_IN_COOKIE,   ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH,      COOKIE_DOMAIN );
    
    	// Old cookies
    	@setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
    	@setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
    	@setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
    	@setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
    
    	// Even older cookies
    	@setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
    	@setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
    	@setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
    	@setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
    }
    endif;
    ?>

    Note basically we've just put an @ sign in front of each setcookie line, which stops it reporting any errors if it can't process things properly (due to headers already being sent), so if you wanted to edit the pluggable.php then just update the function with the @ signs.

    The best approach will be to copy and paste the function out of pluggable.php, and then edit it in the new file - that way you don't have any syntax issues.

    Ian

    Hi Barry, yes searched if it didn't find any 'wp_clear_auth_cookie' reference in any folder.

    Just searched again in just the plugins folder, but still nothing

    I have created folder called 'mu-plugins' in 'wp-content' folder and created a file called 'newpluggable.php' and uploaded to 'mu-plugins'

    I tested it by updating a test users password, but still got less warnings, see below.

    Warning: Cannot modify header information etc, etc etc
    /wp-content/mu-plugins/newpluggable.php on line 11
    etc, etc etc
    t/wp-includes/pluggable.php on line 680
    etc, etc etc
    /wp-includes/pluggable.php on line 681
    etc, etc etc
    /wp-includes/pluggable.php on line 682

    I noticed this line was missing the @ so added it.
    setcookie( LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );

    So tested again, getting better, but still got 3 warnings:

    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXX.com/public_html/XXXXX/wp-content/themes/XXXXX/header.php:12) in /home/XXXXX/domains/XXXXXr.com/public_html/XXXXX/wp-includes/pluggable.php on line 680
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXX.com/public_html/XXXXX/wp-content/themes/XXXXX/header.php:12) in /home/XXXXX/domains/XXXXXr.com/public_html/XXXXX/wp-includes/pluggable.php on line 681
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXX/domains/XXXXX.com/public_html/XXXXX/wp-content/themes/XXXXX/header.php:12) in /home/XXXXX/domains/XXXXXr.com/public_html/XXXXX/wp-includes/pluggable.php on line 682

    Still needing help as soon as possible.

    Cheers, ian

    az947@yahoo.com

    I am experiencing the exact same problem as you, so I am very glad I`m not alone! I also only have one free subscription set up, and we have the following plugins in common (excluding membership & WPMU Dev):
    Akismet
    Contact Form 7
    Relevanssi
    These three are very common plugins, so I would be surprised if they were causing the issue.

    I was hoping the latest update would have resolved this problem. Like Ian, these errors are viewable by all new members who are registering and I would like to get this fixed asap!