Sorry, I figured you'd be able to piece it together and all you wanted was the general idea from it.
I've stripped the majority of it out as it relates to version checking, random testimonial fetching and some other things you won't need.
You'll need to change the mysql_connect and mysql_select_db lines to match your database configuration
Here is the contents of local.php:
<?php
if(!defined("NO_MYSQL") && $_SERVER['MYBB_MYSQL_HOST'])
{
mysql_connect($_SERVER['MYBB_MYSQL_HOST'], $_SERVER['MYBB_MYSQL_USER'], $_SERVER['MYBB_MYSQL_PASS']);
mysql_select_db($_SERVER['MYBB_MYSQL_DB']);
}
//
// /me pat pat photomatt.com
//
function autop($pee, $br = 1)
{
$pee = $pee . "\n"; // just to make things a little easier, pad the end
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
$pee = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $pee); // Space things out a little
$pee = preg_replace('!(</(?:table|ul|ol|li|pre|form|blockquote|h[1-6])>)!', "$1\n", $pee); // Space things out a little
$pee = preg_replace("/(\r\n|\r)/", "\n", $pee); // cross-platform newlines
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $pee); // make paragraphs, including one at the end
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
$pee = preg_replace('!<p>\s*(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "$1", $pee);
$pee = preg_replace('!(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
$pee = preg_replace('!(</?(?:table|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|th|pre|td|ul|ol)>)!', '$1', $pee);
$pee = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $pee);
return $pee;
}
?>
As for the user CP plugin, I'm not sure I want to release it until I've at least cleaned it up a bit. Here is the query used to insert a new post, however:
$now = time();
$dategmt = gmdate("Y-m-d H:i:s", $now);
$newsitem = array(
"nid" => "NULL",
"title" => addslashes($mybb->input['title']),
"poster_uid" => $mybb->user['uid'],
"poster_username" => addslashes($mybb->user['username']),
"message" => addslashes($mybb->input['message']),
"dateline" => $now,
"dateline_date" => $dategmt,
"more_link" => addslashes($mybb->input['more_link'])
);
$site_db->insert_query("news", $newsitem);