[SOLVED] Form Plugin Comment : display time

marcq

Member
Hi,

Is there a way to add the time when the comment or message where posted (please see COMMENT.png thanks) ?

Thanks in advance for your suggestions.

Cheers,

Marc
 

Attachments

  • COMMENT.png
    COMMENT.png
    25 KB · Views: 335
This pull request has been merged and is included in the recent Fabrik version (3.3.1).
What do you mean with "the date is way off"
 
Hi Troester.
Please see the attached snippet of the test comment I posted. The date looks a bit off from today.
Thanks in advance.
 

Attachments

  • Comment.PNG
    Comment.PNG
    6.1 KB · Views: 285
So, I updated the Fabrik - Comment Plug-in and added a date format to the added date format field in the plug-in. I tested and still had the same way off date result. I then went into PHP admin and noticed that it appears the time_date field within the fabrik_comments table is not working; per the attached. Any ideas why?
Thanks in advance.
 

Attachments

  • Comment2.PNG
    Comment2.PNG
    22.2 KB · Views: 263
Hmm, just tested and found that it's returning a wrong time because comment uses a timestamp column which stores UTC time but returns server time.
https://github.com/Fabrik/fabrik/pull/1426

But in principle it's working on my site.
What is the column definition in your DB (structure)?
7​
time_date
timestamp on update CURRENT_TIMESTAMP Nein CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP​
 
Hi Troester.
Yes, I really like the comments plug-in. One other thing I tested; but it failed to work was the email notifications of users adding comments. I have "Notify admins" and "Notify users on new comment" settings on; but no emails are sent. I don't think there are any issues with sending emails in general with my site; as I have a Fabrik schedule sending automated reminder emails to users and it works well. It even sent some reminders last night.
In Joomla Global Configuration > Server > Mailer = SMTP (if it matters). Any idea on how to get the notify emails working too? I'd really like that feature to work.
Back to your question above; "What is the column definition in your DB (structure)?". Where would I find my column definition in my DB (structure)?
Thanks in advance.
 
phpMyAdmin, display the comments table, click on Structure (on top "Browse","Structure","SQL"...)

I assume the comment plugin is not used very often.
I can't get any mail, too.
 
Oh, sure. Please see the attached snippet of the table structure.
Ya, not sure why it's not used often. I really like it so far. I hope the date and email issues get resolved soon; as I was planning on implementing the comments feature for users this by weekend.
Thanks in advance.
 

Attachments

  • fabrik_comments structure.PNG
    fabrik_comments structure.PNG
    193.5 KB · Views: 264
Your date issue is clear: your time_date doesn't set the timestamp automatically.

It should have "CURRENT_TIMESTAMP" as "Default" (and "on update Current_TIMESTAMP" as "Attribute")
which I think is MySQL default (Fabrik is creating a default timestamp column)
 
Yay, it worked!
Thank you, Troester.
The only issue with the date is PHPAdmin looks like it's applying a timestamp 4 hours behind my time (UTC I guess). Do you know how to apply the default timestamp + 4 hours for EST in phpadmin?
Thanks in advance.
 
What folder & file should I look to make the changes; per your pull request?
I tried downloading & installing the j3-comment-without-notificationplugin but it failed to install. So, I went into the plugins > fabrik_form and copied the comment & notification folders. tehn I pasted them in the same locations on my site. I tested a new comment and both the date matched my date / time and the auto email worked. Yay! The only bad thing was a javascript "internal server error" alert box appeared after hitting the post button. Any ideas on how to prevent the alert box from appearing? Maybe it had to do with the way I copied / pasted those plug-in folders?
Thanks in advance.
 
Yes, GitHub is not installable, you have to unzip and replace/ftp etc...

I've got the internal server error, too, with the original code.
Or a popup "please add comment" if you still have the focus on the textarea if clicking the comment button.
In both cases the comment is stored but the details view is not updated (you have to reload to see it).
No idea where this is coming from, I assume it has to do with the ajax commenting.
 
Hello Troester.
So, I experimented a bit more and found success.
I updated the Comments plugin with the latest, modified the comment.php line 782:
Code:
$notificationPlugin = false;
        //$notificationPlugin = $this->notificationPluginInstalled();

and modified the comment.php line 575 ; as you suggested to get the date / time to match my current timezone (after also updating the time_date DB field table structure to attribute and default to on update CURRENT_TIMESTAMP):
Code:
//$data[] = ' <small>' . JHTML::date($comment->time_date,$dateformat) . '</small>';
        $data[] = ' <small>' . JHTML::date($comment->time_date,$dateformat,'UTC') . '</small>';

Then after some experimenting I commented out the following section of code on line 983:
Code:
//This 1 line of code causes a server error message and nothing seems to be lost when commented out
        //$params = $this->getParams();
        /* //This section of code causes an endless progress white screen and nothing seems to be lost when commented out
        if ($params->get('comment-notify-admins') == 1)
        {
            // Notify admins
            // Get all super administrator
            $rows = $this->getAdminInfo();
 
            foreach ($rows as $row)
            {
                $mail->sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
 
                if (!in_array($row->email, $sentto))
                {
                    $mail->sendMail($app->getCfg('mailfrom'), $app->getCfg('fromname'), $row->email, $title, $message, true);
                    $sentto[] = $row->email;
                }
            }
        }
        */
Now it works great! No error messages and the emails are sent to the right people who posted related comments.
Thank you so much for your help.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top