Editing Concrete5 comments changes the posted by name

Posted in November 2012 by under concrete5

Getting comments is great but sometimes you need to edit a comment if it is poorly formatted or contains inappropriate content.

When you do this, Concrete5 will set the comment "posted by" field to the name of the user you are logged in as. This is correct behaviour as you have edited the comment, but this may not be what you want.

You can fix this easily if you have access to the database ( hint : you do, the connection details are in config/site.php ).

Updating database records directly can cause data loss and break your website if you make a mistake.

If you decide to follow the advice from blogs on the internet, make sure that you have a current backup of your database and that know how to do a restore before continuing.

I am not reponsible for your actions. If you break your site, the only consolation is that you get to keep the pieces.

The guestbook entry is stored in the btGuestBookEntries table. You will see entries like this

mysql> SELECT  bID, cID, entryID, uId, LEFT (commentText, 10), user_name
FROM  btGuestBookEntries;

+------+------+---------+------+------------------------+------------------+
| bID  | cID  | entryID | uId  | LEFT (commentText, 10) | user_name        |
+------+------+---------+------+------------------------+------------------+
|   74 |  155 |       3 |    0 | ???? ??? ?             | likerutle        |
|   74 |  155 |       7 |    0 | ????? ????             | Emubsmorm        |
|   74 |  206 |       8 |    0 | Looks like             | Lee Boynton      |
|   74 |  206 |       9 |    2 | Lee, It is             | Richard Holloway |
|   74 |  206 |      10 |    0 | I knew it!             | Lee Boynton      |
|   74 |  152 |      11 |    2 | Excellent              | Jonathan         |
|   74 |  152 |      12 |    2 | @jonathan              | Richard Holloway |
|   74 |  152 |      13 |    0 | Thank you              | Jonathan         |
+------+------+---------+------+------------------------+------------------+
8 rows inset ( 0.00 sec)
            

You will see that for guests to your site, the uId is 0. For users on your site, the comment entry will be linked to that user. When you edited the comment, this is what happened. This is intended behaviour.

In this example I edited entry with entryID 11, so the uId that was 0 is now 2. To unlink the comment entry from the user, simply update the uId to be 0 for the entry with the problem. So for entry with entryID 11

UPDATE btGuestBookEntries SET uId = 0 WHERE entryID = 11;