The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Deleting Duplicate Threads That Do NOT Share The Same Timestamp
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: Code:
$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) : Code:
$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? |
#2
|
|||
|
|||
AND postuserid = $thread[postuserid]
but it's already limited by.. postusername = '" . $db->escape_string($thread['postusername']) . "' |
#3
|
||||
|
||||
Quote:
$thread['postusername'] So it would look like: $thread['test'] for example? |
#4
|
|||
|
|||
$thread['test'] would have no value because there's no column 'test' on the thread database. You could just replace the whole string by
postusername = 'test' but depending on where you run the script it would always delete threads from test even if it was someone else's fault.. Where do you plan on placing this? |
#5
|
||||
|
||||
Quote:
What do you mean by "would always delete threads from test even if it was someone else's fault." ? |
#6
|
|||
|
|||
Well I wasn't sure where you were pulling the code from.
It uses a variable as the username based on the thread that it's being performed on, so if you defined the name explicitly it would only work on threads based on the title of the thread you're using this on made by the user you've defined. Depending on how you do that it could be 0 threads. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|