Skip to:

Re: Trying to alter layout of bp_activity_action()

Hey Everyone, thanks for the help, I tried the Filters but couldn’t quite get it working (yet)

I was able to get the method that 3sixty suggested using regular expressions, here is the code:

<?php $activityString = $activities_template->activities[$i]->action . ' endofstring'; /* Entire Activity into a String */

//echo $activityString . '<br/>';

/* Split up the Activity into it's different pieces and echo them out */
$authorName = $activities_template->activities[$i]->display_name;
$forumTopic = array();
$activityGroup = array();
$viewDelete = array();

/* If it is a forum topic, display forum topic name */
if (preg_match('/posted on the forum topic\s+([\s\S]*?)\s+in the group/', $activityString, $forumTopic)) {
echo $forumTopic[1] . '<br/>';
echo $authorName . ' said: <br/>';

/* Display Content Body */

/* Print out the View and Delete links - THIS STILL ISN't WORKING */
if (preg_match('/·\s+([\s\S]*?)\s+·/', $activityString, $viewDelete)) {
echo 'Group: ' . $viewDelete[1];

/* If activity is associated with a group/category, print that out */
if (preg_match('~in the group\s+([\s\S]*?</a>):~', $activityString, $activityGroup)) {
echo 'Group: ' . $activityGroup[1];


As you can see it’s split up based on text surrounding the different activity items like it selects text in between ‘posted on the forum topic’ and ‘in the group’ and assigns it to a string.

I think the filters approach might be a bit better though, i’ll look into doing that.

So how would I create a function like so?



I think if I had an example like that I would be able to understand how filters work better.

Also is there anywhere I can look to see all the filters I can use in stuff like this that Andy showed? add_filter( ‘bp_activity_time_since’, ‘remove_activity_meta’ );


Skip to toolbar