=======================================================================================================================================
Modification Title: Delete Inactive Members

Modification Version: 1.0

Modification Author: John Briggs

Modification Description:
This modification will provide a new tool in admin panel to delete members with x post count and have not been active for x days.

Modification Copyright:  2009 John Briggs. All rights reserved.

Modification Compatibility: XMB 1.9.8 SP3

Modification Install Note: Before adding this modification to your forum you should back up all files related to this modification.

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

Modification Author Note:
This modification is developed and released for use with XMB 1.9.8 SP3 which is provided by XMBGarage.com.

=======================================================================================================================================
=======
Step 1:
=======
========================
Edit File: include/admin.inc.php
========================
==========
Find Code:
==========

    &raquo;&nbsp;<a href="cp.php?action=ipban"><?php echo $lang['textipban']?></a><br />

===============
Add Code Above:
===============

    <!-- Delete Inactive Members Mod Begin -->
    &raquo;&nbsp;<a href="tools.php?action=inactivemembers"><?php echo $lang['inactive']?></a><br />
    <!-- Delete Inactive Members Mod End -->

=======================================================================================================================================
=======
Step 2:
=======
===============
Edit File: tools.php
===============
==========
Find Code:
==========

    case 'logsdump':
        if (!X_SADMIN) {
            error($lang['superadminonly'], false, '</td></tr></table></td></tr></table><br />');
        }

        if (noSubmit('yessubmit')) {
            echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['logsdump_confirm'].'<br /><form action="tools.php?action=logsdump" method="post"><input type="submit" name="yessubmit" value="'.$lang['textyes'].'" /> - <input type="submit" name="yessubmit" value="'.$lang['textno'].'" /></form></td></tr>';
        } else if ($lang['textyes'] == $yessubmit) {
            $db->query("TRUNCATE ".X_PREFIX."logs");
            nav($lang['tools']);
            echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_logs'].'</td></tr></table></table>';
            end_time();
            eval('echo "'.template('footer').'";');
            exit();
        } else {
            redirect('./cp.php', 0);
        }
        break;

===============
Add Code Below:
===============

    // Delete Inactive Members Mod Begin
    case 'inactivemembers':
        if (!X_SADMIN) {
            error($lang['superadminonly'], false, '</td></tr></table></td></tr></table><br />');
        }

        if (noSubmit('inactivememsubmit')) {
            ?>
            <tr bgcolor="<?php echo $THEME[altbg2]?>">
            <td>
            <form method="post" action="tools.php?action=inactivemembers">
            <table cellspacing="0" cellpadding="0" border="0" width="550" align="center">
            <tr>
            <td bgcolor="<?php echo $THEME[bordercolor]?>">
            <table border="0" cellspacing="<?php echo $THEME[borderwidth]?>" cellpadding="<?php echo $THEME[tablespace]?>" width="100%">
            <tr class="category">
            <td colspan="2"><strong><font color="<?php echo $THEME[cattext]?>"><?php echo $lang['inactive']?></font></strong></td>
            </tr>
            <tr class="tablerow">
            <td bgcolor="<?php echo $THEME[altbg1]?>" width="22%"><?php echo $lang['num_days_expl']?></td>
            <td bgcolor="<?php echo $THEME[altbg2]?>"><input type="text" name="num_days" size="4" value="" /></td>
            </tr>
            <tr class="tablerow">
            <td bgcolor="<?php echo $THEME[altbg1]?>" width="22%"><?php echo $lang['num_posts_expl']?></td>
            <td bgcolor="<?php echo $THEME[altbg2]?>"><input type="text" name="num_posts" size="4" value="" /></td>
            </tr>
            <tr bgcolor="<?php echo $THEME[altbg2]?>" class="ctrtablerow">
            <td colspan="2">
            <input type="submit" class="submit" name="inactivememsubmit" value="<?php echo $lang['textsubmitchanges']?>" />
            </td>
            </tr>
            </table>
            </td>
            </tr>
            </table>
            </form>
            </td>
            </tr>
            <?php
        } else {
            if ($num_days == '' || !is_numeric($num_days)) {
                error($lang['num_days_not_there'], false, '</td></tr></table></td></tr></table><br />');
            }

            if ($num_posts == '' || !is_numeric($num_posts)) {
                error($lang['num_posts_not_there'], false, '</td></tr></table></td></tr></table><br />');
            }

            if (isset($num_days) && is_numeric($num_days) && isset($num_posts) && is_numeric($num_posts)) {
                $old = $onlinetime - (60*60*24*$num_days);
                $db->query("DELETE FROM ".X_PREFIX."members WHERE lastvisit < $old AND postnum <= $num_posts AND status = 'Member'");
            }

            echo '<tr bgcolor="'.$THEME['altbg2'].'" class="ctrtablerow"><td>'.$lang['tool_inactive'].'</td></tr>';
            redirect("tools.php?action=inactivemembers", 2, X_REDIRECT_JS);
        }
        break;
    // Delete Inactive Members Mod End

=======================================================================================================================================
=======
Step 3:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above ?>
============================

// Delete Inactive Members Mod Begin
$lang['inactive'] = "Delete Inactive Members";
$lang['tool_inactive'] = "Inactive Members Deleted Successfully.";
$lang['num_posts_expl'] = "Number of posts";
$lang['num_days_expl'] = "Number of days";
$lang['num_days_not_there'] = "You did not enter number of days to delete inactive members!";
$lang['num_posts_not_there'] = "You did not enter number of posts to delete inactive members!";
// Delete Inactive Members Mod End

=======================================================================================================================================
Enjoy!