Title: Delete Inactive Members v1.0

Author: John Briggs

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.

Copyright:  2009 John Briggs. All rights reserved.

Compatability: XMB 1.9.11

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

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

=======================================================================================================================================
=======
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 Below:
===============

    <!-- 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 'fixorphanedattachments':
        if (noSubmit('orphattachsubmit')) {
            echo '<form action="tools.php?action=fixorphanedattachments" method="post">';
            echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
            echo '<input type="submit" name="orphattachsubmit" value="'.$lang['o_attach_submit'].'" /></td></tr>';
            echo '</form>';
        } else {
            require('include/attach-admin.inc.php');
            $i = deleteOrphans();

            echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
            echo $i.$lang['o_attachments_found'].'</td></tr>';
        }
        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 $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:
=======
==============================================
Go To Admin Panel -> Translations & Download Language File
==============================================
===============
Edit Language File:
===============
==================================
Add Code At Very Bottom 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

============================================
Go To Admin Panel -> Translations & Upload Language File
============================================
=======================================================================================================================================
Enjoy!