Skip to:
Content
Pages
Categories
Search
Top
Bottom

Freshness Date Format


  • lajd
    Participant

    @lajd

    Hi,

    How should I modify the format of the freshness date.
    I want to change it to date and time.
    I already google it,also search in this forum but can’t find clear solution.

    see attached image:
    screenshot

    Thanks

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

  • Asynaptic
    Participant

    @synaptic

    there is an existing ticket but it is awaiting popular demand to be fixed:

    https://bbpress.trac.wordpress.org/ticket/2031

    I’m not sure exactly how ‘demand’ is measured by the dev team. There certainly has been multiple requests for help to make this change both on the forum and elsewhere on the internet.

    How difficult would it be to allow for bbpress admins to toggle between a freshness date format and a date/time format? wordpress already allows for this type of dating for posts so I can’t see this as being a complicated issue.

    the freshness tag shows previous conversations about this issue:

    https://bbpress.org/forums/topic-tag/freshness/

    Here are a few previous forum postings asking for help in changing the freshness format to a static date:

    https://bbpress.org/forums/topic/freshness-date-instead-of-ongoing-time-frame/

    https://bbpress.org/forums/topic/edit-or-delete-freshness/

    https://bbpress.org/forums/topic/change-freshness-to-date-after-24-hours/

    https://bbpress.org/forums/topic/how-do-you-change-the-freshness-of-post-date-format/
    https://bbpress.org/forums/topic/show-exact-date-of-post-not-freshness/
    https://bbpress.org/forums/topic/timestamp-posted-m-d-y-time/

    there are also discussions outside of the bbpress.org forums:
    http://bbshowcase.org/forums/topic/exact-timedate-in-forum-last-poster

    http://wordpress.stackexchange.com/questions/77441/how-to-edit-bbp-forum-freshness-link-format

    Is this enough to meet the ‘demand’ quota? most people have been searching for this going back many years without any resolution.

    If this isn’t enough demand, then what would be?


    Stephen Edgar
    Moderator

    @netweb

    @synaptic It’s not always obvious but the links in your post that link to old discussions or sites (which I just edited) regarding the old ‘standalone’ bbPress and not the current bbPress v2.x plugin, circa anything over 2-3+ years of age won’t be relevant.

    As to meeting some kind of demand quota, bbPress v2.x Plugin is sitting at 1,125,146 downloads as I write this, so whatever the magical formula is it would appear it has not reached tipping point.

    Edit: That said, has anyone tried the code in the link you posted?

    http://wordpress.stackexchange.com/questions/77441/how-to-edit-bbp-forum-freshness-link-format


    Robin W
    Moderator

    @robin-w

    “Edit: That said, has anyone tried the code in the link you posted?”

    I’ve just loaded it and it seems to work fine

    function wpse_77441_change_time_format( $anchor, $forum_id )
    {
        $last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true );
    
        if ( empty( $last_active ) ) {
            $reply_id = bbp_get_forum_last_reply_id( $forum_id );
    
            if ( !empty( $reply_id ) ) {
                $last_active = get_post_field( 'post_date', $reply_id );
            } else {
                $topic_id = bbp_get_forum_last_topic_id( $forum_id );
    
                if ( !empty( $topic_id ) ) {
                    $last_active = bbp_get_topic_last_active_time( $topic_id );
                }
            }
        }
    
          $date   = get_post_time( get_option( 'date_format' ), $gmt, $reply_id, true );
          $time   = get_post_time( get_option( 'time_format' ), $gmt, $reply_id, true );
          $dt = sprintf( _x( '%1$s at %2$s', 'date at time', 'bbpress' ), $date, $time );    
    
        $time_since = bbp_get_forum_last_active_time( $forum_id );
    
        return str_replace( "$time_since</a>", "$dt</a>", $anchor );
    }
    add_filter( 'bbp_get_forum_freshness_link', 'wpse_77441_change_time_format', 10, 2 );
    add_filter( 'bbp_get_topic_freshness_link', 'wpse_77441_change_time_format', 10, 2 );

    Robin W
    Moderator

    @robin-w

    Stephen,

    Is there a quick and easy way to amend the headings other than amending the template?

    eg loop-topics.php has

    <ul class="forum-titles">
    ...
    ...
    <li class="bbp-topic-freshness"><?php _e( 'Freshness', 'bbpress' ); ?></li>
    </ul>
    

    Asynaptic
    Participant

    @synaptic

    @netweb thanks for pointing that out.

    When I said ‘tipping point’ I was referring to the closing comment on the trac ticket 2031 which refers to this issue.

    There have been multiple instances where the dev team has commented on a ticket being addressed depending on the ‘demand’ for it from the community. But the thing is, there exists no real way to measure such ‘demand’ other than a quasi-qualitative approach such as the number of forum requests.

    My suggestion is to create a uservoice type ranking system for issues so when someone requests help or change for a specific issue, it is measured and their voice added to that appropriate issue. In this way the dev team can see very clearly and quickly which issues are at the forefront.


    Asynaptic
    Participant

    @synaptic

    you can see wp symposium plugin developer using this type of community feedback system for his plugin:

    http://www.wpsymposium.com/voting/


    ZachMatthews
    Participant

    @zachmatthews

    That code kinda works. It looks like some of the timestamps are off, and the timestamps on the Forums page (as opposed to Topics) aren’t correct and aren’t updating. Anyone know how to fix that?

    looks like this line isn’t working:

    
    add_filter( 'bbp_get_forum_freshness_link', 'wpse_77441_change_time_format', 10, 2 );

    Zach


    ZachMatthews
    Participant

    @zachmatthews

    That code is also pulling only the date/time when the topic was STARTED, not the most recent reply. Any help?


    Robin W
    Moderator

    @robin-w

    I’ll take a look when I get a moment


    ZachMatthews
    Participant

    @zachmatthews

    If you could get this working and put together a quick plug in, man, you would be doing people a service.

    Zach


    lajd
    Participant

    @lajd

    Thanks to all!
    Especially to Robin W your function works.Thank you very much.
    Godbless to all!


    Robin W
    Moderator

    @robin-w

    Now available as a plugin on

    http://wordpress.org/plugins/bbp-last-post/


    Morgensonne
    Participant

    @morgensonne

    Robin, hi again :-)

    I’m still working on my new bbPress and now I was looking for a solution to change the ‘freshness’ that bbPress displays to the date of topic. I’m excited because I found your posting here and read that there is a plugin now which does that. How great!!

    I’ve installed it right now, but still I have a problem to activate it.
    It is the message:

    Plugin can not be activated because fatal error.
    Parse error: syntax error, unexpected T_FUNCTION in …..myTestWP/wp-content/plugins/bbp-last-post/includes/lp-widgets.php on line 224

    Do you have an idea, Robin, why it can not be activated at me?
    Link unfortunately I have not currently, I’m still on my test server.
    Would be glad to hear from you.
    Thank you!

    Morgensonne


    Robin W
    Moderator

    @robin-w

    @morgensonne

    Interesting – I’ve just deleted and re-downloaded the plugin from wordpress and it activated with no problems.

    However I would be interested if your test server is a ‘local’ one using wamp or mamp? that might be the issue.

    Please come back either way, and I’ll try and resolve for you.


    Robin W
    Moderator

    @robin-w

    or it may be the php version you are using – can you let me know what this is if you know?


    Morgensonne
    Participant

    @morgensonne

    Hi Robin,

    sorry that I answer so late! But I found your feedback, unfortunately only at the moment, because I got no mail notification. (though enabled and the last time it worked…..? ……)

    Anyway, here’s my answer to your question.
    First I had to ask the owner of the web server, because I did not know exactly:
    It runs on Unix and PHP 5.

    I hope this helps.
    Morgensonne


    Robin W
    Moderator

    @robin-w

    ok, php version use different code see

    http://codex.wordpress.org/Widgets_API

    The widget can then be registered using the widgets_init hook: 
    
    PHP 5.3+ only: 
    add_action( 'widgets_init', function(){
         register_widget( 'My_Widget' );
    });
    
    PHP 5.2+: 
    add_action('widgets_init',
         create_function('', 'return register_widget("My_Widget");')
    );
    
    

    I’m using code for 5.3 + – so if your site is using earlier, you would need to amend the line.


    Morgensonne
    Participant

    @morgensonne

    Thank you, Robin.

    OK, I would like to customize the line for PHP 5.2.
    Where should I add this line?
    Sorry, I have no knowledge of PHP code :-(


    Morgensonne
    Participant

    @morgensonne

    Good news! :-)

    I have just found out that the web server to which I move, if I have my bbPress finished, PHP5.3 has running. So it is unnecessary for me to make changes. I install your plugin when I’m away from the test server. That’s ok.

    Thanks for this plugin, Robin – und your great and kind support!!

    Morgensonne


    Robin W
    Moderator

    @robin-w

    great – if you need the 5.2 version, come back and I’ll cut a version for you and put it on my website.


    Morgensonne
    Participant

    @morgensonne

    I think that I can move in about 2 or 3 weeks. Until then, it is enough for me to know that I no longer have to worry about – because then I only need to install the plugin :-)
    I very much appreciate your offer. Thank you!!

    Morgensonne


    Robin W
    Moderator

    @robin-w

    great -come back if you need to !

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

You must be logged in to reply to this topic.