Advertisement:

Author Topic: Unsubscribe from all topic notifications  (Read 16395 times)

Offline kegobeer

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,994
  • Gender: Male
  • I am ninja!
    • The Kazebeer Family Website
Unsubscribe from all topic notifications
« on: January 20, 2005, 07:11:38 PM »
I found myself having to delete 36 pages of topic notifications and desperately needing an Unsubscribe All button.  I know, I know, I should have paid attention and unsubscribed from topics periodically.  What can I say, I'm pretty forgetful.

So, here's the mod.  This is for 1.01.

===Profile.php===
After
Code: [Select]
// We are editing topic notifications......
elseif (isset($_POST['edit_notify_topics']) && !empty($_POST['notify_topics']))
{
foreach ($_POST['notify_topics'] as $index => $id)
$_POST['notify_topics'][$index] = (int) $id;

// Make sure there are no zeros left.
$_POST['notify_topics'] = array_diff($_POST['notify_topics'], array(0));

db_query("
DELETE FROM {$db_prefix}log_notify
WHERE ID_TOPIC IN (" . implode(', ', $_POST['notify_topics']) . ")
AND ID_MEMBER = $memID", __FILE__, __LINE__);
}
Add
Code: [Select]
elseif (isset($_POST['edit_notify_topics_all']))
{
  db_query("
   DELETE FROM {$db_prefix}log_notify
   WHERE ID_MEMBER = $memID", __FILE__, __LINE__);
}

===Profile.english.php=== (or your specific language)
After
Code: [Select]
$txt['notifications_update'] = 'Unsubscribe';Add
Code: [Select]
$txt['notifications_update_all'] = 'Unsubscribe All';
===Profile.template.php=== (default and whatever theme you are using)
Change
Code: [Select]
      <td colspan="3" class="windowbg2" align="right">
       <input type="submit" name="edit_notify_topics" value="', $txt['notifications_update'], '" />
      </td>
to
Code: [Select]
      <td colspan="3" class="windowbg2" align="right">
       <input type="submit" name="edit_notify_topics_all" value="', $txt['notifications_update_all'], '" /><input type="submit" name="edit_notify_topics" value="', $txt['notifications_update'], '" />
      </td>

Now your laziest members can delete all their topic notifications.  ;D
« Last Edit: January 20, 2005, 07:13:24 PM by kegobeer »
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: Unsubscribe from all topic notifications
« Reply #1 on: September 02, 2005, 02:40:24 PM »
i compiled this as a mod and gave credits to kegobeer, i hope he doesnt drive angry with me :)
its available for English and Turkish languages.
here it is;

http://www.elmacik.com/ ******** (edit: I removed the link because this is already a mod)
ATTENTION: one file probably will give TEST FAILED result, just ignore it as its turkish language file ;)
(this means if you dont have turkish language installed, it will say "failed" you can still install succesfully)
tested with SMF 1.1 Beta 3 Public and worked very well ;)
« Last Edit: July 28, 2006, 07:26:40 AM by Elmacik »
Home of Elmacik