Oh jesus of course! I think I even read this somewhere
Ok so this seems to be working!
Here is the function so far:
I looked at lines 813-830 of ./inc/datahandlers/post.php which is this:
So what I'm gonna try to figure out now is how to create an admin front-end to let the admin choose in the admin CP, which forum should be anonymous and which user is the anonymous user.
Is there any documentation on making modules for the Admin CP or something of the sort?
Ok so this seems to be working!
Here is the function so far:
function anon_posting(&$insert_data)
{
global $mybb, $realuser;
if($insert_data->post_insert_data['fid'] == 3)
{
// First of all let's look up the real user name
$realuser = $mybb->user['uid'];
$insert_data->post_insert_data['uid'] = "2";
$insert_data->post_insert_data['username'] = "Anonymous";
$insert_data->post_insert_data['origuserid'] = $realuser;
}
return $insert_data;
}
I have added a column to the mybb_posts table called "origuserid" to store the original userid of the person posting in the anonymous forum. That way (in cases of abuse) the admin can retrieve the original username from the post.I looked at lines 813-830 of ./inc/datahandlers/post.php which is this:
// Insert the post.
$this->post_insert_data = array(
"tid" => intval($post['tid']),
"replyto" => intval($post['replyto']),
"fid" => intval($post['fid']),
"subject" => $db->escape_string($post['subject']),
"icon" => intval($post['icon']),
"uid" => $post['uid'],
"username" => $db->escape_string($post['username']),
"dateline" => $post['dateline'],
"message" => $db->escape_string($post['message']),
"ipaddress" => $db->escape_string($post['ipaddress']),
"longipaddress" => intval(ip2long($post['ipaddress'])),
"includesig" => $post['options']['signature'],
"smilieoff" => $post['options']['disablesmilies'],
"visible" => $visible,
"posthash" => $db->escape_string($post['posthash'])
);
So I figured in my function I just add a value to the array, like this:$insert_data->post_insert_data['origuserid'] = $realuser;
And that actually seems to work. So what I'm gonna try to figure out now is how to create an admin front-end to let the admin choose in the admin CP, which forum should be anonymous and which user is the anonymous user.
Is there any documentation on making modules for the Admin CP or something of the sort?