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?

tommyh
 
tommyh replied on at Permalink Reply
tommyh
Does anyone have any ideas on this one?
tommyh replied on at Permalink Reply
tommyh
Does anyone have any ideas on this one?
nbruley replied on at Permalink Reply
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.
tommyh replied on at Permalink Reply
tommyh
Maybe we should bring this up during the "Totally Random" show friday.
jblanco replied on at Permalink Reply
Hi, was there any resolution on this? If not I will report it as an issue for the core team
tommyh replied on at Permalink Reply
tommyh
Hi,

Not at this point that I am aware of. Really wish we could resolve this.
mkly replied on at Permalink Reply
mkly
Around line 421 of controller.php in the updateEntry() method you can change the update to not update user_name and email.

$query = "UPDATE btGuestBookEntries SET user_name=?, uID=?, user_email=?, commentText=? WHERE entryID=? AND bID=?";
$res = $db->query($query, array($txt->sanitize($name), intval($uID), $txt->sanitize($email),$txt->sanitize($comment),$entryID,$this->bID));


and do this
$record_set = $db->Execute(
  'SELECT * FROM btGuestBookEntries WHERE entryID=? AND bID=?',
  array(
    $entryID,
    $this->bID
  )
);
$guestbook_entry = array(
  'commentText' => $txt->sanitize($comment)
);
$sql = $db->GenerateUpdateSQL($record_set, $guestbook_entry);
$db->Execute($sql);


*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.
jblanco replied on at Permalink Reply
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.
tommyh replied on at Permalink Reply
tommyh
have you tried this yet? kinda want to avoid core as well.
mkly replied on at Permalink Reply
mkly
I would definitely test this first, because I didn't test it at all.
kikloveyou44 replied on at Permalink Reply
thank
pacija replied on at Permalink Reply
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.
richardjh replied on at Permalink Reply
richardjh
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...
losttheplot replied on at Permalink Reply
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:

<?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;


HTH and feel free to correct me if I've got anything wrong :)