14
Here was my solution:
$story = new NewsStory();
$story->setTitle($subject);
//EDIT START
$story->setBodytext($message);
$tc_hack = $message;
$tc_hack = preg_replace('#[(.*?)]#s', '', $tc_hack);
if(strlen($tc_hack) < 60){
$story->setHometext($tc_hack);
}else{
$story->setHometext(substr($tc_hack,0,30).'...');
}
//EDIT END
$story->setUid($uid);
$story->setTopicId($topic_id);
$story->setHostname(xoops_getenv('REMOTE_ADDR'));
$story->setNohtml($nohtml_db);
$nosmiley = isset($nosmiley) ? intval($nosmiley) : 0;
$notifypub = isset($notifypub) ? intval($notifypub) : 0;
$story->setNosmiley($nosmiley);
$story->setNotifyPub($notifypub);
$story->setType('user');
if ( $xoopsModuleConfig['autoapprove'] == 1 ) {
$approve = 1;
$story->setApproved($approve);
$story->setPublished(time());
$story->setExpired(0);
$story->setTopicalign('R');
}
$result = $story->store();