Topic RSS
I am working with the sf_hook_post_save hook to integrate with the BP activity stream.
The bit I am stuck on is getting the new topic/post's title. There is a "topic sub" but that returns nothing and not sure what it actually is. I am using topic_slug currently but would like to use the actual title.
Any thoughts?
Visit the Twitter Poker Tour Forum to see my Simple-Press implementation
Yellow Swordfish said:
Should find it in $newpost['topicname']
That didn't seem to work. Are you sure it's part of the array for the sf_hook_post_save function? Here is the array printed for a post I just made:
Array ( [forumid] => 15 [forumslug] => live-and-online-major-events [topicid] => 218 [topicslug] => last-week-to-satellite-to-step3-2k-wsop-package [postid] => 1360 [submsg] => [postpin] => 0 [topiclock] => 0 [topicsub] => [topicwatch] => [topicsubend] => [topicwatchend] => [statvalue] => [posttimestamp] => '2010-06-01 21:13:46' [poststatus] => 0 [postcontent] => Annnnd....Late Reg has ended, we picked up two more players. We will easily get two players registered for STEP2 tonight! [guestname] => [guestemail] => [postername] => cprpoker [posteremail] => cprpoker@domain.com [userid] => 999 [ip] => xx.xx.xx.xx [db] => 1 [url] => http://domain.com/forum/blah-b.....lah/#p1360 )
Is there a function I can use to get the Topic Name by topicID?
Thanks!
Visit the Twitter Poker Tour Forum to see my Simple-Press implementation
sorry, on droid and havent read this topoic, but to answer your last question:
sf_get_topic_name_from_id($topicid)
will return the topic name based on id…
Mr Papa said:
sorry, on droid and havent read this topoic, but to answer your last question:
sf_get_topic_name_from_id($topicid)
will return the topic name based on id…
Bingo.
Thanks!!
Visit the Twitter Poker Tour Forum to see my Simple-Press implementation
Oh, absolutely, here it is. It's still very rough for now, so use at your own peril
. I'll try to keep this post updated with any major changes.
function sf_hook_post_save($newpost, $action)
{
global $bp;
$activity = new BP_Activity_Activity();
$date_recorded = date('Y-m-d H:i:s', strtotime('+4 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 = "sf_post";
$activity->action = ''.$user_fullname.'' . $the_action . '' . $topic_title . ':';
$activity->content = $mycontent;
$activity->primary_link = "";
$activity->secondary_item_id = "";
$activity->date_recorded = $date_recorded;
$activity->hide_sitewide = 0;
$activity->save ();
return;
}Visit the Twitter Poker Tour Forum to see my Simple-Press implementation
thanks! think this will be used by others! just wait for 5.0 when you can make this a plugin for simple:press!
Excellent feature!
Be a really good feature in integrating SPF with BP and WP3 … this option should be standard and availble in forum configuration backend ^^
Can anyone give apointer to where do i implement this code path/file.php?
Most Users Ever Online: 444
Currently Online: steve.engelking, irlandes1
49 Guest(s)
Currently Browsing this Page:
1 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



