Skip to:
Content
Pages
Categories
Search
Top
Bottom

Editing the "Freshness" column contents


  • Jake Hall
    Participant

    @geekserve

    Can I just say, whilst bbPress is a great SSO solution for those wanting to hook up their WordPress with a forum, it is very difficult to get it going how you like it. There is virtually no decent documentation going over anything except the basics.

    I am trying to achieve something relatively simple, however have had to resort to editing the actual plugin itself in an attempt to get it working how I’d like it to be.

    What I am trying to do, is edit the freshness part of bbPress. What do I mean by that? Well, I am trying to edit the following:

    null

    So what I wanted it to do, was display the actual Topic Title. It makes sense, because as default – what has updated? What thread was last updated without having to drill into the forum?

    I also found it bizarre that the title was added within the title tag of the freshness, really? Can we just have some sort of option to allow us to change how things are layed out, or at least create some documentation on how to actually change this without editing the bbPress plugin files (which is what I have had to resort to…)

    My question is, how can I change what is displayed there? Surely there’s a better way around it that doesn’t involve hacking my way through the plugin files.

    Which bbPress file actually changes this? Like I say, absolutely no documentation on what each file does – it is just guesswork………………

    If I am missing something I apologise, but after looking for countless hours I just decided to edit the plugin source to achieve half of what I wanted – still doesn’t help as I would like to change the location of the author picture and time edited and I am not editing the plugin for those.

    Am I being stupid?

    If anyone would like the most recent topic name within the forum to display on the index, you can edit the Plugin source code directly like so:

    if ( !empty( $time_since ) && !empty( $link_url ) )
    			$anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>';
    		else
    			$anchor = esc_html__( 'No Topics', 'bbpress' );
    
    		return apply_filters( 'bbp_get_forum_freshness_link', $anchor, $forum_id, $time_since, $link_url, $title, $active_id );

    Find that chunk of code within bbpress/includes/forums/template.php and change to the following:

    if ( !empty( $time_since ) && !empty( $link_url ) )
    			$anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $title ) . '</a>';
    		else
    			$anchor = esc_html__( 'No Topics', 'bbpress' );
    
    		return apply_filters( 'bbp_get_forum_freshness_link', $anchor, $forum_id, $time_since, $link_url, $title, $active_id );

    All we have done here is changed the $time_since to $title. Now you need to re-add the $time_since variable in there somewhere, which is a pain because you may not want it right after the thread title (like myself…)

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

  • Robkk
    Moderator

    @robkk

    i had this kind of layout one day messing around with bbPress templates in my child theme.

    i think its close to this but i havent tested it to make sure.

    its without the permalinks though , i had permalinks before but right now i just breezing through the templates and trying to find them.

    for the forum loop

    <a href"<?php bbp_forum_last_topic_permalink(); ?>"><?php bbp_forum_last_topic_title(); ?></a>

    for the topic loop

    <a href"<?php bbp_topic_last_reply_permalink(); ?>"><?php bbp_topic_last_reply_title(); ?></a>

    EDIT: added permalinks


    Jake Hall
    Participant

    @geekserve

    Why has this not been documented anywhere?

    That is probably my biggest problem with bbPress right now, documentation is non-existant. You’ve got to crawl through the plugin code to find what you’re after.


    Robkk
    Moderator

    @robkk

    @geekserve

    did it work??

    ill add it to the docs in a minute if it did

    listing this kind of code and putting examples like this is a whole lot easier than talking about spam/security/seo in a doc article.


    Jake Hall
    Participant

    @geekserve

    @robkk yeah, it did. You missed the = after href however!

    Had to add an if{} statement for bbp_get_forum_last_topic_id() to catch whether or not a forum actually had threads / replies, other than that perfect – I have control!

    Cheers dude.


    Robin W
    Moderator

    @robin-w

    Like many plugins the documentation is not great, and as a humble user I have added to it as I have learnt, a good deal of the documentation is mine.

    bbpress is a complex plugin, and I sympathise that it is not great to grasp.

    With templates, all functions are written to allow you to filter what is there, this is a standard wordpress/php process, so you’re sort of expected to know about it as part of wordpress! I did try to explain it in

    Step by step guide to setting up a bbPress forum – part 5

    you can filter many bbpress functions using ‘parse args’ capability – a standard wordpress technique or just filter the whole function, you’ll see a return apply_filters in all template functions and this is the hook that you use.

    so for you you could us the code in your other post

    Display the last topic updated in the forums loop

    If you’d like to help with documentation, just find where something is poor and write what you think it needs changing to, it is newcomers like you that can really help improve what is there

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