Name: Ignore Forums In Activity

Version: 1.2

Last modified: 05/07/2009 @ 15:00 (GMT)

Description:
This modification will provide an option to enter the forum id's (fid's) of forums you do not want to see in today's posts or topic activity.
This option can be entered on your member registration form.
The option is editable in your member control panel and admin edit profile tool.

Compatibility: XMB v1.9.8 SP3

Tested On: XMB 1.9.8 SP3

Code Developed By: Adam Clarke (http://www.scriptdesign.co.uk & http://www.adam-clarke.co.uk)

MOD History: V1.0 (05/08/2005 @ 15:00) - Initial Release.
             V1.1 (05/08/2005 @ 17:20) - Fixed code for English.lang.php and made a few minor adjustments.
             V1.2 (05/08/2005 @ 17:55) - Fixed code for today.php and activity.php.
             V1.2(05/07/2006  @ 08:10) - Updated for 1.9.5
             V1.2(05/07/2009  @ 15:00) - Updated for 1.9.8

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Note: Backup all affected files, templates & database.

Affected Files (6): member.php, memcp.php, editprofile.php, today.php, activity.php, lang/English.lang.php

Affected Templates (3): member_reg, memcp_profile, admintool_editprofile



====================================================================================================
STEP 1: Goto Administration Panel -->  Insert Raw SQL.

Upload SQL.txt and click Submit Changes.
====================================================================================================


====================================================================================================
STEP 2: Edit File 'member.php'

Find Code:
----------------------------------------------------------------------------------------------------

                $sig = postedVar('sig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

----------------------------------------------------------------------------------------------------

Add Code Below:
----------------------------------------------------------------------------------------------------

                // Ignore Forums In Activity Mod Begin
                $ignoreforums = postedVar('ignoreforums', 'javascript', TRUE, TRUE, TRUE);
                // Ignore Forums In Activity Mod End

----------------------------------------------------------------------------------------------------


Find Code (2 Times):
----------------------------------------------------------------------------------------------------

) VALUES ('$username'

----------------------------------------------------------------------------------------------------

Replace Code With (2 Times):
----------------------------------------------------------------------------------------------------

, ignoreforums) VALUES ('$username'

----------------------------------------------------------------------------------------------------


Find Code (On Same Line):
----------------------------------------------------------------------------------------------------

)");

----------------------------------------------------------------------------------------------------

Replace Code With:
----------------------------------------------------------------------------------------------------

, '$ignoreforums')");

----------------------------------------------------------------------------------------------------
====================================================================================================


====================================================================================================
STEP 3: Edit File 'memcp.php'

Find Code:
----------------------------------------------------------------------------------------------------

        $sig = isset($_POST['newsig']) ? checkInput($_POST['newsig'], '', $SETTINGS['sightml'], '', false) : '';

----------------------------------------------------------------------------------------------------

Add Code Below:
----------------------------------------------------------------------------------------------------

        // Ignore Forums In Activity Mod Begin
        $newignoreforums = formVar('newignoreforums');
        $ignoreforums = $newignoreforums ? checkInput($newignoreforums, 'no', 'yes', 'javascript', false) : '';
        // Ignore Forums In Activity Mod End

----------------------------------------------------------------------------------------------------


Find Code:
----------------------------------------------------------------------------------------------------

        $sig = addslashes($sig);

----------------------------------------------------------------------------------------------------

Add Below:
----------------------------------------------------------------------------------------------------

        // Ignore Forums In Activity Mod Begin
        $ignoreforums = addslashes($ignoreforums);
        // Ignore Forums In Activity Mod End

----------------------------------------------------------------------------------------------------


Find Code:
----------------------------------------------------------------------------------------------------

        $db->query("UPDATE ".X_PREFIX."members SET $pwtxt

----------------------------------------------------------------------------------------------------

Add Code To End Before: WHERE username='$xmbuser'");
----------------------------------------------------------------------------------------------------

, ignoreforums='$ignoreforums'

----------------------------------------------------------------------------------------------------
====================================================================================================


====================================================================================================
STEP 4: Edit File 'editprofile.php'

Find Code:
----------------------------------------------------------------------------------------------------

    $sig = isset($_POST['newsig']) ? checkInput($_POST['newsig'], '', $SETTINGS['sightml'], '', false) : '';

----------------------------------------------------------------------------------------------------

Add Code Below:
----------------------------------------------------------------------------------------------------

    // Ignore Forums In Activity Mod Begin
    $newignoreforums = formVar('ignoreforums');
    $ignoreforums = $newignoreforums ? checkInput($newignoreforums, 'no', 'yes', 'javascript', false) : '';
    // Ignore Forums In Activity Mod End

----------------------------------------------------------------------------------------------------


Find Code:
----------------------------------------------------------------------------------------------------

    $sig = addslashes($sig);

----------------------------------------------------------------------------------------------------

Add Code Below:
----------------------------------------------------------------------------------------------------

    // Ignore Forums In Activity Mod Begin
    $ignoreforums = addslashes($ignoreforums);
    // Ignore Forums In Activity Mod End

----------------------------------------------------------------------------------------------------


Find Code:
----------------------------------------------------------------------------------------------------

    $db->query("UPDATE ".X_PREFIX."members SET email='$email'

----------------------------------------------------------------------------------------------------

Add Code To End Before: WHERE username='$user'");
----------------------------------------------------------------------------------------------------

, ignoreforums='$ignoreforums'

----------------------------------------------------------------------------------------------------
====================================================================================================


====================================================================================================
STEP 5: Edit File 'today.php' (If Topic Activity Mod is not installed)

Find Code:
----------------------------------------------------------------------------------------------------

$fids = array();

----------------------------------------------------------------------------------------------------

Add Code Above:
----------------------------------------------------------------------------------------------------

// Ignore Forums In Activity Mod Begin
$ignoreforums = '';
if (isset($self['ignoreforums']) && $self['ignoreforums'] != '') {
    $ignoreforums = ' AND fid NOT IN (' . $self['ignoreforums'] . ')';
}
// Ignore Forums In Activity Mod End

----------------------------------------------------------------------------------------------------


Find Code:
----------------------------------------------------------------------------------------------------

    $q = $db->query("SELECT fid FROM ".X_PREFIX."forums WHERE status='on'");

----------------------------------------------------------------------------------------------------

Replace Code With:
----------------------------------------------------------------------------------------------------

    $q = $db->query("SELECT fid FROM ".X_PREFIX."forums WHERE status = 'on'$ignoreforums");

----------------------------------------------------------------------------------------------------


Find Code:
----------------------------------------------------------------------------------------------------

    $q = $db->query("SELECT fid, type, fup FROM ".X_PREFIX."forums WHERE status='on' AND $restrict");

----------------------------------------------------------------------------------------------------

Replace Code With:
----------------------------------------------------------------------------------------------------

    $q = $db->query("SELECT fid FROM ".X_PREFIX."forums WHERE status = 'on' AND $restrict$ignoreforums");

----------------------------------------------------------------------------------------------------
====================================================================================================


====================================================================================================
STEP 6: Edit File 'activity.php' (If Topic Activity Mod is installed)

Find Code:
----------------------------------------------------------------------------------------------------

$threadcount = 0;

----------------------------------------------------------------------------------------------------

Add Code Above:
----------------------------------------------------------------------------------------------------

// Ignore Forums In Activity Mod Begin
$ignoreforums = '';
if (isset($self['ignoreforums']) && $self['ignoreforums'] != '') {
    $ignoreforums = ' AND f.fid NOT IN (' . $self['ignoreforums'] . ')';
}
// Ignore Forums In Activity Mod End

----------------------------------------------------------------------------------------------------


Find Code:
----------------------------------------------------------------------------------------------------

$query = $db->query("SELECT $dotadd1 t.*, f.name FROM (".X_PREFIX."threads t, ".X_PREFIX."forums f) $dotadd2 WHERE $srchtype t.lastpost >= '$srchfrom' AND t.fid=f.fid AND f.fid IN ($fidlist) ORDER BY $srchsort $srchorder LIMIT $start_limit, $tpp");

----------------------------------------------------------------------------------------------------

Replace Code With:
----------------------------------------------------------------------------------------------------

$query = $db->query("SELECT $dotadd1 t.*, f.password, f.private, f.userlist, f.name FROM (".X_PREFIX."threads t, ".X_PREFIX."forums f) $dotadd2 WHERE $srchtype t.lastpost >= '$srchfrom'$ignoreforums AND t.fid=f.fid AND f.fid IN ($fidlist) ORDER BY $srchsort $srchorder LIMIT $start_limit, $tpp");

----------------------------------------------------------------------------------------------------


Find Code:
----------------------------------------------------------------------------------------------------

$totalquery = $db->query("SELECT $dotadd1 t.*, f.password, f.private, f.userlist, f.name FROM ".X_PREFIX."threads t $dotadd2, ".X_PREFIX."forums f WHERE $srchtype t.lastpost >= '$srchfrom' AND t.fid = f.fid AND f.fid IN ($fidlist)");

----------------------------------------------------------------------------------------------------

Replace Code With:
----------------------------------------------------------------------------------------------------

$totalquery = $db->query("SELECT $dotadd1 t.*, f.password, f.private, f.userlist, f.name FROM ".X_PREFIX."threads t $dotadd2, $table_forums f WHERE $srchtype t.lastpost >= '$srchfrom'$ignoreforums AND t.fid = f.fid AND f.fid IN ($fidlist)");

----------------------------------------------------------------------------------------------------
====================================================================================================


====================================================================================================
STEP 7: Edit File 'lang/English.lang.php'

Add Code To End Of File Above ?>
----------------------------------------------------------------------------------------------------

// Ignore Forums In Activity Mod Begin
$lang['ignoreforums'] = "Ignore New Posts In Forum(s):<br /><small>Enter the forum id's (fid) of the forums you with to ignore in Today\'s posts or Topic Activity?</small>";
// Ignore Forums In Activity Mod End

----------------------------------------------------------------------------------------------------
====================================================================================================



====================================================================================================
STEP 8: Edit Template 'member_reg'

Find Code:
----------------------------------------------------------------------------------------------------

$captcharegcheck

----------------------------------------------------------------------------------------------------

Add Code Above:
----------------------------------------------------------------------------------------------------

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[ignoreforums]</td>
<td bgcolor="$THEME[altbg2]"><textarea rows="5" cols="45" name="ignoreforums"></textarea></td>
</tr>

----------------------------------------------------------------------------------------------------
====================================================================================================


====================================================================================================
STEP 9: Edit Template 'memcp_profile'

Find Code:
----------------------------------------------------------------------------------------------------

<tr>
<td class="ctrtablerow" bgcolor="$altbg2" colspan="2"><input type="submit" class="submit" name="editsubmit" value="$lang[texteditpro]" /></td>
</tr>

----------------------------------------------------------------------------------------------------

Add Code Above:
----------------------------------------------------------------------------------------------------

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[ignoreforums]</td>
<td bgcolor="$THEME[altbg2]"><textarea rows="5" cols="45" name="newignoreforums">$member[ignoreforums]</textarea></td>
</tr>

----------------------------------------------------------------------------------------------------
====================================================================================================


====================================================================================================
STEP 10: Edit Template 'admintool_editprofile'

Find Code:
----------------------------------------------------------------------------------------------------

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[dateformat]</td>
<td bgcolor="$altbg2"><input type="text" name="dateformatnew" size="25" value="$member[dateformat]" /></td>
</tr>

----------------------------------------------------------------------------------------------------

Add Code Below:
----------------------------------------------------------------------------------------------------

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[ignoreforums]</td>
<td bgcolor="$THEME[altbg2]"><textarea rows="5" cols="45" name="newignoreforums">$member[ignoreforums]</textarea></td>
</tr>

----------------------------------------------------------------------------------------------------
====================================================================================================
Enjoy!