Not a bug There are no comments to display.

Eagle

Well-known member
If mass delete all 'deleted users' profile post comments, there is a problem when click to "View previous comments..." on member profile post comments; "There are no comments to display." but there is still shows up "View previous comments..." link. I think it's a bug and I have a question there is a SQL Query for rebuild/cache profile posts and profile post comments?
 
I'm unclear what you mean by "mass delete all 'deleted users' profile post comments". What did you do?
 
I'm unclear what you mean by "mass delete all 'deleted users' profile post comments". What did you do?

Well you know if there is more comment in a profile post then shows "View previous comments..." link.

If run...
Code:
DELETE FROM xf_profile_post_comment WHERE user_id = '0';

You know 0 is a deleted user and that SQL Query will remove all deleted user comments from profile posts.

But after...
If there is some or more comment in profile post by "deleted user", then still shows "View previous comments..." link? And if you click it,

"There are no comments to display."

I think deleted user's comments don't delete in previous comments...

Example;

Profile Post
+Comment (deleted user)
+Comment (deleted user)
+Comment (deleted user)
"View previous comments..."

Now we run that SQL Query for remove all deleted users comments and now we still see "View previous comments..." link and now click to "View previous comments..." link,

"There are no comments to display."

There is should be a cache/update for this or I'm not sure...

Thanks.
 
You can't just delete data from the DB. The DB should never be directly modified (unless you understand the consequences).

I can only recommend you restore from a backup and remove the comments via the UI.
 
There is no problem after run that SQL Query and it removed all deleted user comments from profile posts.

I think there is a comment count or another thing in xf_profile_post table so of course I'll look that.

Thanks Mike.
 
@Mike yes if you look at profile_post table you will see comment_count row. I can't understand why comment counts doesn't work/updated after run that SQL Query...
 
This is why Mike says you can't just delete data from the database.

There is a lot of data which is maintained across multiple tables. So each profile post comment has its own entry in the xf_profile_post_comment table, but then there is a column in the xf_profile_post table which stores a cache of the number of comments that profile post has.

You have deleted the comments, but there is nothing that will trigger those counts to be updated.

The same applies to everything. If you delete a post from the xf_post table, it does not rebuild things like the message_count of the thread or the user, or the forum, or remove likes, or remove edit history etc. Running queries like that on your database, just as Mike says, without understanding the consequences, is not at all recommended because this is the exact problem it causes.

So you really should look at restoring that data from your most recent backup and then deleting the data properly.
 
So you really should look at restoring that data from your most recent backup and then deleting the data properly.

It's no problem. All profile posts and comments working good. Just we can't see load to previous comments but no problem.

Chris, If run this..

DELETE FROM xf_liked_content WHERE content_user_id = '0';

It will remove all this "Unknown Member" here;
https://xenforo.com/community/threads/deleted-user-problem-likes-youve-received.72310/

What do you think? It's possible to run this Query? It can be a risk after run Query?
 
It's a similar story. Each item of content additionally has a "like_users" column or similar which is a cache of all of the users who have liked an item of content. Deleting the content from xf_liked_content won't remove it from that cache so it may not entirely solve whatever you're trying to solve.

I really recommend leaving things as they are.
 
Back
Top Bottom