1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Not a Bug There are no comments to display.

Discussion in 'Resolved Bug Reports' started by Eagle, Sep 23, 2014.

  1. Eagle

    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?
  2. Mike

    Mike XenForo Developer Staff Member

    I'm unclear what you mean by "mass delete all 'deleted users' profile post comments". What did you do?
  3. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    I am guessing via direct SQL queries?
    Go to domain.com/forums/install/index.php and rebuild master data from there...
  4. Eagle

    Eagle Well-Known Member

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

    If run...
    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...


    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...

  5. Mike

    Mike XenForo Developer Staff Member

    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.
  6. Eagle

    Eagle Well-Known Member

    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.
  7. Eagle

    Eagle Well-Known Member

    @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...
  8. Chris D

    Chris D XenForo Developer Staff Member

    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.
  9. Eagle

    Eagle Well-Known Member

    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;

    What do you think? It's possible to run this Query? It can be a risk after run Query?
  10. Chris D

    Chris D XenForo Developer Staff Member

    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.

Share This Page