Forum

Thread tagged as: Question, Configuration, Comments

Perch Comments Form not working

Clicking submit reloads the page. The form is still populated. The admin page shows nothing added. Using the example code.

I really appreciate your input.

This may be something basic as it usually is in my experience so far.

            <?php
                perch_comments('example1');
                perch_comments_form('example1', 'Comments Example');
            ?>
Fred Stidston

Fred Stidston 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you on the latest version of Perch?

Hi Drew, yes I am.

I changed the field validation type and now the form goes through however, still no comments showing up in the administrator panel.

The system report looks ok

Perch: 2.8.4, PHP: 5.5.14, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.4), assets (2.8.4), categories (2.8.4), perch_blog (4.6), perch_events (1.9.2), perch_comments (1.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_comments',    'perch_events', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Library/WebServer/Documents/perch
PERCH_CORE: /Library/WebServer/Documents/perch/core
PERCH_RESFILEPATH: /Library/WebServer/Documents/perch/resources
Image manipulation: GD
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
Resource folder writeable: Yes
HTTP_HOST: localhost
DOCUMENT_ROOT: /Library/WebServer/Documents
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn on debug and submit the form, what does it output?

https://docs.grabaperch.com/docs/installing-perch/configuration/debug/

This is the output and its given me an idea. I should add a table in my database for the comment ID manually.

SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='3f70419db97378f0984aa1ceec3d19bb' LIMIT 1
UPDATE perch2_users SET userHash='480f5d4bad6c59137a96d54117bfe367' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT COUNT(*) FROM perch2_comments WHERE commentStatus='PENDING'
SELECT SQL_CALC_FOUND_ROWS DISTINCT c.* FROM perch2_comments c WHERE 1=1 AND c.commentStatus='PENDING' ORDER BY c.commentDateTime DESC LIMIT 0, 20
SELECT FOUND_ROWS() AS `count`
Attempting app installation: perch_comments
SHOW TABLES LIKE "perch2_comments"
SELECT COUNT(*) FROM perch2_comments WHERE commentStatus='PENDING'
Setting alert: You are viewing all comments pending moderation. Clear Filter (filter)
Queries: 10
Memory: 2.2271

Manually adding tables does not seem like the right solution.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't understand what you mean.

Please excuse ambiguities, my question is about comments not going through. Checking the phpmyadmin shows no comments are being added.

Does the debug look ok to you?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, that looks like debug from the admin control panel.

Can you add debug to your page, submit the form and let me know what it outputs?

Hi,

First thing this morning one comment went through fine using the example page. Then no new comments are going through on the example page or the development page. The output error is the same on both - empty commentIP.

Invalid query: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'commentIP' at row 1

Here is the full output.

Debug Message
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='45f98c3b8d6cf0205de5e83279fb2148' LIMIT 1
UPDATE perch2_users SET userHash='be11d7f2362f5f71f5e5a8d64369b103' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
INSERT INTO perch2_comments(parentID,commentDateTime,commentName,commentEmail,commentURL,commentHTML,parentTitle,commentDynamicFields,commentSpamData,commentIP,commentStatus) VALUES('kindness','2015-04-01 08:17:19','Fred Stidston','fred@stidston.com','https://www.stidston.com','<p>Happy Day-O happy day</p>','Comments Example','{\"submitComment\":\"Add\"}','{\"fields\":{\"name\":\"Fred Stidston\",\"email\":\"fred@stidston.com\",\"url\":\"https:\\/\\/www.stidston.com\",\"body\":\"Happy Day-O happy day\"},\"environment\":{\"HTTP_HOST\":\"localhost\",\"CONTENT_TYPE\":\"application\\/x-www-form-urlencoded\",\"HTTP_ORIGIN\":\"https:\\/\\/localhost\",\"HTTP_COOKIE\":\"cmsa=1; PHPSESSID=41743f306020202a721796dc4a69220a\",\"CONTENT_LENGTH\":\"324\",\"HTTP_CONNECTION\":\"keep-alive\",\"HTTP_ACCEPT\":\"text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,*\\/*;q=0.8\",\"HTTP_USER_AGENT\":\"Mozilla\\/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit\\/600.2.5 (KHTML, like Gecko) Version\\/8.0.2 Safari\\/600.2.5\",\"HTTP_REFERER\":\"https:\\/\\/localhost\\/\",\"HTTP_ACCEPT_LANGUAGE\":\"en-us\",\"HTTP_ACCEPT_ENCODING\":\"gzip, deflate\",\"PATH\":\"\\/usr\\/bin:\\/bin:\\/usr\\/sbin:\\/sbin\",\"SERVER_SIGNATURE\":\"\",\"SERVER_SOFTWARE\":\"Apache\\/2.4.9 (Unix) PHP\\/5.5.14\",\"SERVER_NAME\":\"localhost\",\"SERVER_ADDR\":\"::1\",\"SERVER_PORT\":\"80\",\"REMOTE_ADDR\":\"::1\",\"DOCUMENT_ROOT\":\"\\/Library\\/WebServer\\/Documents\",\"REQUEST_SCHEME\":\"http\",\"CONTEXT_PREFIX\":\"\",\"CONTEXT_DOCUMENT_ROOT\":\"\\/Library\\/WebServer\\/Documents\",\"SERVER_ADMIN\":\"you@example.com\",\"SCRIPT_FILENAME\":\"\\/Library\\/WebServer\\/Documents\\/index.php\",\"REMOTE_PORT\":\"49418\",\"GATEWAY_INTERFACE\":\"CGI\\/1.1\",\"SERVER_PROTOCOL\":\"HTTP\\/1.1\",\"REQUEST_METHOD\":\"POST\",\"QUERY_STRING\":\"\",\"REQUEST_URI\":\"\\/\",\"SCRIPT_NAME\":\"\\/index.php\",\"PHP_SELF\":\"\\/index.php\",\"REQUEST_TIME_FLOAT\":1427876239.865,\"REQUEST_TIME\":1427876239,\"argv\":[],\"argc\":0}}','','LIVE')
Invalid query: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'commentIP' at row 1
SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/index.php' OR regionPage='*' ORDER BY regionPage DESC
SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2015-04-01 08:17:00' ) GROUP BY itemID ORDER BY sortval ASC LIMIT 2, 2
Using template: /addons/apps/perch_blog/templates/blog/post_aside_list.html
SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC
SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='_id' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2015-04-01 08:17:00' ) GROUP BY itemID ORDER BY sortval ASC LIMIT 0, 2
SELECT FOUND_ROWS() AS `count`
Using template: /addons/apps/perch_blog/templates/blog/post_in_list.html
SELECT DISTINCT e.* FROM perch2_events e, perch2_events_to_categories e2c, perch2_events_categories c WHERE eventDateTime>='2015-04-01' AND e.eventID=e2c.eventID AND e2c.categoryID=c.categoryID AND categorySlug IN ('workshop') LIMIT 3
Using template: /addons/apps/perch_events/templates/events/listing/tablelist.html
SELECT c.* FROM perch2_events_categories c, perch2_events_to_categories e2c WHERE c.categoryID=e2c.categoryID AND e2c.eventID='4'
SELECT c.* FROM perch2_events_categories c, perch2_events_to_categories e2c WHERE c.categoryID=e2c.categoryID AND e2c.eventID='5'
Using template: /addons/apps/perch_comments/templates/comments/comment_form.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

Looks like a missing IP address, which is unusual.

Is this also happening on your live server?

I will try the live server later.

The staging server is running and the form is working great.