TruthElixirX
01-13-2009, 03:22 PM
I need to delete some duplicate threads, but they do not have the same time stamp.
I opened up admincp/misc.php and went to:
$threads = $db->query_read("
SELECT threadid, title, forumid, postusername, dateline
FROM " . TABLE_PREFIX . "thread WHERE threadid >= " . $vbulletin->GPC['startat'] . "
ORDER BY threadid
LIMIT " . $vbulletin->GPC['perpage']
);
$finishat = $vbulletin->GPC['startat'];
while ($thread = $db->fetch_array($threads))
{
$deletethreads = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "thread
WHERE title = '" . $db->escape_string($thread['title']) . "' AND
forumid = $thread[forumid] AND
postusername = '" . $db->escape_string($thread['postusername']) . "' AND
dateline = $thread[dateline] AND
threadid > $thread[threadid]
");
and changed it to (I removed what was colored blue above) :
$threads = $db->query_read("
SELECT threadid, title, forumid, postusername
FROM " . TABLE_PREFIX . "thread WHERE threadid >= " . $vbulletin->GPC['startat'] . "
ORDER BY threadid
LIMIT " . $vbulletin->GPC['perpage']
);
$finishat = $vbulletin->GPC['startat'];
while ($thread = $db->fetch_array($threads))
{
$deletethreads = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "thread
WHERE title = '" . $db->escape_string($thread['title']) . "' AND
forumid = $thread[forumid] AND
postusername = '" . $db->escape_string($thread['postusername']) . "' AND
threadid > $thread[threadid]
");
This gets rid of the time stamp requirement, but now, I need to limit it to a specific username/id. How do I do this?
I opened up admincp/misc.php and went to:
$threads = $db->query_read("
SELECT threadid, title, forumid, postusername, dateline
FROM " . TABLE_PREFIX . "thread WHERE threadid >= " . $vbulletin->GPC['startat'] . "
ORDER BY threadid
LIMIT " . $vbulletin->GPC['perpage']
);
$finishat = $vbulletin->GPC['startat'];
while ($thread = $db->fetch_array($threads))
{
$deletethreads = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "thread
WHERE title = '" . $db->escape_string($thread['title']) . "' AND
forumid = $thread[forumid] AND
postusername = '" . $db->escape_string($thread['postusername']) . "' AND
dateline = $thread[dateline] AND
threadid > $thread[threadid]
");
and changed it to (I removed what was colored blue above) :
$threads = $db->query_read("
SELECT threadid, title, forumid, postusername
FROM " . TABLE_PREFIX . "thread WHERE threadid >= " . $vbulletin->GPC['startat'] . "
ORDER BY threadid
LIMIT " . $vbulletin->GPC['perpage']
);
$finishat = $vbulletin->GPC['startat'];
while ($thread = $db->fetch_array($threads))
{
$deletethreads = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "thread
WHERE title = '" . $db->escape_string($thread['title']) . "' AND
forumid = $thread[forumid] AND
postusername = '" . $db->escape_string($thread['postusername']) . "' AND
threadid > $thread[threadid]
");
This gets rid of the time stamp requirement, but now, I need to limit it to a specific username/id. How do I do this?