Skip to:
Content
Pages
Categories
Search
Top
Bottom

Trying to make my plugin compatible

  • @flyerua

    Participant

    Hello. Since few people asked for it (I think there was even thread here few months ago), I’m trying to make my plugin (https://wordpress.org/plugins/simple-rating/) compatible with bbPress. As far as I understand, bbPress got own filters for content and that’s exactly where I got stuck. I can’t find list of filters. I found bbp_get_reply_content and bbp_get_topic_content but they exhibit kind of weird behavior. bbp_get_topic_content does exactly nothing, and bbp_get_reply_content filters content of first post, which is actually topic and I’m pretty sure should be filtered by bbp_get_topic_content.
    Screenshot
    So questions are:
    – Is there a list of filters?
    – If no, what are filters I should use to filter content of topic, reply and forum?
    – What is this problem I described above?
    bbPress version is latest stable available.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @robkk

    Moderator

    i did find this topic that might help

    Simple Rating plugin for wordpress – get it working for bbpress?

    here is an old versions list of filters (its 2.0)

    http://etivite.com/api-hooks/bbpress/triggers/apply_filters/

    here is a gist that might be helpful (2011)

    gist.github.com/farinspace/1372637

    you can manually find topic/replies/forums filters in

    by going to through the plugin files in

    bbpress>includes>

    then choose replies/forums/topics

    then go into the template file to find all the filters used

    @robin-w

    Moderator

    Most of the filters are held in the templates that are located as follows :

    wp-content/plugins/bbpress/includes/forums/template.php
    wp-content/plugins/bbpress/includes/topics/template.php
    wp-content/plugins/bbpress/includes/replies/template.php
    wp-content/plugins/bbpress/includes/users/template.php
    wp-content/plugins/bbpress/includes/search/template.php

    There are two typically filters, one on the final function usually within the ‘return’, and one that mimics wordpress’s ‘before’ filters
    from the docs

    Near the beginning of many functions we find :

    
    // Parse arguments against default values
        $r = bbp_parse_args( $args, array(
            'before'            => '<ul class=&quot;bbp-forums-list&quot;>',
            'after'             => '',
            'link_before'       => '<li class=&quot;bbp-forum&quot;>',
            'link_after'        => '',
            'count_before'      => ' (',
            'count_after'       => ')',
            'count_sep'         => ', ',
            'separator'         => ', ',
            'forum_id'          => '',
            'show_topic_count'  => true,
            'show_reply_count'  => true,
        ), 'list_forums' );
     

    This is a common format throughout bbPress, and indeed is similar to a function used throughout wordpress.

    It uses a function called bbp_parse_args to create a filter against all the arguments.

    The filter created is in the format bbp_before_ followed by X followed by _parse_args The X is the third argument from the bbp_parse_args function – if you look at the code above you’ll see that it is actually
    bbp_parse_args ($args, Array(...), 'list_forums' )

    so in the last line we see list forums which is the X above . In practice this is the function without the bbp start bit.

    so an array filter for bbp_list_forums is bbp_before_list_forums_parse_args
    and for say bbp_get_topic_pagination would be
    bbp_before_get_topic_pagination_parse_args

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