
12-16-2008, 02:59 AM
|
 |
|
|
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by etzero
DJ, This is a question in referance to post #1313 where a someone asked:
Which I think I may have found a solution to. If you could please verify or deny this I would appreciate it.
The default code looks like this:
Code:
if ($vbulletin->userinfo['autosubscribe'] != -1)
{
$newpost['emailupdate'] = $vbulletin->userinfo['autosubscribe'];
}
else
{
$newpost['emailupdate'] = 9999;
}
My thought is that it if changed to this it should always delete the users subscrition regardless if he was set up though the user CP.
Code:
$newpost['emailupdate'] = 9999;
By looking at functions_newpost.php, '9999' apears to be the correct value to delete any subscritions for that thread?
Code:
// ### DO THREAD SUBSCRIPTION ###
if ($vbulletin->userinfo['userid'] != 0)
{
require_once(DIR . '/includes/functions_misc.php');
$post['emailupdate'] = verify_subscription_choice($post['emailupdate'], $vbulletin->userinfo, 9999);
($hook = vBulletinHook::fetch_hook('newpost_subscribe')) ? eval($hook) : false;
if (!$threadinfo['issubscribed'] AND $post['emailupdate'] != 9999)
{ // user is not subscribed to this thread so insert it
/*insert query*/
$vbulletin->db->query_write("INSERT IGNORE INTO " . TABLE_PREFIX . "subscribethread (userid, threadid, emailupdate, folderid, canview)
VALUES (" . $vbulletin->userinfo['userid'] . ", $threadinfo[threadid], $post[emailupdate], $post[folderid], 1)");
}
else
{ // User is subscribed, see if they changed the settings for this thread
if ($post['emailupdate'] == 9999)
{ // Remove this subscription, user chose 'No Subscription'
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "subscribethread WHERE threadid = $threadinfo[threadid] AND userid = " . $vbulletin->userinfo['userid']);
}
else if ($threadinfo['emailupdate'] != $post['emailupdate'] OR $threadinfo['folderid'] != $post['folderid'])
{
// User changed the settings so update the current record
/*insert query*/
$vbulletin->db->query_write("REPLACE INTO " . TABLE_PREFIX . "subscribethread (userid, threadid, emailupdate, folderid, canview)
VALUES (" . $vbulletin->userinfo['userid'] . ", $threadinfo[threadid], $post[emailupdate], $post[folderid], 1)");
}
}
}
It seems counter intuitive as I would have guessed a value of ?0? would remove subscriptions.
|
That's probably just a little beyond my current level of understanding right now. But my gut is telling me that your on the right track. Is this not going to try to remove the subscription before the user is actually subscribed?
|