Membership: "cannot modify header" error when Membership upgraded to 3.0

Hello

I'm using Membership Premium 3, Buddypress 1.5.4 and WordPress 3.3.1

I just upgraded from Membership Premium 2.1.4 to Membership 3. There is an error in user registration.

Screen 1: Select a Subscription. User picks subscription level. ok. click "sign up"
Screen 2: Create an Account. User fills out required profile information. ok. click "sign up ->"
Screen 3: navigation and content frame loads, in page body error appears:

Warning: Cannot modify header information - headers already sent by (output started at /home/[mysite]/wp-content/themes/genesis/lib/structure/header.php:31) in /home/[mysite]/wp-includes/pluggable.php on line 669

Warning: Cannot modify header information - headers already sent by (output started at /home/[mysite]/wp-content/themes/genesis/lib/structure/header.php:31) in /home/[mysite]/wp-includes/pluggable.php on line 670

Warning: Cannot modify header information - headers already sent by (output started at /home/[mysite]/wp-content/themes/genesis/lib/structure/header.php:31) in /home/[mysite]/wp-includes/pluggable.php on line 671

Warning: Cannot modify header information - headers already sent by (output started at /home/[mysite]/wp-content/themes/genesis/lib/structure/header.php:31) in /home/[mysite]/wp-includes/pluggable.php on line 866

(looks like some cookie setting in the code? can't quite tell)

The user is actually getting added with the correct subscription in the admin panel, although it doesn't look like it from the front end.

Does this look like an incompatibility with the theme? I'm using GenesisConnect 1.1. If this is a problem with the theme, I'll have to roll back the Membership upgrade, as I can't change the theme and there's no recent upgrade available.

Please let me know what you think,

thanks,

Clare

  • 3SixtyEvolve
    • New Recruit

    Hi Clare @cparkinson

    Hope you're well.

    This looks to me like a problem with the Genesis theme (header.php). Just to be sure, please change the theme to the standard Twenty Eleven WordPress theme and let me know the outcome.

    If it's the theme, don't roll back yet to the previous version of Membership.

    There could be a simple solution for that. Please open the header.php file for the Genesis theme and see if there is any

    This error usually happens because there are spaces, new lines, or other stuff before an opening <?php tag or after a closing ?> tag, typically in wp-config.php, but it might be in your Genesis header.php file.

    - Download the header.php file via FTP or the file manager provided in your host's control panel.
    - Open the file in a plain text editor (NOT MS Word or similar. Notepad or BBEdit is fine).
    - Check that the very first characters are <?php
    - Check that the very last characters are ?>

    To be sure about the end of the file, do this:

    - Place the cursor between the ? and >
    - Now press the DELETE key on your computer
    - Keep that key pressed for at least 15 seconds
    - Now type > and save without pressing any other key at all

    Upload the file back to your server after editing and saving the file.

    Hope this was helpful. Please let me know how you got on.

    Look forward to your feedback.

    Gina

  • cparkinson
    • Flash Drive

    Hi Gina

    Thank you for your detailed instructions. Here's what I did:

    activated the default Buddypress theme, tested registration. Same deal: after entering the profile fields and clicking "SIgn up ->", the screen reloaded with

    Warning: Cannot modify header information - headers already sent by (output started at /home/[mysite]/wp-content/plugins/buddypress/bp-themes/bp-default/header.php:3) in /home/ [mysite] /wp-includes/pluggable.php on line 670

    ...followed by the 3 other similar warnings. As you suggested, I activated the default WP twentyeleven theme, and the same thing happened at the same point:

    Warning: Cannot modify header information - headers already sent by (output started at /home/[mysite]/wp-content/themes/twentyeleven/header.php:13) in /home/[mysite]/wp-includes/pluggable.php on line 669

    Then I reactivated my original theme (it's actually a custom child theme of genesis) and followed your directions for checking for weird output in the header files. I'm ssh'd to my server & editing in vim. I saw that header.php did NOT have a ?> at the end (none of the themes' header.php files do. is that usual?) so I put one there, retested, no change. I checked wp-config.php and did the same, retested, no change.

    So, somewhere, something is getting output that shouldn't be. Any other ideas where I can check? I'm going to look at the html to see if I can figure out exactly where the output thing is coming from.

    thanks,

    Clare

  • cparkinson
    • Flash Drive

    poking around in the code....

    in classes/membershippublic.php, it's using case 'validatepage1bp':

    the user is being created, and everything is fine until line 1425

    wp_set_auth_cookie($user_id); #commenting this out eliminates the first 3 warnings from pluggable.php

    wp_redirect(home_url($_SERVER['REQUEST_URI']));

    is passing the wrong URL, because I have a goofy setup with multiple installations of WP, so the site name is being duplicated in the location, e.g. http://myserver.com/mysite/mysite/registration-page/?action=registeruser&subscription=1

    I'm not sure if that's part of the problem or a separate issue. continuing to investigate.

  • cparkinson
    • Flash Drive

    Hmm...

    No errors output, but nothing else either. Just a blank page loading.

    Testing "paid" subscription: id = 1f
    Screen 1: Select a Subscription. User picks subscription level. ok. click "sign up"
    Screen 2: Create an Account. User fills out required profile information. ok. click "sign up ->"
    Screen 3: navigation and content frame loads, blank page, no error message
    http://myserver.com/mysite/registration-page/?action=registeruser&subscription=1

    The user is created in WP and is assigned subscription id 2, which is the wrong subscription.

    Testing "free" subscription:: id=2
    Screen 1: Select a Subscription. User picks subscription level. ok. click "sign up"
    Screen 2: Create an Account. User fills out required profile information. ok. click "sign up ->"
    Screen 3: navigation and content frame loads, blank page, no error message
    http://myserver.com/mysite/registration-page/?action=registeruser&subscription=2

    So, the paid subscription should be redirecting to a payment gateway, but isn't.

    Both paths are dying at the same place, judging from the html, right where they were before.

    I'll see if I can figure anything else out...

  • toggleway
    • WPMU DEV Initiate

    Hello,

    I get the same problem while doing step 2 when creating an account, it gives the header errors (makes the account in the background) however I notice this only happens when you have [subscriptionform] on the registration page. If you leave the registration page blank "Alternatively leave the page blank for the standard Membership subscription forms." <- works.. so perhaps it's something to do with the short code?

    Cheers,
    Daniel

  • cparkinson
    • Flash Drive

    Thanks, toggleway!

    Removing the subscriptionform shortcode from the registration page helped. Now paid registration is working perfectly. However, my free/trial membership option is failing to redirect after the "subscribe" button - it just keeps reloading that page. The user is created and logged in, but with no Membership subscription information attached.

    So, that's progress. Maybe there's something I can tweak in the free membership configuration. I'll keep looking at it.

    Thanks!

  • cparkinson
    • Flash Drive

    Thanks! I gave it a whirl, and I'm still having trouble with the free subscription. Maybe it's a configuration problem.

    I have one free ("basic") and one paid ("premium") access level, each corresponding to a free and a paid subscription. I have PayPal single Payments gateway configured. It appears to be working correctly. I also have "Free subscriptions Gateway" set to active. I can't tell if it's working or not. Maybe I shouldn't even have it active. I've tested with Options > User Registration > Use Subscription set to both "basic - free" and "none".

    When I set the Use Subscription to "none", the paid registration works exactly as I would like it to. The user is assigned only the paid subscription.

    When I set Use Subscription to "basic-free", the premium/paid registration works, but the user is assigned both the free and the paid subscriptions. I can live with that, if it helps get the free registration working, but I'd prefer if the free and paid subscriptions were completely separate.

    Here are my tests:

    Test 1. setting Options > User registration > use subscription “none”
    1. test paid: user created, active, assigned correct subscription, everything looks fine.
    2. test free: two "subscribe" buttons appear on the second screen. I have the Free Subscription Gateway set to french so I can tell which one it is. I tested both.
    button 1 (fr, Free Subscriptions Gateway): Screen reloads with no apparent change. In background, user is created, inactive, no subscription assigned.
    button 2 (en): same as above.

    Test 2. setting Options > User registration > use subscription “basic - free”.
    1. test paid: user created, active, assigned Premium and free basic subscription.
    2. test free: one button (en). Screen reloads with no apparent change. User created in background, inactive, no xprofile Buddypress user date seems to be associated, registration does not appear to complete.

    Any advice would be helpful. Am I doing something wrong with the free gateway? When I had Membership 2.1.4, I could do test case 1 above and both Paid and Free registrations completed. I had the problem with Free and Paid subscriptions both being assigned to the paid registrant, but I can hack around that where I need to, and the free registration was working ok.

  • cparkinson
    • Flash Drive

    I tested some more and got the free registration pretty close to working:

    settings:
    “free subscription” gateway - inactive
    Options > User registration > Use Subscription “basic - free”.
    registration page:default blank, no shortcode

    The registration appears to complete, with the user seeming to be automatically logged in and active on the front end. The correct subscription is assigned. However, the user is set to "inactive" on the backend, and can't log out and log back in with the newly created account.

  • Barry
    • DEV MAN’s Mascot

    I also have "Free subscriptions Gateway" set to active.

    If you have the single payments gateway activated, then deactivate the free one as they will both try to process free subscriptions otherwise.

    When I set Use Subscription to "basic-free", the premium/paid registration works, but the user is assigned both the free and the paid subscriptions.

    Only set the use subscription if you want to automatically assign it - it's probably best to have that set to none.

    If you can try those settings and the user is still being left inactive, then you can switch on the Incomplete signups check box that will prevent that for now.

  • cparkinson
    • Flash Drive

    Here's what I see, testing Mason's latest posted copy of Membership 3.0 premium (I re-downloaded just to make sure):

    Using default registration page, no shortcodes, e.g: mysite/registration-page/
    Paypal single payment gateway
    Options > User registration > use subscription: “none”.
    Options > User registration > Enable incomplete signup accounts: checked
    In WP settings > General > Membership "Anyone can register" is not checked.

    1: choose subscription. Clicked “free”.

    2: fill out WP and buddypress required profile fields. Clicked “sign up”

    3: registration-page/?action=registeruser&subscription=2 At this point, WP or buddypress appears to have logged me in. The “welcome” widget displays a “log out” button, but not my username or subscription level (custom code). In the admin panel, the user has been created and activated. Message: “Please check the details of your subscription below and click on the relevant button to complete the subscription.“There’s one option, “free subscription”, click it.

    4. Page reloads with same message and same button. Now the user name appears in the “welcome” sidebar widget. No subscription is assigned.

  • Mason
    • DEV MAN’s Sidekick

    Hiya @cparkinson,

    Argh, I thought we had this nailed. The gateway issues are the most frustrating as there's so many variables to test and it's difficult at best to get accurate, stable responses from the gateways. I'll ask Barry to take a look here. Thanks again for your feedback and patience here.

  • cparkinson
    • Flash Drive

    Hello

    The "Warning: Cannot modify header information" error has been resolved - I haven't seen that in a while. I did apply the interim fix, and while I can't get it to do exactly what I want, it's close.

    I don't think the gateway is the problem. I'm using Paypal Single Payment gateway, and I don't think it's causing any problems.

    I would like to have one free and one paid ("premium") subscription level. I can't get them to work as two separate entities; the best results I've had (users being created, assigned subscriptions, and activated) results in the paid subscription member also getting the free subscription. What is closest to what I want is this:

    Test 4: free
    “free subscription” gateway - off
    Options > User registration > use subscription “free”.
    allow incomplete registrations

    registration page: http://myserver.com/community/registration-page/
    click on “free subscription”

    registration page reloads:
    http://myserver.com/community/registration-page/?action=registeruser&subscription=2
    message “You currently have a subscription for the Basic – Free subscription. If you wish to sign up a different subscription then you can do below.” Displays Paid membership, “Subscribe” button.

    User is logged in and subscription assigned (you can tell if you click elsewhere on the site). User is active in the admin panel. If the new user logs out, they can log back in.

    Test 5: paid subscription
    “free subscription” gateway - off
    Options > User registration > use subscription “free”.
    allow incomplete registrations

    registration page: http://myserver.com/community/registration-page/
    click on “premium subscription”

    registration page reloads: http://myserver.com/community/registration-page/?action=registeruser&subscription=1

    paypal “subscribe” button. go to paypal (single payment gateway), pay. User is created and activated. User is assigned both free and paid subscription levels.

    Here are some other tests I did, attempting to separate the free and paid subscriptions:

    Test 1:
    “free subscription” gateway - off
    Options > User registration > use subscription “none”.
    allow incomplete registrations

    registration page: http://myserver.com/community/registration-page/

    offers choice of free or paid subscription, clicking “free”.

    The registration page reloads:
    http://www.myserver.com/mysite/registration-page/?action=registeruser&subscription=2

    “Please check the details of your subscription below and click on the relevant button to complete the subscription. “ Free subscription, Subscribe button.
    Checking admin panel: User is logged in and active, but no subscription level is assigned.

    Test 2:
    “free subscription” gateway - off
    Options > User registration > use subscription “none”.
    do not allow incomplete registrations

    registration page: http://myserver.com/community/registration-page/

    Same as above:
    The registration page reloads:
    http://www.myserver.com/mysite/registration-page/?action=registeruser&subscription=2

    “Please check the details of your subscription below and click on the relevant button to complete the subscription. “ Free subscription, Subscribe button.
    Checking admin panel: User is logged in and active, but no subscription level is assigned.

    Test 3:
    “free subscription” gateway - off
    Options > User registration > use subscription “free”.
    do not allow incomplete registrations

    registration page: http://myserver.com/community/registration-page/

    registration page reloads:
    http://myserver.com/community/registration-page/?action=registeruser&subscription=2
    message “You currently have a subscription for the Basic – Free subscription. If you wish to sign up a different subscription then you can do below.” Displays Paid membership, “Subscribe” button.

    User is logged in and subscription assigned (you can tell if you click elsewhere on the site) but inactive in the admin panel. If the new user logs out, they can’t log back in.

    So, it's not ideal but it's pretty much working. I also have 2.1.4, which I can almost configure to work just how I want it to, but doesn't automatically log in users.

    thanks!

    -clare

  • 3SixtyEvolve
    • New Recruit

    Hi Clare

    Some advice from the Developer. When upgrading to the latest version please delete the existing version completely and then upload version RC2. It's best to remove it first as that will ensure that all the new files are uploaded and there aren't any risk of having some files from the old version left behind.

    Easiest way would be to use your FTP Client to access the wp-content/plugins folder and delete/upload from there.

    All the best!

    Gina

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.