Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm new here and I really hope somebody can help me. I've tried alone for many days, found a lot of solutions that worked for others, but that didn't work for me and so I really hope somebody here can help me figure it out.

I have the "Guan Image Notes" Plugin installed. I finally got it to work (it seems to interfer with other plugins, especially OpenID and Captcha plugins). However I can't seem to get rid of this error message when somebody sends a comment:

Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 95

Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 96

Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 97

Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-includes/pluggable.php on line 934

The comment is still being sent, though!

I tried to modify that line. Wrapping it. The content of that line is:

echo " ";  

Here*s the whole code:

http://pastebin.com/pu86tyn5

I really hope somebody can help me figure this out. I'm a total beginner when it comes to coding. My website looks horrible right now as I'm still trying out things. If you need to check my website, here it is: click

Thanks so much in advance.

share|improve this question
1  
well delete that line :) Or post the entire file source code so we can see what's really going on there –  onetrickpony Jul 9 '11 at 18:43
    
Of course I already tried that. That was the first thing I did. The plugin stopped working when I did. –  japanworm Jul 10 '11 at 1:08
    
I edited my original entry and tried to enter the entire file source. –  japanworm Jul 10 '11 at 1:32
1  
The code-escaping for that much code appears not to be working properly. You may need to put the code in a Pastebin and paste a link here. –  Chip Bennett Jul 10 '11 at 1:48
    
Thank you very much for that advice. I edited my post. Here's the link: pastebin.com/pu86tyn5 –  japanworm Jul 10 '11 at 2:54
show 1 more comment

1 Answer

up vote 1 down vote accepted

Okay, just looking through this code quickly, it looks like the problem may be that the getImgID() function is echoing rather than returning its output.

This function is called from within another function, guan_getImgID_inserter(), that is hooked into the comment_text filter hook.

Anything that filters comment_text (or any filter hook, for that matter), should be returning its output, since the hook is already echoed, usually via a call to echo apply_filters().

So, you may want to change the echo calls to return calls, in lines 176 and 178. i.e. these:

    if($imgIDNow != "") {
            $str = substr($imgIDNow, 4, strlen($imgIDNow));
            echo "<div id=\"comment-".$str."\"><a href='#".$str."'>noted on #".$imgIDNow."</a></div>";
    } else {
            echo "&nbsp;"; 
    }

should instead be this:

    if($imgIDNow != "") {
            $str = substr($imgIDNow, 4, strlen($imgIDNow));
            return "<div id=\"comment-".$str."\"><a href='#".$str."'>noted on #".$imgIDNow."</a></div>";
    } else {
            return "&nbsp;"; 
    }

I'm not 100% certain that's the problem, but it's at least worth a shot...

share|improve this answer
    
Awesome!! That did the trick! Thank you soooo much! And here I thought I have to give up! Thank you, thank you!! :) –  japanworm Jul 10 '11 at 5:34
    
Glad it worked :) –  Chip Bennett Jul 10 '11 at 13:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.