Membership Plugin PHP8

4 posts by 3 authors in: Forums > CMS Builder
Last Post: May 24, 2022   (RSS)

By gkornbluth - May 20, 2022

Hi Dave,

I don't know if it will help but there are a number of posts that come up when you do a search for: headers already sent!. There's one post that suggests:"The first thing I'd do would be to check through the plugin files to see if there are any blank lines either at the very top or the very bottom of files. Often this problem is caused by an extra blank line after the ?> at the bottom of a PHP file."

Also check my posts from that search and look at the answers at the end of each.

Basically, when I encountered some pages that threw a 'header' error, I solved the problem by taking another working page, making a copy of it, and then replacing everything except for the load viewer library and get records calls with the page code which originally caused the error, which in your case is the rest of the code from your client-area.php page.

Since you're setting an HTTP-header : you must not have sent any kind of output before (not even a blank space at the end of an included file) or at the beginning of the page code. If you do you'll throw a "Warning: Cannot modify header information - headers already sent" error. Test your page after the modification to make sure that it works as planned, and proceed
accordingly. 

The rub is that those blank spaces may not show up in your particular code editor.

My other post describes another possible solution offered by Dave Edis

Just make a backup of your original client-area.php page before you make any changes.

Hope that all makes sense and that it helps,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By daniel - May 24, 2022

Hi Dave,

The error is being caused by this line:

$CompName = $CURRENT_USER['fullname'];

It is being referenced before the page checks to see if the user is logged in (this is what creates the $CURRENT_USER array). So a simple fix would be to move this line that checks for a logged-in user:

<?php if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); } ?>

And move it above the line at issue:

if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); }
$CompName = $CURRENT_USER['fullname'];

Let me know if that fixes the issue, or if you have any other questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

By dbown - May 24, 2022

Thank you Daniel.

That worked perfectly!

Cheers,
Dave