Skip to:
Content
Pages
Categories
Search
Top
Bottom

Quote Plugin Weirdness

  • @citizenkeith

    Participant

    I’m running bbPress 0.8.1 with the Fix bbPress Plugin. I installed Michael Nolan’s Quote plugin, version 0.2.

    It works fine if you quote simple post. But when you quote a post that already has a quote in it, things get weird. This is what my edit box looks like when I do that:

    <blockquote></blockquote>
    <blockquote>
    This is text that was quoted in the post that I am quoting.

    </blockquote>
    This is the text that I am quoting directly.

    It looks as though the plugin doesn’t like nested blockquotes.

    My forum is here:

    http://www.citizenkeith.com/forums/

Viewing 16 replies - 1 through 16 (of 16 total)
  • @null

    Member

    That is the problem with this plugin, it uses blockquotes. I suggest the plugin builder uses <quote></quote> for this (some users want to use the quoteblocks and also want to quote stuff.

    But yourproblem (Keith) is that bbpress can’t handel nested blockquotes (I think)

    @wittmania

    Member

    Let’s see if it does…

    This is the opening of the first blockquote.

    This is the opening of the nested blockquote.

    This is after the closing of the nested blockquote.

    This is after the closing of the first blockquote.

    Now, how’d she do???

    UPDATE: Nope. It automatically closes the first blockquote tag before it will open another one.

    Any ideas on how to make this work better?

    @fel64

    Member

    Bah, this is bb (and WP) trying to be clever. It’s annoying; they both mess with your code too much. >_< Although at least WP can handle nested blockquotes.

    @citizenkeith

    Participant

    Bah, this is bb (and WP) trying to be clever. It’s annoying; they both mess with your code too much. Although at least WP can handle nested blockquotes.

    Could nested blockquotes be handled by CSS? Does bbPress need to “handle” nested blockquotes in a special way?

    @aphelionz

    Participant

    Another solution could be to use the preg_replace function or something similar to edit out the original quote so you’re not nesting them at all, just taking what was written by the person who is doing the quoting

    @fel64

    Member

    Keith: Yeah, it can. Easily. By WP handling it I really meant being smart enough to leave it alone. :P

    Aphelionz, you’re right. I feel stupid for such an oversight to the nesting problem. >_< However, my perl regexes aren’t particularly good and it’s not working (nor is it returning an error).

    $row->post_text = preg_replace( '/<blockquote>.*</blockquote>/', '', $row->post_text );

    If anyone knows how to fix that that’d be great.

    @aphelionz

    Participant

    Regex’s are a mystery to me, but I did end up doing something pretty cool with it – I added an INNER JOIN to the sql to grab the username of the quoted..

    function bb_quote_message() {
    global $bbdb, $topic;
    $post_id = (int)$_GET['quote'];
    if ($post_id) {
    $row = $bbdb->get_row("SELECT * FROM $bbdb->posts INNER JOIN wp_users ON bb_posts.poster_id = wp_users.ID WHERE bb_posts.post_id={$post_id} AND bb_posts.topic_id={$topic->topic_id} AND bb_posts.post_status=0");
    $row->post_text = preg_replace( '(<p>|</p>)', '', $row->post_text );
    if ($row) echo htmlentities('<blockquote>"'.trim($row->post_text).'"<br /><strong>- '.$row->user_login.'</strong></blockquote>', ENT_COMPAT, 'UTF-8');
    }
    }

    @fel64

    Member

    Not sure what black magic you just haxed up there (MySQL I am fairly clueless about), I just did this:

    $quoted = bb_get_user( $row->poster_id );

    My full modifications are:

    function bb_quote_message() {
    global $bbdb, $topic;
    $post_id = (int)$_GET['quote'];
    if ($post_id) {
    $row = $bbdb->get_row("SELECT * FROM $bbdb->posts WHERE post_id={$post_id} AND topic_id={$topic->topic_id} AND post_status=0");
    $//row->post_text = preg_replace( '(|
    )', '', $row->post_text );
    $row->post_text = preg_replace( '/<blockquote>.*</blockquote>/', '', $row->post_text );
    $row->post_text = str_replace( '', '', $row->post_text );
    $row->post_text = str_replace( '
    ', '', $row->post_text );
    $quoted = bb_get_user( $row->poster_id );
    $quotesince = bb_since( $row->post_time );
    $quotesince = ' - ' . $quotesince . ' ago ';
    $quotelink = get_post_link( $row->post_id );
    $quotelink = '<a href="' . $quotelink . '">&nbsp;&raquo;&nbsp;</a>';
    if ($row) echo htmlentities('<blockquote><cite>'.$quoted->user_login . $quotesince . $quotelink . "</cite>n".$row->post_text.'</blockquote>', ENT_COMPAT, 'UTF-8');
    }
    }

    function fel_addcitetag( $tags )
    { $tags['cite'] = array();
    return( $tags ); }

    add_filter( 'bb_allowed_tags', 'fel_addcitetag' );

    You can see my regex attempt to get rid of blockquotes, although for some reason despite it being marked as code the b-quote tags were still removed.

    I also switched from regexing the paragraph tags tostr_replaceing them, which is apparently much faster. Again, though, they’re filtered out.

    @aphelionz

    Participant

    I just tried this and it still has the glitch with the nested quotes…

    I absolutely love the addition of the » link!

    @citizenkeith

    Participant

    You guys are way over my head. :D

    @aphelionz

    Participant

    Sorry, citizenkeith… we still havent solved the problem :(

    @citizenkeith

    Participant

    Just wondering… will quoting be a part of the next version? Or will we still rely on a plug-in for it?

    @helgetry

    Participant

    I think this problem must be solved via the function bb_allowed_tags() in the formatting-functions.php file. But I don’t know how yet.

    (And I do have the same problem myself…)

    @citizenkeith

    Participant

    Can this plugin be changed so that each seperate quote is shown in order, as separate blockquotes, rather than nesting them?

    How can I add the word “Quote:” above the blockquote with this plugin?

    And maybe even “quoted by: username”.

    @cartmanffc

    Member

    Where exactly should I put this code in post-form.php?

    <textarea name=”post_content” cols=”50″ rows=”8″ id=”post_content” tabindex=”3″>

    <?php if (function_exists(‘bb_quote_post’)) bb_quote_post(); ?>

    </textarea>

Viewing 16 replies - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.
Skip to toolbar