Topic RSS
Sure! Here is the final code chunk:
function sf_hook_post_save($newpost, $action){global $bp;global $current_user;if ($newpost['forumid'] == 1 OR $newpost['forumid'] == 2 OR $newpost['forumid'] == 3 OR $newpost['forumid'] == 4 OR $newpost['forumid'] == 5 OR $newpost['forumid'] == 6 OR $newpost['forumid'] == 7 OR $newpost['forumid'] == 8 OR $newpost['forumid'] == 11){// Only allowed forum id's can post to the BP Activity$activity = new BP_Activity_Activity();$date_recorded = date('Y-m-d H:i:s', strtotime('+6 hours'));$user_fullname = bp_core_get_user_displayname($newpost['userid']);$username = bp_core_get_username($newpost['userid']);$topic_title = sf_get_topic_name_from_id($newpost['topicid']);//$topic_title = $newpost['topic_slug'];$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 "; }$activity = new BP_Activity_Activity ();$activity->user_id = $newpost['userid'];$activity->component = "simplepress";$activity->type = "new_forum_post";$activity->action = ''.$user_fullname.'' . $the_action . '' . $topic_title . ':';$activity->content = $mycontent;$activity->primary_link = $newpost['url'];$activity->secondary_item_id = '';$activity->date_recorded = $date_recorded;$activity->hide_sitewide = 0;$activity->save ();} else {// Do NOT post private forum post to feed}return;}
Mm, can't edit my post. I changed it up a little since I only have 3 forums that are protected. I also did a post on my blog about this for future reference for myself as well. Credit goes to you guys of course ;)
Guess it depends if you have more public or private forums. Do whatever you have less of and switch it around to your needs.
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$activity = new BP_Activity_Activity();$date_recorded = date('Y-m-d H:i:s', strtotime('+6 hours'));$user_fullname = bp_core_get_user_displayname($newpost['userid']);$username = bp_core_get_username($newpost['userid']);$topic_title = sf_get_topic_name_from_id($newpost['topicid']);//$topic_title = $newpost['topic_slug'];$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 "; }$activity = new BP_Activity_Activity ();$activity->user_id = $newpost['userid'];$activity->component = "simplepress";$activity->type = "new_forum_post";$activity->action = ''.$user_fullname.'' . $the_action . '' . $topic_title . ':';$activity->content = $mycontent;$activity->primary_link = $newpost['url'];$activity->secondary_item_id = '';$activity->date_recorded = $date_recorded;$activity->hide_sitewide = 0;$activity->save ();}return;}
[IMPORTANT UPDATE]
After a month of heavy use I notice sometimes it would break the activity filter. So I was forced to remove the content from the activity feed. Just comment out this line like so:
//$activity->content = $mycontent;
Thanks for the news. We will be looking long and hard at BuddyPress quite soon, especially for our planned Version 5.
How it would break the activity feed is a "special' character would show up in the BuddyPress Activity Feed. Like a diamond or strange A, � , etc. You could see it in the feed, but when you try to filter it, it would return blank due to it.
To make it work again I had to delete the item from the activity feed.
I want to install Simple Press on a WP multisite with Buddypress. My question is this – will I be able to integrate the forum into the activity stream if the forum is installed on a different site on the network than Buddypress?
Thank you for all your work on this, btw.
Most Users Ever Online: 444
Currently Online: SPQC, joelrob
56 Guest(s)
Currently Browsing this Page:
2 Guest(s)
Top Posters:
-Radio-: 1251
Lee H: 606
Luffer: 535
Conrad_Farlow: 502
jim: 478
neon: 263
ovizii: 240
Tal: 240
Member Stats:
Guest Posters: 2626
Members: 7363
Moderators: 1
Admins: 2
Forum Stats:
Groups: 5
Forums: 16
Topics: 10898
Posts: 79583
Newest Members: Rick Thomas, joelrob, ndc, MacBravO, irlandes1, triphop, betokan, Jonathan Yovani Muñoz, somosguatemala, ahcreate
Moderators: Brandon C (162)
Administrators: Yellow Swordfish (22240), Mr Papa (23688)
Log In
Register
Home
Add Reply
Add Topic
Offline



Quote

Visit

Privacy Policy



