We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum


Thread tagged as: Problem, Members

PerchSystem::redirect(); blocking rendering in Perch 3 and Members

I've got a site where users login via a page called /login/. On entering their details, it should direct the user to the page /feeds/. However, it stays on the login page and blocks rendering of anything below it.

This is the code below:

  <?php if(perch_member_logged_in()): ?>
    <?php PerchSystem::redirect('/feeds'); ?>
  <?php else: ?>
    <div class="feeds">
      <?php perch_members_login_form(); ?>
  <?php endif; ?>

Anyone able to spot what is blocking rendering?

Ben Furfie

Ben Furfie 3 points

  • 3 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

What is in your error log?

Ben Furfie

Ben Furfie 3 points
Registered Developer

PHP Warning: Cannot modify header information - headers already sent by (output started at /Users/ben/Sites/elanet/dist/login/index.php:18) in /Users/ben/Sites/elanet/dist/perch/core/lib/PerchUtil.class.php on line 233

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can't redirect (which is sending an HTTP header) after you've begun outputting the response body.