Slashes being added in front of apostrophes
-
bbPress is adding slashes to edited posts in front of all apostrophes – why? How to fix.
The interesting thing is the number of slashes grows with each edit. So if the post is edited three times, there are three slashes in front of all the apostrophes.
-
Any updates on this being handled “properly” to avoid having to hack core code (or add filters just to do “normal” stuff)?
I’m still seeing it in 0.8.3 with WP (MU) integration.
Wouldn’t a better fix for this be to apply a filter in the “WordPress Integration” plugin? I’m not sure the exact syntax but something like:
if (function_exists('wp_head')) {
// or another check to see if WordPress has been included
add_filter('get_topic_title', 'stripslashes');
add_filter('get_post_text', 'stripslashes');
}To me this is exactly what a WordPress Integration plugin should do.
RCanine – that code works perfectly! Fixed the problem in titles and posts. Thanks!
I have tried baptiste’s changes, but I’m still getting backslashes when quoting text (using the Quote plugin).
I am integrating with WordPress, but I don’t use a WordPress Integration plugin, as referred to by RCanine. I’m using the bbPress Integration plugin.
Sweet solution, thanks guys!
Worked for me. I did note that tags and other input are still escaped, so there’s still some work to do.
Why does WP / BB not detect that kses has already been run on input? Makes sense not to duplicate input filters blindly.
thank you RCanine!
I have a site with a wordpress/bbpress integration using a modified Atahualpa/Kakumei theme. My wordpress is version 2.8.1 & my bbpress is version 0.9.0.5. and it all works fine.
I want to upgrade to the latest version of bbpress( version 1.0.1 ) but when I tested it I get backslashes before any single or double quotes no matter where I’m at in bbpress. It happens in topic titles, topic contents, when putting in the name for the site etc..
Both work fine with the integrated logins and cookies. The problem only comes after I’ve put my reference to wp-blog-header.php in the bb-config.php file.
I could do the hack that was suggested earlier but the downfall to that is that you won’t be able to have backslashes at all in anything.
I’m thinking maybe the problem is that bbpress is using wordpress’s apply_filters function instead of its own, but that is a guess.
Anyone got any ideas?
Oh and besides the bbpress-integration plugin in wordpress i’m not using anything else on the test I did.
I’m having the same problem as Croyd, plus as CitizenKeith says, there is no longer a specific ‘WordPress Integration’ plugin with the latest version of bbPress.
Any ideas anyone?
~Cyrix
\Edit – I came across a fix that works for me (http://bestservedcold.com/news/bbpress-and-wordpress-magic-quotes/comment-page-1). I also have both WP & bbPress integrated, and I commented out the line $_POST = add_magic_quotes($_POST); in wp-settings.php in my WordPress installation. I tried a test post in the forum and one on the blog and they both worked fine.
I just applied the fix listed above (here: http://bestservedcold.com/news/bbpress-and-wordpress-magic-quotes/comment-page-1 ) on line 632 of wp-settings.php hash out $_POST = add_magic_quotes($_POST ); and it works on all new posts. I am wondering though if this will cause issues with any of the other plugins or the way wordpress itself functions.
WP 3.0 / BBpress “Bechet” version 1.0.2
Inside /wp-includes/load.php I found this code:
// If already slashed, strip.
if ( get_magic_quotes_gpc() ) {
$_GET = stripslashes_deep( $_GET );
$_POST = stripslashes_deep( $_POST );
$_COOKIE = stripslashes_deep( $_COOKIE );
}So I made a BBpress plugin that (so far) works for me.
/bbpress/my-plugins/stripslashes.php
<?php
/*
Plugin Name: Strip Slashes
Plugin URI: http://www.uxtremist.com/
Description: Strips slashes from topics, tags and posts. Sort of.
Author: Adam Braimbridge <adam@uxtremist.com>
Version: 0.1
Author URI: http://www.uxtremist.com/
*/
// Make sure WordPress has been included
if (function_exists('wp_head')) {
$_GET = stripslashes_deep( $_GET );
$_POST = stripslashes_deep( $_POST );
$_COOKIE = stripslashes_deep( $_COOKIE );
}
?>uxtremist – THANK YOU!!! That plugin works perfectly. I was pulling my hair out over this.
- You must be logged in to reply to this topic.