After cancelling the user under(Delete the account and make its content belong to the Anonymous user). Forum posted by is changed to "Anonymous" but comment name is still displayed in the forum.

enter image description here

Also i noticed it in the table, node_comment_statistics

enter image description here

How can i remove the Last Comment Name while cancelling, because i need to remove entire user information from my database.

Update 1:

Last_Comment_Name is mapped from the table Comment column name

1 Answer 1


The forum module doesn't respond to any user deletion activity so you'll have to build your own solution here. You can create a custom module with a hook_user_cancel implementation that will:

  1. Check that the canceled user account is being anonymized.
  2. Look up the username's entries in the node_comment_statistics (and other relevant tables).
  3. Execute a UPDATE DB query that replace the name with "anonymous" (or whatever anonymized name you like).
  • Thanks, exactly what i did yesterday. Is this the recommended solution?
    – Prasanth R
    Commented Jun 8, 2018 at 3:47
  • 1
    It's what I recommended :) The only better option I can think of (if it exists) is using a patch on the forum module to do the same thing. You might want to check d.o. forums to see if exists (seems like the forum module should do this automatically).
    – Shawn Conn
    Commented Jun 8, 2018 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.