Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] headers already sent – plugins.php


  • shanebp
    Moderator

    @shanebp

    WP 3.5, BP 1.6.4

    I’m over-riding members/single/plugins.php for use in a plugin that creates a custom profile page.

    I need to use bp_core_add_message() and then bp_core_redirect( wp_get_referer() )
    in the plugin to show success / error messages.

    This results in the ‘headers already sent’ error due to the use of
    get_header( ‘buddypress’ ) in plugins.php

    How can I use bp_core_add_message() and avoid that error ?

Viewing 5 replies - 1 through 5 (of 5 total)

  • shanebp
    Moderator

    @shanebp

    Using wp_safe_redirect instead of bp_core_redirect
    gets rid of the ‘headers already sent’ error.

    Now I have to figure out why bp_core_add_message isn’t showing the messages.

    I’ve added this div
    `id=”message” class=”error” style=”display: block;`
    after the item-header div in plugins.php
    but no messages appear…


    shanebp
    Moderator

    @shanebp

    I’ve added do_action( ‘template_notices’ )
    to plugins.php, but still no messages appear.


    shanebp
    Moderator

    @shanebp

    I’ve removed the ‘div id=message’ which is created by bp_core_render_message, duh.

    Still don’t see any messages.

    This is not a custom component, just a plugin – is that an issue ?


    shanebp
    Moderator

    @shanebp

    Still stuck on this.
    Have removed the white-space from BP default theme member files – always removing the close and open php tags before get_header( ‘buddypress’ );

    Here’s the error message:
    `Warning: Cannot modify header information – headers already sent by (output started at …/wp-content/themes/extendDefault/header.php:2) in …/wp-includes/pluggable.php on line 876`

    If I use wp_safe_redirect, it doesn’t throw the error.
    If I use bp_core_redirect, it does throw the error.

    Both methods refresh the page.
    Neither shows the message from bp_core_add_message.

    Anyone? @djpaul ?


    shanebp
    Moderator

    @shanebp

    Ok, forget the redirects.

    And you have to put
    `do_action( ‘template_notices’ );`
    in the mark-up in your screen_function.

    Having it the template plugins.php file does not do anything.

    Can a mod ‘Resolved’ this for me ?
    I can’t edit the thread title.
    Clicking the bottom EDIT just takes me to the https://buddypress.org/ home page.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] headers already sent – plugins.php’ is closed to new replies.
Skip to toolbar