The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
I often make a thread, move it w/ redirect for a week, & then move it back. I'd love to use the "Leave Expiring Redirect" option to automatically move the thread back
Just above hook cron_script_cleanup_hourly in /include/cron/cleanup.php there's this code that deletes the moved redirect at expiration Code:
// delete expired thread redirects $threads = $vbulletin->db->query_read(" SELECT threadid FROM " . TABLE_PREFIX . "threadredirect WHERE expires < " . TIMENOW . " "); while ($thread = $vbulletin->db->fetch_array($threads)) { $thread['open'] = 10; $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $threadman->set_existing($thread); $threadman->delete(false, true, NULL, false); unset($threadman); }
I just don't understand all the datamanager_init / set_existing stuff. I know what it's doing but I don't know how / why. i don't know how to set it or use it. My plan is to add a field to threadredirect called "return" & use it to store the old forumid & the real threadid. (threadid|forumid) then I'd modify the above code in cleanup.php (just inside the while) to look for "return". if it's there split it & update the original thread row with the returning forum id. Doing that via an UPDATE, SET= thing would be easy but I'd like to update the row using the datamanager_init deal so the forum post & thread counts are corrected. can someone tell me how that thing works? I known I need to change it to something like the following but need some feedback. is it ok to use varname $threadman because of the unset line? do I need to do more? Code:
$threads = $vbulletin->db->query_read(" SELECT threadid, return FROM " . TABLE_PREFIX . "threadredirect WHERE expires < " . TIMENOW . " "); while ($thread = $vbulletin->db->fetch_array($threads)) { if ($thread['return']) { list($returntid, $returnfid) = split('|', $thread['return']); $returnthread['threadid']=$returntid; $threadman=&datamanager_init('Thread', $vbulletin, ERRTYPE_ARRAY, 'threadpost'); $threadman->set_existing($returnthread); $threadman->set('forumid', $returnfid); $threadman->save(); unset($threadman); } $thread['open'] = 10; $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $threadman->set_existing($thread); $threadman->delete(false, true, NULL, false); unset($threadman); } forgive my ignorance. I love hacking the VB code but I'm still learning v3 & my brain is still stuck in v2. the new ways still confuse me a little thanks in advance |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|