The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Comments |
#22
|
|||
|
|||
Duplicating the above won't work. You can look at the usertools.php file in the admincp to see how vbulletin deletes sent pms or all pms, which may help you get started.
It looks like a similar query will work, but all three are linked together. Code:
pm pmid, pmtextid, userid, folderid, messageread, importpmid pmtext pmtextid, fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature, allowsmilie, importpmid pmreceipt pmid, userid, touserid, tousername, title, sendtime, readtime, denied Your query would need get the $pmtextid based on the fromuserid and dateline in pmtext, and get the $pmid based on the pmtextid in pm, then delete these three rows delete from pmtext where pmtextid = $pmtextid delete from pm where pmid = $pmid delete from pmreceipt where pmid = $pmid |
#23
|
|||
|
|||
Got some help on another forum which got me this far:
Code:
<?php require ("global.php"); $time = time() - (60 * 24 * 60 * 60); // $a = $DB_site->query("DELETE FROM privatemessage WHERE dateline < $time"); // $a = $DB_site->query_first("SELECT COUNT(*) AS oldpms FROM privatemessage WHERE dateline < $time"); // print "Total PMs To Be Deleted: $a[oldpms]"; // $a = $DB_site->query("DELETE FROM vbpm WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)); // $a = $DB_site->query("DELETE FROM vbpmtext WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)); $a = $DB_site->query("SELECT COUNT(*) AS oldpms FROM vbpm WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)"); print "Total PMs To Be Deleted:"; print $a[oldpms]; $a = $DB_site->query("SELECT COUNT(*) AS oldpms FROM vbpmtext WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)"); print "Total PMtexts To Be Deleted:"; print $a[oldpms]; ?> However, this doesn't work. I get Quote:
Code:
$a = $DB_site->query("SELECT COUNT(*) AS oldpms FROM vbpm WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)"); |
#24
|
|||
|
|||
I believe the error is caused by the
Code:
$DB_site->query Try this: Code:
$a = $db->query_read("SELECT COUNT(*) AS oldpms FROM vbpm WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)"); |
#25
|
|||
|
|||
Better.
Code:
<?php require ("global.php"); $time = time() - (60 * 24 * 60 * 60); // $a = $DB_site->query("DELETE FROM privatemessage WHERE dateline < $time"); // $a = $DB_site->query_first("SELECT COUNT(*) AS oldpms FROM privatemessage WHERE dateline < $time"); // print "Total PMs To Be Deleted: $a[oldpms]"; // $a = $DB_site->query("DELETE FROM vbpm WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)); // $a = $DB_site->query("DELETE FROM vbpmtext WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)); $a = $db->query("SELECT COUNT(*) AS oldpms FROM vbpm WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)"); print "Total PMs To Be Deleted:"; print $a; $a = $db->query("SELECT COUNT(*) AS oldpms FROM vbpmtext WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time)"); print "Total PMtexts To Be Deleted:"; print $a; ?> Quote:
|
#26
|
|||
|
|||
That is odd. I tried running the first query manually setting a time so it was 1 pm that is in my inbox and outbox. The count on the internal query was 1 and the full select was 2. That is correct. I tried running that query in a .php file and $a was blank. I'm not sure what is missing, or why you would be getting Resource id #16.
I wonder if php versions make a difference here? |
#27
|
|||
|
|||
No idea.
This is what's running on my server: Server Type Linux Web Server Apache v1.3.37 PHP 4.4.4 MySQL Version 4.1.21-standard |
#28
|
|||
|
|||
How did you run the first query exactly? I get an SQL error...
|
#29
|
|||
|
|||
I put in a value for $time to get it to run with no errors. I got that value by adding a line to print $time.
Code:
SELECT pmtextid FROM vbpmtext WHERE dateline < 1170202068 Code:
print $a[oldpms]; Code:
print $a; |
#30
|
|||
|
|||
Here's the exact code I'm running right now. I changed the days to 25.
Quote:
|
#31
|
|||
|
|||
if I use
Code:
print $a[oldpms]; If I use Code:
print $a; Addendum: OK - I just saw your post above. So we get the same thing. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|