Skip to:
Content
Pages
Categories
Search
Top
Bottom

Use filter in bp-custom.php to change wording in activity stream – new topic

  • @jerrysc

    Participant

    Because I am trying to use a filter to change the wording within the file activity.php, within the bbpress directory, I think I’m in the correct forum.
    I am trying the change the wording for the activity stream in buddypress: “jerry started the topic Doctor Sleep in the forum Horror” to “jerry added the book Doctor Sleep in the category Horror.”
    I can go to bbpress/includes/extend/buddypress/activity.php and make the change there. But I prefer to do this via a filter in bp-custom.php. I am ALMOST there. Here is the filter code I have in bp-custom.php:

    add_filter( 'bbp_activity_topic_create', 'change_activity_wording', 1, 4 );
    function change_activity_wording($activity_text, $user_link, $topic_link, $forum_link ) {
    	$activity_text    = sprintf( esc_html__( '%1$s added the book %2$s in the category %3$s', 'bbpress' ), $user_link, $topic_link, $forum_link );
    	return $activity_text;
    }

    What this produces is: “added the book in the category” and removes “jerry”, “Doctor Sleep”, and “Horror.” Basically, my filter is removing $user_link, $topic_link, and $forum_link. I’m thinking I need to redefine them in my function change_activity_wording? Or am I off track here?
    If someone feels I should post this in the buddypress forum, let me know and I will do so.

  • You must be logged in to reply to this topic.
Skip to toolbar