Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change `bp_topic_last_active_time` format

  • @mvaneijgen

    Participant

    In loop-single-topic.php the following function is requested <?php bbp_topic_last_active_time();?> and this will display 2 weeks, 1 day ago I would like to only state the first part so 2 weeks ago and lose the specificity of it being a 1 day

    There are different kinds of specificity depending on when the topics was last active like:
    1 day, 23 hours ago
    2 weeks, 1 day ago
    1 month, 2 weeks ago

    and I would like to convert them all to
    1 day ago
    2 weeks ago
    1 month ago

    Any tips on this would be highly appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @casiepa

    Moderator

    2 tips:
    – Install my bbP Toolkit
    – Use the code below:

    // Change freshness time by removing the last part, so '1 month, 3 days ago' becomes '1 month ago'
    function casiepa_shorten_freshness_time($return) {
    	$return = preg_replace( '/, .*[^ago]/', ' ', $return );
    	return $return;
    }
    add_filter( 'bbp_get_time_since', 'casiepa_shorten_freshness_time' );
    add_filter( 'bp_core_time_since', 'casiepa_shorten_freshness_time');

    PS. Ben je niet op https://wpnl.slack.com ?

    @mvaneijgen

    Participant

    Hey @casiepa thanks, it works.

    PS. Nee en ziet er uit of je er alleen in kan met een invite?

    @casiepa

    Moderator

    Great to hear.

    For slack:
    – Login with your wordpress.org account on this link: https://wordpress.org/support/bb-login.php?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fchat%2F
    – Scroll on that page to “Joining the WordPress team on Slack” and enter your email address
    – Check your email and you will have a “user@chat.wordpress.org” account
    – Use that created account on https://wpnl.slack.com/signup to signup

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