Support Thread

Cannot permanently delete posts

📅 👤 ASP Playground
Cannot permanently delete posts — APG vNext Guide

This archived community thread from the APG vNext support forum discusses: Cannot permanently delete posts.

About This Topic

Hello, I've done a search for this subject, but didn't find a similar question or problem.Anyway, seems I can't delete any messages permanently, it only allo...

Getting Help with APG vNext

APG vNext is a powerful ASP.NET forum and community platform. For questions related to this topic:

If you need direct assistance, the support team is active in the community forum.

Cannot Permanently Delete Posts in APG vNext

APG vNext uses a two-stage delete: soft delete (hidden but retained) and hard delete (permanent). If the hard delete option doesn't appear, either the admin permission isn't granted or the recycle bin feature is intercepting the action.

Enabling Permanent Delete

  1. Admin Panel -> Settings -> Moderation -> Enable Permanent Delete: Yes
  2. Admin Panel -> Users -> Groups -> [Administrator] -> Can Permanently Delete Posts: Yes

Disabling the Recycle Bin

<add key="APG.Moderation.RecycleBinEnabled" value="false" />

Bulk Hard Delete via SQL

-- Permanently remove all soft-deleted posts older than 30 days:
DELETE FROM apg_Posts
WHERE IsDeleted = 1
  AND DeletedAt < DATEADD(DAY, -30, GETDATE());

-- Remove orphaned attachments:
DELETE FROM apg_Attachments
WHERE PostID NOT IN (SELECT PostID FROM apg_Posts);

Related Resources

Cannot Permanently Delete Posts in APG vNext

APG vNext uses a soft-delete system for posts by default — deleted posts are marked as deleted in the database but not immediately removed. This protects against accidental deletion, supports the post history feature, and enables an undo window. If posts are not appearing to delete permanently, your forum is likely using soft-delete mode, or the permanent delete permission is not granted to your moderator role.

Understanding Soft Delete vs. Hard Delete

-- Soft-deleted posts in the database (marked but not removed):
SELECT PostID, ThreadID, Content, DeletedDate, DeletedBy
FROM   apg_Posts
WHERE  IsDeleted = 1
ORDER  BY DeletedDate DESC;

-- Hard-delete (permanently remove) a specific post:
DELETE FROM apg_PostAttachments WHERE PostID = @PostID;
DELETE FROM apg_PostHistory      WHERE PostID = @PostID;
DELETE FROM apg_PostNotices      WHERE PostID = @PostID;
DELETE FROM apg_Posts            WHERE PostID = @PostID;

Enabling Permanent Delete in Admin Panel

Admin Panel → Forums → [Forum Name] → Moderation Settings
→ Enable "Allow permanent post deletion" → Save

Or in web.config:
<add key="APG.Posts.HardDeleteEnabled"       value="true" />
<add key="APG.Posts.HardDeleteRole"          value="Administrator,GlobalModerator" />
<!-- Only roles listed here can permanently delete posts -->

Automatic Hard Delete After Soft-Delete Period

Configure APG vNext to automatically permanently delete soft-deleted posts after a retention period, reducing database size over time:

<add key="APG.Posts.SoftDeleteRetentionDays" value="30" />
<!-- Soft-deleted posts are permanently removed after 30 days -->
<add key="APG.Posts.AutoHardDeleteEnabled"   value="true" />
<!-- A scheduled SQL Server Agent job handles the cleanup nightly -->

Bulk Hard-Delete Old Soft-Deleted Posts

-- Permanently delete all soft-deleted posts older than 90 days:
DECLARE @CutoffDate DATETIME = DATEADD(day, -90, GETUTCDATE());

DELETE pa FROM apg_PostAttachments pa
JOIN apg_Posts p ON p.PostID = pa.PostID
WHERE p.IsDeleted = 1 AND p.DeletedDate < @CutoffDate;

DELETE ph FROM apg_PostHistory ph
JOIN apg_Posts p ON p.PostID = ph.PostID
WHERE p.IsDeleted = 1 AND p.DeletedDate < @CutoffDate;

DELETE FROM apg_Posts
WHERE IsDeleted = 1 AND DeletedDate < @CutoffDate;

SELECT @@ROWCOUNT AS PostsHardDeleted;

Moderator Permissions for Post Deletion

In APG vNext, post deletion permissions are configured at the forum level, not globally. A moderator may have hard-delete permission in one forum but not another. Review and standardise deletion permissions across all forums to ensure consistent moderation behaviour. Hard-delete permission should be restricted to Senior Moderators and Administrators, as permanent deletion cannot be undone without restoring from a database backup. Regular moderators should typically have soft-delete permission only, which provides a safety net and an audit trail of deletion activity in the apg_Posts.IsDeleted column.

Audit Trail for Deletions

-- View recent post deletions with who deleted them:
SELECT p.PostID, p.ThreadID, p.DeletedDate,
       m.UserName AS DeletedByUser,
       LEFT(p.Content, 100) AS ContentPreview
FROM   apg_Posts p
JOIN   apg_Members m ON m.MemberID = p.DeletedBy
WHERE  p.IsDeleted = 1
ORDER  BY p.DeletedDate DESC;

Recovering Accidentally Hard-Deleted Posts

Unlike soft-deleted posts (which can be restored from Admin Panel → Posts → Deleted Posts), hard-deleted posts cannot be recovered through the APG vNext interface. The only recovery option is restoring from a database backup made before the deletion occurred. This is why permanent delete permission should be granted sparingly and only to administrators and senior moderators who fully understand the consequences. Consider enabling the APG vNext audit log for post deletions so you have a permanent record of what was deleted and by whom, even if the content itself cannot be recovered after a hard delete.

Related Resources


Looking for more help? Browse the support forum or check the Knowledge Base.