Warning: The author of this contribution does not provide support for it anymore.

Board watch

Frequently Asked Questions

How to automatically subscribe a group to boardwatch

Some people have asked how to change this mod so that any user who gets put in a particular group will automatically be subscribed to boardwatch and any user who gets removed from that group will automatically be unsubscribed from boardwatch. This is useful if you only want people in a certain group to have the boardwatch features. To do that, change the default settings so that users are by default not subscribed to boardwatch (as described in the file called changing_default_settings.html that appears in the contrib folder for this mod) and then do the following (but make sure that you first change 'xyz' in both places it appears below to the group_id of the group that you want to have boardwatch features):

Code: Select all

OPEN
includes/functions_user.php

FIND
      $db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary);

AFTER, ADD   
      // mod to boardwatch to assure that any user added to the indicated group gets subscribed to boardwatch
      if ($group_id == xyz)
      {
         $sql = 'UPDATE ' . USERS_TABLE . '
            SET user_boardwatchb = 0, user_boardwatchf = 0, user_boardwatcht = 0
            WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
         $db->sql_query($sql);      
      }

FIND
   $sql = 'DELETE FROM ' . USER_GROUP_TABLE . "
      WHERE group_id = $group_id
         AND " . $db->sql_in_set('user_id', $user_id_ary);
   $db->sql_query($sql);

AFTER, ADD
   // mod to boardwatch to assure that any user removed from the indicated group gets unsubscribed from boardwatch and watched topics or forums
   if ($group_id == xyz)
   {
      $sql = 'UPDATE ' . USERS_TABLE . '
         SET user_boardwatchb = 2, user_boardwatchf = 1, user_boardwatcht = 1
         WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
      $db->sql_query($sql);      

      $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . "
         WHERE " . $db->sql_in_set('user_id', $user_id_ary);
      $db->sql_query($sql);

      $sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . "
         WHERE " . $db->sql_in_set('user_id', $user_id_ary);
      $db->sql_query($sql);
   }