Info
- 38 posts
- 21 voices
- Started 5 years ago by larmir
- Latest reply from naviathan
- This topic is not resolved
Slashes being added in front of apostrophes
-
- Posted 5 years ago #
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.
-
- Posted 5 years ago #
Let's see if that's true on this server.
EDIT: nope. Perhaps it's a PHP magic quotes issue. I'm surprised this does not happen for new posts, though.
-
- Posted 5 years ago #
larmir,
I had a similar thing happen to me on WordPress. Just about went nuts trying to figure it out, but I finally did. I would think that since bbpress is made by the same folks who did WordPress that you're experiencing the same thing I did with WordPress. I'm guessing that when you created your database that you didn't create it in UTF-8 format. If you check the installation documentation, see if it recommends UTF-8. Then, check to see what kind of encoding is on your database. If that is the problem, you can solve the problem fairly easily. Here's a link to instructions that I wrote for fixing the problem in WordPress:
http://www.minc.info/?p=32You should be able to do the same thing to fix it with bbpress. *NOTE* I haven't tried this with bbpress so I can't guarantee it will work.
Hope that helps,
Ben -
- Posted 5 years ago #
Trying to re-up this post to find solution. Thanks ben-h, will see what I can find out on the db config.
On futher review, this IS happening on new posts. Any idea where to turn - other than the db?
-
- Posted 5 years ago #
My database is UTF-8. I also have the same database shares tables with WordPress and BBPress. WordPress does not have this problem. Though it happens with all apostrophes and quotation marks on BBPress - new posts and edits. With edits, it will keep adding slashes each time a post/thread is edited.
Any ideas where to look? I'd really like to get this solved.
BTW, what is the 'PHP magic quotes issue?'
-
- Posted 5 years ago #
Anyone have any other ideas? This slash thing is driving us crazy...
-
- Posted 5 years ago #
I'm still having the problem. Can anyone help?
If it is the 'php magic quotes issue' can someone let me know what to look at to fix it?
-
- Posted 5 years ago #
What database are you using and what is collation?
-
- Posted 5 years ago #
mysql on DreamHost. Don't know what you mean by collation.
I'd really like to know how to fix this.
-
- Posted 5 years ago #
larmir, do you have an example URL where we can register and test this out? Also, does Dreamhost have a phpinfo() where we could see about magic_quotes_gpc and magic_quotes_runtime? If they do not have that file, can you create a file on your server called info.php or phpinfo.php (name does not matter so long as you know it) and then, in that file, put this:
<?php
phpinfo();
?>That will give all sorts of useful information, including your magic_quotes settings.
Thanks.
-
- Posted 5 years ago #
Did this. Here's my magic_quotes settings...
magic_quotes_gpc Off Off
magic_quotes_runtime Off Off
magic_quotes_sybase Off OffThis any help?
-
- Posted 5 years ago #
That's different from my install, my magic_quotes_gpc are "on" and "on". Now to find out how to get around that for your server...
What version of PHP are you using? That phpinfo() will tell you, or from the command line, I think
php -vAlso, do you have the ability to use a .htaccess file?
-
- Posted 5 years ago #
PHP Version 5.1.2
Yes, I have the ability to use .htaccess. Though I don't no much about its parameters. I've used it for 301 redirects and that's about it. Help with writing anything for the .htaccess would be greatly appreciated.
One bit, I have WordPress on the same server using the same database (bbPress is integrated) and this is NOT an issue in WP - only in bbPress.
-
- Posted 5 years ago #
I have bbpress and wp on the same database too, and I don't have a problem with either one. Looking into the gpc_magic_quotes or where addslashes and stripslashes are used.
What type of quotes are added, single or double?
Also, do you have a URL where this can be experienced? Looking through the code, there are a lot of slash-things in there. I would like to narrow the problem down by first seeing it. Thanks.
-
- Posted 5 years ago #
I'm getting slashes added to apostrophes and quotes.
I'd like to give you a URL, but can I do so through email? The forum is private and so I don't want to publish its URL here.
Here's my email address dawudmiracle TA gmail TOD com. If you could send me yours, I will forward you a link. Sorry for wanting to remain private - I'm not the only one using our forum and I'd like to be sure its privacy isn't compromised.
Thanks for continuing to help.
MODERATED: obfuscated email address
-
- Posted 5 years ago #
Did you find the source of the problem? Even better, did you find a solution? :)
-
- Posted 5 years ago #
No, we haven't. Chrishajer's (Chris) been graciously helping me off the forum since I'm working with a private forum. He's spent quite a bit of time on this and hasn't found a solution. He had some great ideas, they just didn't work. My next step is to contact my host and talk with them. They host WordPress so perhaps they know something indepth about bbPress. If I find a solution, I'll let you know.
I do want to thank Chris for all the time and effort he's put into this for me. Thank you, Chris.
-
- Posted 5 years ago #
Glad to hear someone else is having the same problem as me... misery loves company, right?!? I have found one thing that may be helpful. When I removed the:
require_once( '/.../wp-config.php');
define('WP_BB', 'true');The problem magically vanishes... So, I'm pretty sure it has something to do with the WP integration. Interestingly, I checked my phpinfo and my magic_quotes are all off as well and my php version is 4.4.4.
My forums are at: http://www.digitalfrontierplus.com/wordpress/forums/
-
- Posted 5 years ago #
I can add one more sample of these symptoms.
The only oddity I've been able to find through phpinfo is that it reports the mysql Client API version as 3.23.58, which I find odd as I have mysql 4.1.x on the (linux) server. magic_quotes are off. This is with php 4.3.10, WP 2.1, bbP .75' and " each show up with a single backslash in front of them, but if I put a backslash in the text in front of ' or " it yields 3 backslashes and the '/" I don't know if this double backslash is expected or if it might help find the problem.
Thanks for helping to track this down.
-
- Posted 5 years ago #
Easy fix (hack) in bb-includes/template-functions.php, update this function to look like this:
function get_post_text() {
global $bb_post;
return stripslashes($bb_post->post_text);
}May be an artifact of the wordpress integration - not sure.
-
- Posted 5 years ago #
This seems to work for the text. Thanks so much baptiste.
One more question, the issue still exists in the title. I'm guessing I need to update this expression, just unsure of the syntax:
function get_topic_title( $id = 0 ) {
global $topic;
if ( $id )
$topic = get_topic( $id );
return apply_filters( 'get_topic_title', $topic->topic_title, $id );
} -
- Posted 5 years ago #
Heck yeah! Baptiste kicks Mucho Asso!
-
- Posted 5 years ago #
return stripslashes(apply_filters( 'get_topic_title', $topic->topic_title, $id )); -
- Posted 5 years ago #
I'm 90% sure this is related to the kses issue I'm looking into because kses has a strip slashes filter that I think is being used as well, but not 100% sure. The fact that it only happens on WP integration makes me pretty sure it's kses.
-
- Posted 5 years ago #
baptiste - thank you. This worked like a charm. Problem resolved and I can't thank you enough.
-
- Posted 4 years ago #
thanks baptiste!
The fix worked wonders :)
-
- Posted 4 years ago #
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.
-
- Posted 4 years ago #
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.
-
- Posted 4 years ago #
RCanine - that code works perfectly! Fixed the problem in titles and posts. Thanks!
-
- Posted 4 years ago #
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.