Skip to:
Content
Pages
Categories
Search
Top
Bottom

Help Me Not Hack bp-forums-templatetags.php — Forums stickies and thread counts

  • Avatar of stwc
    stwc
    Participant

    @stwc

    So a little knowledge is a dangerous thing.

    By changing line 163 in bp-forums-templatetags.php to $no_stickies = null; I get what I want — sticky threads to be sticky in the main forums view as well as in individual group forums.
    By changing line 804 to ‘per_page’ => 30, I get what I want — 30 posts per topic page. (Because for some reason passing it as a parameter of bp_has_forum_topics() shows me every post twice — possibly something to do with using the Forums extras plugin).

    But both of these changes will be overwritten by updates to Buddypress. That is, of course, A Bad Thing. I know I need to be passing parameters to bp_has_forum_topics() in forums/forum-loop.php and groups/forum/single/topic.php. What I can’t seem to figure out is how.

    So: I’m wondering if someone might be able to help me passing parameters properly from my child theme files so that I don’t have to remember these hacks and redo them every time I update BP? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Code highlighting isn’t working on this site at the moment, so this might appear messy, but put forums-loop.php in your child theme and change like so:


    if ( bp_has_forum_topics( bp_ajax_querystring( 'forums' ) . '&no_stickies=&per_page=30' ) )

    I think that ought to work.

    Avatar of stwc
    stwc
    Participant

    @stwc

    Just heading to bed, but I’ll give that a shot in the morning. Thanks, Paul.

    Avatar of stwc
    stwc
    Participant

    @stwc

    That seems to have done the trick! Thanks again. In conjunction with ‘per_page=30′ passed to bp_has_forum_topics() in groups/forum/single/topic.php in my child theme, I’ve got stickies in the overall view and 30 threads per page and 30 posts per page in each thread.

    Unless it goes weird on me. It does that sometimes.

    Avatar of stwc
    stwc
    Participant

    @stwc

    @djpaul I spoke too soon, I think.

    If I’m right, I’ve finally figured out how and when things were going wrong.

    If I use bp_has_forum_topics(‘per_page=30′) in groups/forum/single/topic.php in my child theme, on pages that have less than 30 posts (or possibly 15, the default in bp-forums-templatetags.php), I get duplicated thread posts — in other words all the posts in a thread show up, then all of them show up again.

    If I hack the bp-forums-templatetags.php file as described above, though, it seems to work fine. No duplicates, no matter the number of posts in a thread.

    Weird. Possibly a bug?

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

You must be logged in to reply to this topic.