複製主題後同時生成一個相同的主題
不但生成一個相同的主題貼,連同裡面的所有回貼也一併複製(不包含附件)
同時複製回覆&發佈時間結果演示
templates.lang.php
找'admin_copy' => '複製主題',[/php]底下加上[php]'admin_copy_reply' => '一併複製此主題下的回覆內容',
'admin_copy_dateline' => '複製發佈時間',[/php]開啟 topicadmin.php
找
[php]$thread['dateline'] = $thread['lastpost'] = $timestamp;
$thread['lastposter'] = $thread['author'];
$thread['views'] = $thread['replies'] = 0;[/php]
改成
[php]if (!$copy_dateline) {
$thread['dateline'] = $thread['lastpost'] = $timestamp;
}
if (!$copy_reply) {
$thread['lastposter'] = $thread['author'];
$thread['views'] = $thread['replies'] = 0;
}[/php]
找
[php]$query = $db->query("SELECT * FROM {$tablepre}posts WHERE tid='$tid' AND first=1 LIMIT 1");[/php]
上面加上
[php]if (!$copy_reply) {[/php]
找
[php]$post['dateline'] = $timestamp;[/php]
改成
[php]$post['dateline'] = $thread['dateline'];[/php]
找
[php]$db->query("INSERT INTO {$tablepre}posts VALUES ('".implode("', '", daddslashes($post, 1))."')");
}[/php]
底下加上
[php]} else {
$query = $db->query("SELECT * FROM {$tablepre}posts WHERE tid='$tid' ORDER BY first DESC, dateline ASC");
$i = 0;
while($post = $db->fetch_array($query)) {
$post['pid'] = '';
$post['tid'] = $threadid;
$post['fid'] = $copyto;
if ($post['first']) {
$post['dateline'] = $thread['dateline'];
} elseif (!$copy_dateline) {
$post['dateline'] = $timestamp + $i * 10;
}
$post['attachment'] = 0;
$post['invisible'] = $post['rate'] = $post['ratetimes'] = 0;
$db->query("INSERT INTO {$tablepre}posts VALUES ('".implode("', '", daddslashes($post, 1))."')");
$i++;
$thread['lastpost'] = $post['dateline'];
}
$db->query("UPDATE {$tablepre}threads SET lastpost = '$thread[lastpost]' WHERE tid='$threadid'", 'UNBUFFERED');
}[/php]
找
[php]updatepostcredits('+', $post['authorid'], '');[/php]
改成
[php]updatepostcredits('+', $thread['authorid'], '');[/php]
找
[php]updateforumcount($copyto);
updateforumcount($fid);[/php]
改為
[php]updateforumcount($copyto);
if ($copyto != $fid) {
updateforumcount($fid);
}開啟 topicadmin_copy.htm
找{template topicadmin_reason}[/xml]
上面加上
[xml]<tr>
<th> </th>
<td>
<label><input type="checkbox" name="copy_reply" value="1" /> {lang admin_copy_reply}</label>
<label><input type="checkbox" name="copy_dateline" value="1" /> {lang admin_copy_dateline}</label>
</td>
</tr> |