What are the consequences of users deleting their own posts and the negative impact on forum discussions?

When users delete their own posts in a forum discussion, it can disrupt the flow of conversation and make it difficult for other users to follow the discussion. This can lead to confusion, misunderstandings, and a decrease in overall engagement on the forum. One way to address this issue is to restrict users from deleting their own posts after a certain amount of time has passed since the post was made. This can help maintain the continuity of discussions and prevent users from removing valuable contributions to the conversation.

// Check if the post deletion time limit has passed
if($post_time < strtotime('-1 hour')) {
    // Allow user to delete post
    delete_post($post_id);
} else {
    // Display error message to user
    echo "You can no longer delete this post.";
}