Skip to:
Content
Pages
Categories
Search
Top
Bottom

Filter of Function / Theme or Plugin


  • Matthew Holt
    Participant

    @webdevmatt

    I am new to BuddyPress WordPress development and believe there is a solution to the workaround I have created and am looking for insight.

    I have altered the format of the activity output through the core bp plugin in bp-activity/bp-activity-template.php at the function bp_activity_action(). All that was done is a reformatting of the activity from a straight line output to a stacked output for group and document posts.

    It seems that this should be a filter application but am not sure if I must create a plugin in order to add a new filter or if I can add and apply the filter in my theme somewhere.

    Thanks in advance.

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

  • Boone Gorges
    Keymaster

    @boonebgorges

    I’m not sure what you mean by reformatting “to a stacked output”, but you can definitely modify the output of bp_activity_action() without modifying the core BP files. In your theme’s functions.php, try a function like the following:

    `function holt_modify_action( $action, $activity ) {
    // $action is the unmodified action text produced by BP.
    // $activity is a structured object with information about the activity
    // Use those two values to concatenate whatever value you’d like, and then return it like this:
    return $my_action;
    }
    add_filter( ‘bp_get_activity_action’, ‘holt_modify_action’, 10, 2 );`


    Matthew Holt
    Participant

    @webdevmatt

    This was exactly what I was looking for @boonebgorges. That approach is perfect. As for a “stacked output,” we stacked the output activity as opposed to keeping it inline eg.
    default =
    [user] posted and update in the group [group name]
    stacked=
    User: [user]
    Group: [group name]

    Thank you again.


    Boone Gorges
    Keymaster

    @boonebgorges

    Cool. Glad it works!


    chouxpastry2002
    Participant

    @chouxpastry2002

    hello sir,

    Can you please guide me how to use this function to filter ‘user joined’ and ‘user created’ a group from groups activity.

    Awaiting your response.

    Sam.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Filter of Function / Theme or Plugin’ is closed to new replies.
Skip to toolbar