DJ, This is a question in referance to post #1313 where a someone asked:
Quote:
I use the forms for an application process and it is submitted into an area that only certain people have access to. The applicants cannot read the area it is submitted to but I found out that they can subscribe to the thread and be sent the replies. How can I deny anyone from subscribing in that section?
|
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.