Forums

Join
bbPress Support ForumsTroubleshootingSlash text issue in 1.0-alpha-6, have searched

Info

Slash text issue in 1.0-alpha-6, have searched

  1. Getting slashes before quotes/apostrophes in bbPress 1.0-alpha-6 integrated with WP.

    Have searched forum for solution, but most seem to be from 2 years ago (what can be found anyway). The core file that needs to be edited (bb-includes/template-functions.php) in those instructions is no longer called that (yes, i know which one it has become), but the code also looks markedly different.

    While I have *some* PHP knowledge and can follow most step-by-step stuff, I'm starting out with a different syntax than the instructions, which makes me a little nervous.

    Here's the code I think I may need to change:

    'function get_post_text( $post_id = 0 ) {
    $bb_post = bb_get_post( get_post_id( $post_id ) );
    return apply_filters( 'get_post_text', $bb_post->post_text, $bb_post->post_id );'

    and then what about forum titles?

    Is there an easier way to do this now, or do the core files still have to be edited?

  2. Getting slashes before quotes/apostrophes in bbPress 1.0-alpha-6 integrated with WP.

    What does that mean? /' doesn't work or ...?

  3. I think he means that quotes and apostrophes are displaying with a \ in front of them. Like it's being escaped and never un-escaped.

    So, instead of "It's Great" you would see "It\'s Great" on display.

    The issue in the past only occured when integrated with WordPress, IIRC.

    I would avoid editing core files.

  4. Oh! Okay, that makes a little more sense. I can't see why it would matter if you integrated (I'm integrated and I see naught on BB1.0a6/WP2.7), though.

    Edit UNLESS it's a charset issue. See this

  5. Or a language file issue. I seem to recall that using a different language file caused this too. Maybe it's a combination: different language AND integration, or different charset AND integration.

  6. Integration, in and of itself, shouldn't matter though. Shared DB does not integration make, and I think that pinning it on 'integration' may send some folks down the wrong path.

    Check your language file, check your charset for your DB. Let us know! :)

  7. I'm having the same issue. Any other suggestions?

    My setup:

    Integrated:
    WP 2.7.1
    bbPress 1.0-alpha-6

    Using the default bb-config charset & collation:
    define('BBDB_CHARSET', 'utf8');
    define('BBDB_COLLATE', '');

    Using the defauly wp-config charset & collation:
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');

    Using the default language file. In other words, I haven't changed anything and it should be using the English.

    Database is:
    UTF-8 Unicode (utf8)
    utf8_unicode_ci

  8. I've found a solution for this. You need to edit bbpress/bb-includes/functions.bb-posts.php and replace the function bb_get_post (it is the first function in file) with

    function bb_get_post( $post_id ) {
    	global $bbdb;
    	$post_id = (int) $post_id;
    	if ( false === $post = wp_cache_get( $post_id, 'bb_post' ) ) {
    		$post = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->posts WHERE post_id = %d", $post_id ) );
    		$post = bb_append_meta( $post, 'post' );
    		wp_cache_set( $post_id, $post, 'bb_post' );
    	}
    	//here is the only new line for stripping slashes
    	$post->post_text = stripslashes($post->post_text);
    	return $post;
    }

    Not sure that it is the elegant solution but it works for me.

  9. You must log in to post.