![]() |
Threads vB_DataManager_ThreadRate delete issue In continue developing of hack the Threads Rating, i was confronted with the problem of class vB_DataManager_ThreadRate. I wrote this code: PHP Code: $threadrate =& datamanager_init('ThreadRate', $vbulletin, ERRTYPE_STANDARD); $threadrate->set_info('userid', intval($vbulletin->GPC['u'])); $threadrate->set_info('threadid', intval($vbulletin->GPC['t'])); $threadrate->delete(); unset($threadrate); And I was disappoint by the message Quote: Delete SQL condition not specified! Indeed, this class doesn't have delete functions. But if i will directly delete data from threadrate table, like PHP Code: $vbulletin->db->query_write(" DELETE FROM " . TABLE_PREFIX . "threadrate WHERE userid = " . intval($vbulletin->GPC['u']) . " AND threadid = " . intval($vbulletin->GPC['t'])); i just delete data from sql, but not from the datastore. Is it possible to see this function in next version of vebulletin?:rolleyes: And how can i manually delete the information from the datastore? ------------------------------ I think I found the solution. PHP Code: $vbulletin->db->query_write(" DELETE FROM " . TABLE_PREFIX . "threadrate WHERE userid = " . intval($vbulletin->GPC['u']) . " AND threadid = " . intval($vbulletin->GPC['t']) ); $ratings = $vbulletin->db->query_first(" SELECT COUNT(*) AS votenum, SUM(vote) AS votetotal FROM " . TABLE_PREFIX . "threadrate WHERE threadid = $threadid "); $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $threadman->set_existing($threadinfo); $threadman->set_info('rebuild', true); $threadman->set('votenum', $ratings['votenum'], true, false); $threadman->set('votetotal', intval($ratings['votetotal']), true, false); $threadman->save(); |
الساعة الآن 11:59 PM |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By
Almuhajir