I would suggest to add the following in the beginning of profile_delete function in inc/admin.inc.php file (near ~380 line):
function profile_delete($ID, $isDeleteSpammer = false)
{
if (!$isDeleteSpammer && $ID == getLoggedId()) {
$ID = (int)$ID;
$sUsername = 'unknown-' . genRndSalt();
db_res("UPDATE `Profiles` SET `NickName` = '" . $sUsername . "', `Email` = '" . $sUsername . "@example.com', `EmailNotify` = 0, `FacebookProfile` = '', `allow_view_to` = 2 WHERE `ID` = '{$ID}'");
// delete associated locations
if (BxDolModule::getInstance('BxWmapModule'))
BxDolService::call('wmap', 'response_entry_delete', array('profiles', $ID));
//delete all subscriptions
$oSubscription = new BxDolSubscription();
$oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'profile', 'object_id' => $ID));
// delete private data
db_res( "DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='". $ID . "' LIMIT 1");
db_res( "DELETE FROM `sys_greetings` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'" );
db_res( "DELETE FROM `sys_block_list` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'" );
db_res( "DELETE FROM `sys_messages` WHERE Recipient = {$ID} OR `Sender` = {$ID}" );
db_res( "DELETE FROM `sys_fave_list` WHERE ID = {$ID} OR Profile = {$ID}" );
db_res( "DELETE FROM `sys_friend_list` WHERE ID = {$ID} OR Profile = {$ID}" );
db_res( "DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}" );
db_res( "DELETE FROM `sys_tags` WHERE `ObjID` = {$ID} AND `Type` = 'profile'" );
db_res( "DELETE FROM `sys_sbs_entries` WHERE `subscriber_id` = {$ID} AND `subscriber_type` = '1'" );
$GLOBALS['MySQL']->cleanCache('sys_browse_people');
//delete cache file
deleteUserDataFile( $ID );
return;
}
It will change username and email to 'unknown-xxxxxxxx', unsubscribe from any newsletters, set profile privacy to hidden, delete link with facebook profile (if facebook module isn't installed - remove FacebookProfile from the query), delete location and other personal profile data and clear profile cache.
It will work only if user delete their profile, when admin is deleting someone's profile it will be erased the same way as before.