This will post new topics/replies from your Simple:Press Forum into the BuddyPress Activity stream and you can even filter it under “Show Forum Replies”. The view button will take you right to the permalink as well!

So let’s get started shall we. First off go to this file:

wp-content/plugins/simple-forum/forum/hooks/sf-hook-template.txt

Then rename that file or made a copy and name it sf-hook-template.php

Search for this:

	  function sf_hook_post_save($newpost, $action)
	 {
		return true;
	 }

This is what you will replace it with only if you have NO private forums.

	  function sf_hook_post_save($newpost, $action)
	  {
	    global $bp;
	    global $current_user;
 
	    // Post SPF Post to BP Activity Stream
	    $user_fullname  = bp_core_get_user_displayname($newpost['userid']);
	    $topic_title = sf_get_topic_name_from_id($newpost['topicid']);
	    $mycontent = $newpost['postcontent'];
 
	    $max_length = 300;
	      if(strlen($mycontent) > $max_length)
	      {
		$mycontent = substr($mycontent,0,$max_length);
		$mycontent = $mycontent . "[...]";
	      }
 
	    if ($action=="topic") { $the_action = " created the topic "; } else { $the_action = " posted in the topic "; }
 
	    // Dont Post to wall if it's a guest
	    if ($newpost['userid'] == $newpost['']) {
	    return;
	    } else {
 
		    if ($the_action == " created the topic ") {
 
			bp_activity_add(array(
			'action' => ''.$user_fullname.'' . $the_action . '' . $topic_title . ':',
			'content' => $mycontent,
			'component' => 'simplepress',
			'type' => 'new_forum_topic',
			'primary_link' => $newpost['url'],
			'user_id' => $newpost['userid']
			));
 
		    } else {
 
			bp_activity_add(array(
			'action' => ''.$user_fullname.'' . $the_action . '' . $topic_title . ':',
			'content' => $mycontent,
			'component' => 'simplepress',
			'type' => 'new_forum_post',
			'primary_link' => $newpost['url'],
			'user_id' => $newpost['userid']
			));	    	    
 
		    }
	    }
	    //END Guest Check   
 
	    return;
	  }

But if you have forums that only certain members have access to you’ll need to do this.

NOTE: You will need to put in the forums id’s that you want to BLOCK from showing in the BuddyPress Activity Stream.

Enter as many as you need. Just create another OR $newpost['forumid'] == 12 and enter in the correct forum id.

	  function sf_hook_post_save($newpost, $action)
	  {
	    global $bp;
	    global $current_user;
 
	    if ($newpost['forumid'] == 9 OR $newpost['forumid'] == 10 OR $newpost['forumid'] == 12)
            {
            // Put in the forum id's you do NOT want to show up in the  BP activity stream
 
	    } else {
	    // Post SPF Post to BP Activity Stream
	    $user_fullname  = bp_core_get_user_displayname($newpost['userid']);
	    $topic_title = sf_get_topic_name_from_id($newpost['topicid']);
	    $mycontent = $newpost['postcontent'];
 
	    $max_length = 300;
	      if(strlen($mycontent) > $max_length)
	      {
		$mycontent = substr($mycontent,0,$max_length);
		$mycontent = $mycontent . "[...]";
	      }
 
	    if ($action=="topic") { $the_action = " created the topic "; } else { $the_action = " posted in the topic "; }
 
	    // Dont Post to wall if it's a guest
	    if ($newpost['userid'] == $newpost['']) {
	    return;
	    } else {
 
		    if ($the_action == " created the topic ") {
 
			bp_activity_add(array(
			'action' => ''.$user_fullname.'' . $the_action . '' . $topic_title . ':',
			'content' => $mycontent,
			'component' => 'simplepress',
			'type' => 'new_forum_topic',
			'primary_link' => $newpost['url'],
			'user_id' => $newpost['userid']
			));
 
		    } else {
 
			bp_activity_add(array(
			'action' => ''.$user_fullname.'' . $the_action . '' . $topic_title . ':',
			'content' => $mycontent,
			'component' => 'simplepress',
			'type' => 'new_forum_post',
			'primary_link' => $newpost['url'],
			'user_id' => $newpost['userid']
			));	    	    
 
		    }
	    }
	    //END Guest Check
	    }	    
 
	    return;
	  }

Save and your done! Not to bad eh?

Credit goes to cprpoker, Mr Papa & Yellow Swordfish over at Simple:Press Forums for getting a great start on this and helping me finish it.