// Block member if admin changed his/her status not for the best
                    if ($p_arr['Status'] == 'Active' && strlen($p_arr_new['Status']) > 0 && $p_arr_new['Status'] != 'Active') {
                        modules_block($ID);
                    }
                }
            } else {
                // Block member if his/her status was changed in consequence of some fields changing
                if (strlen($STATUS_CHANGE_TO) > 0) {
                    modules_block($ID);
                }
            }
            if ($_POST['NewProfile'] != 'YES') {
                if ($p_arr['NickName'] != $p_arr_new['NickName']) {
                    modules_update($ID, '', $p_arr['NickName']);
                } else {
                    modules_update($ID);
                }
            }
            //
            // MODULES [ END ]
            //
        }
        // see line 368
    }
    // see line 239
}
// see line 163
//---------------------------------- SAVE CHANGES [END]
// check if we going to add new profile
if ($ADMIN && !$ID) {
    $NEW_TO_ADD = true;
//========================================================================================================================
// - Membership check -
echo "\n- Membership expiration letters -\n";
$expire_notification_days = getParam("expire_notification_days");
$expire_notify_once = getParam("expire_notify_once");
$expire_letters = 0;
$exp_res = db_res("SELECT `ID` FROM `Profiles`", 0);
while ($row = mysql_fetch_array($exp_res)) {
    $current_membership_arr = getMemberMembershipInfo($row['ID']);
    // If expire_notification_days is -1 then notify after expiration
    if ($current_membership_arr['ID'] == MEMBERSHIP_ID_STANDARD && $expire_notification_days == -1) {
        // Calculate last UNIX Timestamp
        $last_timestamp = time() - 24 * 3600;
        $last_membership_arr = getMemberMembershipInfo($row['ID'], $last_timestamp);
        if ($current_membership_arr['ID'] != $last_membership_arr['ID']) {
            modules_update($row['ID']);
            // Handle membership level change
            if ($further_membership_arr['ID'] == MEMBERSHIP_ID_STANDARD) {
                $mail_ret = mem_expiration_letter($row['ID'], $last_membership_arr['Name'], -1);
                if ($mail_ret) {
                    $expire_letters++;
                }
            }
        }
    } elseif ($current_membership_arr['ID'] != MEMBERSHIP_ID_STANDARD) {
        // Calculate further UNIX Timestamp
        $further_timestamp = time() + $expire_notification_days * 24 * 3600;
        $further_membership_arr = getMemberMembershipInfo($row['ID'], $further_timestamp);
        if ($current_membership_arr['ID'] != $further_membership_arr['ID'] && $further_membership_arr['ID'] == MEMBERSHIP_ID_STANDARD) {
            if (!$expire_notify_once || abs($further_timestamp - time()) < 24 * 3600) {
                $mail_ret = mem_expiration_letter($row['ID'], $current_membership_arr['Name'], (int) (($current_membership_arr['DateExpires'] - time()) / (24 * 3600)));
    echo "<br /><p>Fatal error: <b>{$ErrorMessage}</b></p><br />";
    exit($ErrorMessage);
}
if ($argc < 3) {
    FatalError(sprintf(errArgCountNotMatch, $argc));
}
$isAdmin = $argv[1];
for ($argIndex = 2; $argIndex <= $argc - 1; $argIndex++) {
    $userID = $argv[$argIndex];
    if ($isAdmin) {
        modules_update($userID, '', '', 1);
    } else {
        if ($userID != (int) $userID) {
            FatalError(sprintf(errInvalidInputData, " invalid member ID: [{$userID}]"));
        }
        modules_update($userID);
        // User will be added if he does not exist
        $resCheckAction = checkAction($userID, ACTION_ID_USE_CHAT);
        if ($resCheckAction[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
            modules_block($userID, 'chat');
        } else {
            modules_unblock($userID, 'chat');
        }
        $resCheckAction = checkAction($userID, ACTION_ID_USE_FORUM);
        if ($resCheckAction[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
            modules_block($userID, 'forum');
        } else {
            modules_unblock($userID, 'forum');
        }
    }
}