Here is my implementation:
1. insert a column named uid_r into xoops_bb_posts to backup the poster's uid
ALTER TABLE `xoops_bb_posts` ADD `uid_r` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `uid` ;
2. modify xoops/modules/newbb/post.php -> record id in uid_r whenever the anonymous option checked
--- post.php.orig 2006-08-15 20:13:58.000000000 +0800
+++ post.php 2006-08-15 20:15:59.000000000 +0800
@@ -173,9 +173,11 @@
$isnew = 1;
if ( is_object($xoopsUser) && empty($_POST['noname']) ) {
$uid = $xoopsUser->getVar("uid");
+ $uid_r = 0;
}
else {
$uid = 0;
+ $uid_r = $xoopsUser->getVar("uid");
}
if (isset($pid) && $pid != "") {
$forumpost->setVar('pid', $pid);
@@ -187,6 +189,7 @@
//$post_ip = (isset($_SERVER['HTTP_X_FORWARDED_FOR']))?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR'];
$forumpost->setVar('poster_ip', newbb_getIP());
$forumpost->setVar('uid', $uid);
+ $forumpost->setVar('uid_r', $uid_r);
}
if($topic_handler->getPermission($forum, $topic_status, 'noapprove')) $approved = 1;
@@ -453,4 +456,4 @@
include XOOPS_ROOT_PATH.'/footer.php';
-?>
No newline at end of file
+?>
3. modify xoops/modules/newbb/class/post.php -> write uid_r into database
--- post.php.orig 2006-08-15 20:14:08.000000000 +0800
+++ post.php 2006-08-15 20:18:14.000000000 +0800
@@ -44,6 +44,7 @@
$this->initVar('dosmiley', XOBJ_DTYPE_INT, 1);
$this->initVar('doxcode', XOBJ_DTYPE_INT, 1);
$this->initVar('uid', XOBJ_DTYPE_INT, 1);
+ $this->initVar('uid_r', XOBJ_DTYPE_INT, 1);
$this->initVar('icon', XOBJ_DTYPE_TXTBOX);
$this->initVar('attachsig', XOBJ_DTYPE_INT);
$this->initVar('approved', XOBJ_DTYPE_INT, 1);
@@ -633,9 +634,9 @@
$post_id = $this->db->genId($this->db->prefix("bb_posts") . "_post_id_seq");
$sql = "INSERT INTO " . $this->db->prefix("bb_posts") . "
- ( post_id, pid, topic_id, forum_id, post_time, uid, poster_ip, poster_name, subject, dohtml, dosmiley, doxcode, doimage, dobr, icon, attachsig, attachment, approved, post_karma, require_reply)
VALUES
- ($post_id, $pid, $topic_id, $forum_id, $post_time, $uid, $poster_ip, $poster_name, $subject, $dohtml, $dosmiley, $doxcode, $doimage, $dobr, $icon, $attachsig, $attachment, $approved, $post_karma, $require_reply)";
+ ($post_id, $pid, $topic_id, $forum_id, $post_time, $uid, $uid_r, $poster_ip, $poster_name, $subject, $dohtml, $dosmiley, $doxcode, $doimage, $dobr, $icon, $attachsig, $attachment, $approved, $post_karma, $require_reply)";
if (!$result = $this->db->queryF($sql)) {
newbb_message("Insert post error:" . $sql);
@@ -897,4 +898,4 @@
}
}
-?>
No newline at end of file
+?>
so that only admin with right reading database would know who the original poster is