Fix for ‘Smells-Like-Facebook’ theme error
After upgrading my WordPress and installing the new theme, “Smells Like Facebook” the first problem I ran into was errors anytime someone posted a comment:
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/smells-like-facebook/functions.php:12) in /home/mysite/public_html/wp-comments-post.php on line 82
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/smells-like-facebook/functions.php:12) in /home/mysite/public_html/wp-comments-post.php on line 83
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/smells-like-facebook/functions.php:12) in /home/mysite/public_html/wp-comments-post.php on line 84
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/smells-like-facebook/functions.php:12) in /home/mysite/public_html/success/wp-includes/pluggable.php on line 865
Seems that I’m not the only one having this problem, and the theme author appears to be busy, so I took it as a personal challenge to fix the damn thing myself. It only took 2 or 3 hours, but I think I got it. I’m posting it here for other people getting these annoying “Cannot modify header information – headers already sent” errors with the Smells Like Facebook theme.
WARNING:: I am not a coder. I do not know what I am doing. Before you attempt the changes below, back up your files, your Wordpress database, your email and all your iTunes music! If you find that this ‘fix’ of mine breaks something else, please post a comment here. I’ve been testing this fix for a few hours and as far as I can tell, it’s working – but I make no guarantees.
As indicated in the error message, the problem is in the functions.php file, at or about line 12, which reads:
add_filter('comment_text', 'slf_comment_text', 29);
function slf_comment_text($comment) {
echo str_replace("<br>", "<br/>", nl2br($comment));
}
The fix is to change that section to read:
add_filter('comment_text', 'slf_comment_text', 29);
function slf_comment_text($comment) {
if(empty($_POST['comment_post_ID'])) {
echo str_replace("<br>", "<br/>", nl2br($comment));
}
}
Like I posted above – this has worked for me so far. If you find any problems please post them.
Applies to “Smells Like Facebook” Version 2.4






I am not able to find that text i the source for functions.php. (accessed via the admin screen, Appearance > Editor)
But it appears the comment did post successfully, here. Yours to me was flagged by askimet as spam for some reason.
huh? that’s weird. I just re-downloaded the theme (ver 2.4) and confirmed it’s right there at line #12; something is fubar over there..
Damn I shouldnt do this while talking Ambien. I kept commenting on the authors site.
Oh I was on 2.3. There hasn’t even been an announcement about 2.4, what the heck? Anyhow, I made the upgrade and then placed your hack into mine. This is your final test from me. Once more in return?
Thank you..
I’ll fix it in the next update..
Thanks for this!
Wew, Nazieb terkenal sampai disinih
wow, that’s quite a coding. Can you translate that to HTML which i understand
The coding looks quite complicated, but i love the theme! It looks just like a Facebook page.
wow thanks…iv been looking for this the who day
Hi, Randy. It looks like your code is working.
Congrats.
Thanks for the solutions.
May I ask U something?
how to make “Like” and “share this” as your theme?
Thx alot
The “Like” and “share this” are both Wordpress Plugins.. Just search the Wordpress Plugin repository and you’ll find several to choose from.
hey randy i would just like say that its a very great template,,, i would just like to ask if theres a blogger template like this…. thanks
Hi thanku, i solved my problem with your solution.
It did it… Thanx, it work!!! Case closed! ^_^
it works like a charm…thank u man….
but something weird happen on my blog…when someone put a comment after they press submit, it goes to a blank screen and on the address bar it shows like this my original wordpress url.
I use different address between my wordpress folder and my blog apperance.
Can you tell whats wrong with it?
…It is SAFE MODE ON issue, if you have SAFE MODE turned OFF, then this error doesn’t manifest itself…
Thanks for working patch!
Thanks For the solution man…………..
please test in my blog..it’s OK or NOT..thnks..
@isdaryanto – i still see the errors when i posted a comment
Hi randy..i’m sorry..you’re very fast to visit in my blog but i did’nt finish yet to edit this theme..hahaha..so please visit my blog again.. i hope that fix for errors..i like your creativity to make bottom bar with image..tell me if you find this script to make bottom bar..thnks
thank your blessing father is my web pleases, almost i am mahu install comes his theme. 5 my times has failed and appear problem likes this.
loving the template. Really a facebook feel.
Dude, you totally rule! God bless you, you saved my day! Enjoy he Christmas vacation
Awesome work Randy! Even the author still got the same problem as i tried to post comment in his web. Almost give up till I found your powerfull code. You deserve a Best Christmas time.. Our warmest regards..
Hey Randy great site ya got there, just wondering how do ya manage to be able to add so much text in the comments box? On my site I am unable to add as much text as you, any ideas ? Thanks mate
Hey Randy, your code about the odd # that was messing things up, that is brill. Your fix worked great, I used it to fix my problems.Tope bloke Randy
@Jon: i never had any trouble with the amount of text in the comment box so I dont know what might be causing that on your site.
Hey Randy, wow man you seem like a super helpful dude. Much appreciation for taking the time to help everyone out like this. Quick question… I can’t get MY avatar to show up. I’ve set it up at Gravatar.com but it isn’t pulling the picture when I post or comment on my own blog, like yours is. I’m using the same email address that’s in my WP General Settings section. Any guesses what would be up with it?
@Travis.. well.. that’s odd.. are other people’s Gavatars showing, and only yours isnt, are, are NO Gravatars showing?
Hey Randy. Your quick man. Yeah, other peoples are showing… just not mine. Can’t be anything big I’m thinking. I was just thinking that maybe there’s some other place I’m supposed to put my email address or something.
I assume you’re using the newest version of Smells Like Facebook. After some Googling, i’m seeing that others are having the same trouble with Gravatars displaying as you, so i assume it’s a bug in the newer version. I’m still using and older version (i’m afraid to upgrade!). You may want to try clearing your browser-cache in the event you’re just not seeing it yourself. Post a link to your blog and i’ll let you know how it looks from my end..
Thanks Randy for spending time on this little issue for me! Not too many people around like that. I’ve been looking around too and it looks like I’m slightly retarded and set my gravatar to Rated PG and set the maximum rating at my blog to Rated G. All fixed now. Seems to be working, even with the upgraded version that I have. Thanks again man.
thanks alot thanks..i just messed with that
Hello! I have a little problem with this theme. I use Facebook like button and it is visible everywere, but not in categories. In first page is visible under every topic, but when I click on some category, there is no facebook like button under topics ( only in categories ) . Do you know why? And I have another problem – when someone like my post, activity ( ex. X likes X on X.com ) is visible only in personal profile, but not in News Feed and the traffic is so low. I see my friends, when like some link from webs ite ( with FB Like funktion ) , but in my blog, when someone like something, there is activity only on his/her profile, but not in news feed to his/her friends. Do you know why? Thank you a lot! Have a nice day!