Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbp_list_forums – add_filter help!


  • webgardengeek
    Participant

    @webgardengeek

    I thought I followed the codex instructions pretty clearly, but this add_filter in my functions.php file is resulting in a 502 error and… I have no clue why!

    Sorry, bbpress newbie here… any help that anyone can offer would be awesome.

    Thanks in advance,

    -Dave

    PS Here’s the code I popped in my functions.php file:

    function cxr_subforum_filter() {
    bbp_list_forums(array (
    ‘before’ => ‘<tr>’,
    ‘after’ => ‘</tr>’,
    ‘link_before’ => ‘<td>’,
    ‘link_after’ => ‘</td>’,
    ‘separator’ => ‘<br>’,
    ));
    }
    add_filter( ‘bbp_before_list_forums_parse_args’, ‘cxr_subforum_filter’ );

Viewing 5 replies - 1 through 5 (of 5 total)

  • Robin W
    Moderator

    @robin-w

    I’d suspect issues with the quotation – different systems seem to alter these – try making them consistent – this might work

    function cxr_subforum_filter() {
     bbp_list_forums(array (
    'before' => '<tr>',
    'after' => '</tr>',
    'link_before' => '<td>',
    'link_after' => '</td>',
    'separator' => '<br>',
     ));
     }
    add_filter( 'bbp_before_list_forums_parse_args', 'cxr_subforum_filter' );

    If it doesn’t then come back and I’ll take a deeper look, midnight here and on way to bed !


    webgardengeek
    Participant

    @webgardengeek

    Perhaps I am missing something, but your code and my code seem to be identical… nevertheless, I copied and pasted your filter into the functions.php file in the child theme and it did not work…

    Same result (502) errors.

    Any other ideas?


    Robin W
    Moderator

    @robin-w

    Try this

    function cxr_subforum_filter($args) {
     $args = (array (
    'before' => '<tr>',
    'after' => '</tr>',
    'link_before' => '<td>',
    'link_after' => '</td>',
    'separator' => '<br>',
     ));
     return $args ;
     }
    add_filter( 'bbp_before_list_forums_parse_args', 'cxr_subforum_filter' );

    webgardengeek
    Participant

    @webgardengeek

    That was it!

    So… filters need to be passed a variable which gets returned in order to function properly?

    Good to know, definitely not clear in the bbpress codex.

    Thanks, Robin. Means alot!

    -Dave


    Robin W
    Moderator

    @robin-w

    most functions return a variable, so filters need to also.

    these ‘before..parse args’ ones always need $args returned

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