BuddyDev

Search

How can I add new tag to buddypress activity

  • Inactive
    Level: Enlightened
    Posts: 28
    Kikismedia on #33371

    Please is there a snippet that can add (new) to latest buddypress activity post if there is can you assist me with it

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #33373

    Hello Adeala,

    Thank you for posting. Please make me little more clear on it are you looking for tagging like “#tag” or is there any other thing I am not being able to get.

    Regards
    Ravi

  • Inactive
    Level: Enlightened
    Posts: 28
    Kikismedia on #33376

    Not #tag

    What I meant is that when a new activity post is published

    I want to display (new) beside the activity time area

    Like an indicator that tells members that this activity was just published

    • This reply was modified 3 years, 7 months ago by Kikismedia.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #33380

    Hello Adeala,

    Thank you for the acknowledgement. I will look into it and update you.

    Regards
    Ravi

  • Inactive
    Level: Enlightened
    Posts: 28
    Kikismedia on #33381

    Thanks Ravi I will be expecting your reply

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #33385

    Hello Adeala,

    Please try the following code. It will “(new)” to activity which posted within 5 minutes.

    
    
    add_filter( 'bp_activity_time_since', function ( $time_since, $activity ) {
        // Assuming last 5 minutes posted activity as new.
        $new_activity_time = strtotime( bp_core_current_time() ) - 5 * 60;
    
        if ( strtotime( $activity->date_recorded ) >= $new_activity_time ) {
            $time_since = __( '(new)' );
        }
    
        return $time_since;
    }, 10, 2 );
    
    

    Regards
    Ravi

  • Inactive
    Level: Enlightened
    Posts: 28
    Kikismedia on #33403

    Thanks Ravi it worked perfectly
    Can you help add CSS to the (new)

You must be logged in to reply to this topic.

This topic is: not resolved