Guestbook editing comments to not show one editing as sender not admin
Permalink
I am using the guestbook block and it is working flawlessly except for one issue that drives me crazy. We monitor the guestbook posts and occasionally need to edit or remove elements from a comment.
The issue: When we complete the edit and approve the comments it now says it is from the admin rather than the one that filled out the comment form. It even shows the person who originally filled out the comment form when editing it but changes after save.
Any way how to make this stay showing it is from the one that filled it out?
The issue: When we complete the edit and approve the comments it now says it is from the admin rather than the one that filled out the comment form. It even shows the person who originally filled out the comment form when editing it but changes after save.
Any way how to make this stay showing it is from the one that filled it out?
![tommyh](/files/avatars/11531.jpg)
Does anyone have any ideas on this one?
Does anyone have any ideas on this one?
I just noticed that I have the same issue. It also reorders the post as if it were just posted. Even an approved comment showed up as if it was created by me, maybe I edited that by accident or something. Please let me know if you come up with a solution.
# concrete5 Version
5.5.1
# concrete5 Packages
CSV displayer (1.1), Database Backup (1.0), engagingit_table_sorter (1.1), Expand / Collapse (1.2.0), Facebook Like Button (1.1), Galleria image gallery (2.0), Google Map (Premium) (2.0.1), iCal Template (1.1), Likes This! (1.0), PHP block by ND (1.0), Sisimizi's Download Folder (1.0), tnSpacer (1.2), Touching (1.0), View Directory (1.3), Yosemite (1.0), ZenLike (1.02).
# concrete5 Overrides
blocks/autonav, blocks/external_form, blocks/survey, elements/header_required.php, elements/header_required-old.php, single_pages/page_not_found-dont-use.php, themes/cannonf700_zenlike, themes/touching_test
# Server Software
Apache
# Server API
cgi-fcgi
# PHP Version
5.2.17
# PHP Extensions
apc, bcmath, bz2, calendar, cgi-fcgi, ctype, curl, date, dba, dbase, dom, exif, filter, ftp, gd, gettext, gmp, hash, iconv, imap, ionCube Loader, json, ldap, libxml, mbstring, mcrypt, mhash, mime_magic, mysql, mysqli, ncurses, odbc, openssl, pcntl, pcre, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, posix, pspell, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SourceGuardian, SPL, SQLite, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib.
# concrete5 Version
5.5.1
# concrete5 Packages
CSV displayer (1.1), Database Backup (1.0), engagingit_table_sorter (1.1), Expand / Collapse (1.2.0), Facebook Like Button (1.1), Galleria image gallery (2.0), Google Map (Premium) (2.0.1), iCal Template (1.1), Likes This! (1.0), PHP block by ND (1.0), Sisimizi's Download Folder (1.0), tnSpacer (1.2), Touching (1.0), View Directory (1.3), Yosemite (1.0), ZenLike (1.02).
# concrete5 Overrides
blocks/autonav, blocks/external_form, blocks/survey, elements/header_required.php, elements/header_required-old.php, single_pages/page_not_found-dont-use.php, themes/cannonf700_zenlike, themes/touching_test
# Server Software
Apache
# Server API
cgi-fcgi
# PHP Version
5.2.17
# PHP Extensions
apc, bcmath, bz2, calendar, cgi-fcgi, ctype, curl, date, dba, dbase, dom, exif, filter, ftp, gd, gettext, gmp, hash, iconv, imap, ionCube Loader, json, ldap, libxml, mbstring, mcrypt, mhash, mime_magic, mysql, mysqli, ncurses, odbc, openssl, pcntl, pcre, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, posix, pspell, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SourceGuardian, SPL, SQLite, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib.
Maybe we should bring this up during the "Totally Random" show friday.
Hi, was there any resolution on this? If not I will report it as an issue for the core team
Hi,
Not at this point that I am aware of. Really wish we could resolve this.
Not at this point that I am aware of. Really wish we could resolve this.
Around line 421 of controller.php in the updateEntry() method you can change the update to not update user_name and email.
and do this
*I think. This should basically just ignore username and email on update. I don't know if it works, I never use the guest book. But might be worth a try.
and do this
*I think. This should basically just ignore username and email on update. I don't know if it works, I never use the guest book. But might be worth a try.
Thank you. I was hoping to avoid overriding the core, but I can see I don't have a choice here, hopefully the team will sort this out in one of the upcoming releases.
have you tried this yet? kinda want to avoid core as well.
I would definitely test this first, because I didn't test it at all.
thank
I just faced this problem. I think one should not be forced to dive into code in order to be able to correct spelling of visitors' comments while preserving their names. The idea to update name is inappropriate in the first place. The fact that the problem is not resolved after more than a year does not contribute positively to cocrete5's good name.
I am not sure that it is a fault. It could be argued this should be the intended behaviour. If someone edits the post it is shown to be their post.
However, it may not be what you want to happen. It doesn't suit what I want and I have needed to work round this before.
I have written up a solution that although involves updating the database directly, is a simple thing to do and doesn't require code changes.
You update the btGuestBookEntries table and set the uID to 0 for the comment entry that you want to change. The full post ishttp://richardjh.org/blog/editing-concrete5-comments-changes-posted...
However, it may not be what you want to happen. It doesn't suit what I want and I have needed to work round this before.
I have written up a solution that although involves updating the database directly, is a simple thing to do and doesn't require code changes.
You update the btGuestBookEntries table and set the uID to 0 for the comment entry that you want to change. The full post ishttp://richardjh.org/blog/editing-concrete5-comments-changes-posted...
I'm very new to c5 but this issue got my back up, regardless of whether or not the behaviour is strictly correct or not. I also noticed that the original posting timestamp gets updated when a comment is approved or unapproved, which again is not an intuitive behaviour IMHO. This is my solution, which is open to correction or improvement, and does not touch any of the core scripts...
The function responsible for updating a comment is updateEntry(), which is part of the Concrete5_Controller_Block_GuestbookEntry class in /concrete/core/controllers/blocks/guestbook_entry.php.
approveEntry() and unApproveEntry() follow updateEntry(), and they reference the private function adjustCountCache().
An empty 'placeholder' extension of this class can be found in /concrete/blocks/guestbook/controller.php, which can in turn be overridden or extended (without touching the original) by creating a new script in /blocks/guestbook/ called controller.php containing the following:
HTH and feel free to correct me if I've got anything wrong :)
The function responsible for updating a comment is updateEntry(), which is part of the Concrete5_Controller_Block_GuestbookEntry class in /concrete/core/controllers/blocks/guestbook_entry.php.
approveEntry() and unApproveEntry() follow updateEntry(), and they reference the private function adjustCountCache().
An empty 'placeholder' extension of this class can be found in /concrete/blocks/guestbook/controller.php, which can in turn be overridden or extended (without touching the original) by creating a new script in /blocks/guestbook/ called controller.php containing the following:
<?php ####################################### ## CORE OVERRIDE - EDIT BLOG COMMENT ## ####################################### ### alters the original code as shown such that only the comment text is updated upon edit, ### and the original posting timestamp is left unchanged on approval or unapproval. defined('C5_EXECUTE') or die("Access Denied."); class GuestbookBlockController extends Concrete5_Controller_Block_Guestbook { } class GuestBookBlockEntry extends Concrete5_Controller_Block_GuestbookEntry { private function adjustCountCache($number=false){ $ca = new Cache(); $db = Loader::db(); $count = $ca->get('GuestBookCount',$this->cID."-".$this->bID); if($count && $number){ $count += $number;
Viewing 15 lines of 51 lines. View entire code block.
HTH and feel free to correct me if I've got anything wrong :)