WordPress.org

Support

Support » Plugins and Hacks » bbPress - Admin Notes » [Resolved] Topic Notes – thanks & a conflict with

[Resolved] Topic Notes – thanks & a conflict with

  • sevenspark

    @sevenspark

    Hi Pippin,

    Thanks for adding the ability to reply to the main topics – that’s a great feature, much appreciated!

    When upgrading, I noticed the following issue. I believe you are familiar with the Buddy-bbPress Support Topic plugin? Normally, the plugin displays a single selectbox, but with both that plugin and bbPress – Admin Notes enabled, it displays two

    Here’s a screenshot: http://i.imgur.com/CBu7nRW.png

    I did some debugging and here’s what I found:

    1. bbPress – Admin Notes adds the extra “Add Note” admin button by adding its own span, so you end up with two <span class="bbp-admin-links"> elements. As you noted in your code comments – “This is kind of a hacky way of doing this for now” – there doesn’t seem to be a great way of handling this.

    2. The bbPress – Support Topic plugin adds its selectbox via a str_replace (even hackier)

    $new_span = str_replace( $r['before'], $r['before'] . $support_selectbox, $input );

    (bbpress-functions.php line 360 for your reference)

    What happens is that when the Support Topic plugin replaces that span.bbp-admin-links, it finds two strings that match, and therefore replaces the span twice, resulting in two selectboxes.

    At the moment, I believe this is simply dependent on which plugin loads first.

    Potential Workaround

    Of course, a real solution would allow both plugins to add their custom elements without having to filter a string. But in the meantime, there’s a simple solution – if BBP Admin Notes changes its filter priority to ensure it runs after the Support Topic plugin, the issue is avoided because there is won’t be two matching strings when str_replace is called.

    Basically, just changing line 122 from

    add_filter( 'bbp_get_topic_admin_links', array( $this, 'add_topic_note_link' ), 10, 2 );

    to

    add_filter( 'bbp_get_topic_admin_links', array( $this, 'add_topic_note_link' ), 15, 2 );

    fixes the issue.

    Thought you might want to be aware of this, as a lot of users probably use these plugins in tandem and you may not even have noticed if your plugins happen to load in the reverse order.

    Thanks, Pippin! 🙂

    Chris

    http://wordpress.org/plugins/bbpress-admin-notes/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Topic Notes – thanks & a conflict with’ is closed to new replies.
Skip to toolbar