Forum

Thread tagged as: Problem, Addons, Comments

Comments does not work

Testing it, doesn't appear to be working, no "Thank you. Your comment has been submitted and will appear on the site once approved." when I fill it in and submit, no output just act on refresh, check contol panel, nothing there as well?

<?php
    perch_comments('product123');
    perch_comments_form('product123', 'Elasticated garden yoga pants');
?>
James Cameron-Morris

James Cameron-Morris 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you added the Comments app to your config/apps.php file?

Yes I did

<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_events',
        'perch_mailchimp',
        'perch_comments',
    );
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you add debug to your page and let me know what it outputs?

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

Thank you. Output:

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='3aef7252f99dbd39f6f8ffe7d61f1a58'
LIMIT 1
UPDATE perch2_users SET userHash='b0cca372139c41676e6b10af5f9ca207' 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 * FROM perch2_pages
WHERE pageParentID=0
ORDER BY pageTreePosition ASC
SELECT * FROM perch2_content_regions WHERE regionPage='*'
SELECT SQL_CALC_FOUND_ROWS DISTINCT * 
FROM perch2_events WHERE eventDateTime>='2014-09-01 00:00:00' ORDER BY eventDateTime LIMIT 0, 10
SELECT FOUND_ROWS() AS `count` 
SELECT * FROM perch2_mailchimp_stats LIMIT 1
SELECT * FROM perch2_mailchimp_subscribers ORDER BY subscriberDate DESC LIMIT 5
SELECT COUNT(*) FROM perch2_comments
SELECT COUNT(*) FROM perch2_comments WHERE commentStatus='PENDING'
SELECT COUNT(*) FROM perch2_comments WHERE commentStatus='LIVE'
SELECT COUNT(*) FROM perch2_comments WHERE commentStatus='REJECTED'
SELECT COUNT(*) FROM perch2_comments WHERE commentStatus='SPAM'
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is that from your page with the comment form?

If not, add it to the page and submit a comment. The output will likely reveal what's wrong.

Sorry about that:

SELECT regionKey, regionHTML FROM perch2_content_regions 
WHERE regionPage='/aylesbury1.php' OR regionPage='*' ORDER BY regionPage DESC
SELECT groupID FROM perch2_navigation WHERE groupSlug='menu' LIMIT 1
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes
FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID='3' AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID='3' AND p.pagePath='/aylesbury1.php' LIMIT 1
Using template: /templates/navigation/item.html
SELECT groupID FROM perch2_navigation WHERE groupSlug='pubs' LIMIT 1
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes
FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID='2' AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID='2' AND p.pagePath='/aylesbury1.php' LIMIT 1
Using template: /templates/navigation/item.html
SELECT DISTINCT e.*
FROM perch2_events e, perch2_events_to_categories e2c, perch2_events_categories c WHERE eventDateTime>='2014-09-01 00:00:00' AND e.eventID=e2c.eventID AND e2c.categoryID=c.categoryID AND categorySlug IN ('canterbury') ORDER BY eventDateTime ASC LIMIT 30
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Using template: /addons/apps/perch_events/templates/events/event.html
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='137'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='138'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='139'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='5'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='141'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='142'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='143'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='144'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='145'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='146'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='147'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='148'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='149'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='150'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='151'
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='152'
SELECT * FROM perch2_comments WHERE 1=1 AND parentID='product123' AND commentStatus='LIVE' ORDER BY commentDateTime ASC
Using template: /addons/apps/perch_comments/templates/comments/comment.html
Using template: /addons/apps/perch_comments/templates/comments/comment_form.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

I can't see any evidence there of the comment form being submitted.

Does the form even display?

Yes it is showing. That is the output after submitted. Does it help to say that I got event listing on the same page as well?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have any URL rewriting in place?

Only thing I did was to hide .php extension in .htaccess

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you disable that to check that it's not redirecting the posted form and losing the data?

Brilliant, it is working now with that disabled thank you. Look like I will have to do without hiding php

Drew McLellan

Drew McLellan 2638 points
Perch Support

Not necessarily. Which version of Perch are you on?

When you view source on the page, what value is set for the action attribute on the form tag?

Version 2.6.3.

Top of the comment script

<form id="form1_comment" action="/aylesbury1.php" method="post"> 

Bottom

<input id="form1_submitComment" name="submitComment" value="Submit" type="submit" /><input type="hidden" name="cms-form" value="Y29tbWVudDpwZXJjaF9jb21tZW50czovYWRkb25zL2FwcHMvcGVyY2hfY29tbWVudHMvdGVtcGxhdGVzL2NvbW1lbnRzL2NvbW1lbnRfZm9ybS5odG1s" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

You could add the following condition to your rewrite rule - it will stop it redirecting if it's a POST request:

 RewriteCond %{REQUEST_METHOD} !POST
 RewriteRule ...