Forum

Thread tagged as: Error, Installation, Comments

Comments App not working

Hi,

I'm using the latest version of Perch and trying to get Comments to work. The installation instructions seem deprecated because they just don't work!

Firstly when I dropped the app into the add ons folder (perch/addons/apps/perch_comments) and amended the apps.php file to include 'comments' or 'perch_comments' the page loads an error:

include(/Users/louisotto/Code/EARLY ACCESS/perch/addons/apps/comments/runtime.php): failed to open stream: No such file or directory in /Users/louisotto/Code/EARLY ACCESS/perch/core/inc/apps.php

Then I went into the file and added the following lines:

case 'comments': include(PERCH_PATH.'/addons/apps/perch_comments/runtime.php'); break;

When I reloaded the page the comment form appears, and allows me to submit but every time I do it doesn't actually send a comment anywhere, and doesn't update the backend. At this point I'm lost, can you help?

Louis Otto

Louis Otto 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

I need to see your Diagnostics Report to help (you should have been asked for that when creating the thread).

Sorry Rachel, please see below:

Perch: 2.8.10
Production mode: Production (100)
Installed apps: content (2.8.10), assets (2.8.10), categories (2.8.10), perch_comments (1.1.1)
DB driver: PDO
DB tables: perch2_categories, perch2_category_counts, perch2_category_sets, perch2_comments, perch2_comments_votes, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users
Users: 3
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'comments'
    );
Editor plug-ins: markitup
H1: 0711a26dd1beb21777f12428aca0bb00
L1: a696a2ec3f07478d42574f9a5dffe8a3
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.7.10: done
latest_version: 2.8.8
on_sale_version: 2.8.10
update_2.8.10: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: earlyaccess
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: louis.otto@gmail.com
PERCH_EMAIL_FROM_NAME: Louis Otto
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/louisotto/Code/EARLY ACCESS/perch
PERCH_CORE: /Users/louisotto/Code/EARLY ACCESS/perch/core
PERCH_RESFILEPATH: /Users/louisotto/Code/EARLY ACCESS/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/louisotto/Code/EARLY ACCESS/perch/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
HOSTING SETTINGS

PHP: 5.6.10
Zend: 2.6.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $
MySQL server: 5.5.42
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, mysql, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, gettext, mcrypt, yaz, pgsql, pdo_pgsql
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 128M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
HTTP_HOST: earlyaccess.dev:8888
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: _ga=GA1.2.50788216.1438014698; cmsa=1; PHPSESSID=1fb57e57152301ffc3f19135cdaa0662
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_REFERER: https://earlyaccess.dev:8888/perch/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate
PATH: /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SOFTWARE: Apache
SERVER_NAME: earlyaccess.dev
SERVER_ADDR: ::1
SERVER_PORT: 8888
REMOTE_ADDR: ::1
DOCUMENT_ROOT: /Users/louisotto/Code/EARLY ACCESS
SERVER_ADMIN: you@example.com
SCRIPT_FILENAME: /Users/louisotto/Code/EARLY ACCESS/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 62227
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1438528990.89
REQUEST_TIME: 1438528990
argc: 1
Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to update your apps.php to:

$apps_list = array(
        'content', 
        'categories',
        'perch_comments'
    );

Thanks Drew, I've done that now, but it doesn't seem to have changed anything. Frontside validation on email addresses work, but when I submit the form the page refreshes and the content remains in the form. The comments app section in the admin panel hasn't changed either, it hasn't registered the comments section.

Really puzzled by this, not sure how to proceed!

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you add debug to the page, what does it output after submitting your form?

Hi Drew,

OK, I noticed in the debug this line:

Array ( [commentURL] => format ) I was simply entering 'test' in the website form, and it was blocking that. Actually, there is no front-end validation message. With a bad email it informs you, but with a bad website url it doesn't say anything at all. Might be worth looking in to.

Also, it said your comment will appear after moderation, but no moderation was needed. It appeared straight away, so the default setting may need to change as well.

Thanks for yours and Rachel's assistance on this :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Might be worth looking in to.

Ok - what do you have in your template for this? Should be something like

<perch:error for="commentURL" type="format">Please check the format of your URL</perch:error>

If you're logged into Perch then the moderation step is skipped. It's boring to moderate your own comments.

Haha absolutely! Yeah I tried in another browser and it worked perfectly, sorry about that!

Just a quick question, if I was going to put a comments section below lots of pages as part of an article creation, how would you best implement it? I'm doing a video games review site, so at the bottom of each video game review there will be comments. I can't think of a good way to get the comments into each page other than put it into the article template at the bottom, but then I run into the issue of creating a unique name for each one.

Is there an easy way to access page variables that are set through the Perch CMS? Or is there a better way you could suggest?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do your articles have a unique identifier already? Something like an article slug, perhaps. I'd use that.

We don't use slugs no, as each review sits on its own page, essentially: root/reviews/{game-name}

I can't obviously paste php code into a text box in the back end as it comments it out, but is there a way of circumventing this maybe through a whitelist or pattern match? It's a hack fix, but may work?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you give an example of what you're trying to do? I'm not sure where the problem lies.

Basically each game review sits on its own page. I have my pages/default.php set up for the game review, and it pulls in a template that contains all of the review content. Each page should have a comments section below the review itself. My issue is how to tie the comments section to the game when I'm using templates rather than just having them all as static pages.

Supposing I was to use a slug on each page even as a reference, how could I tie it's value to the comments? It can't be as easy as perch_comments("slug"); right?

Drew McLellan

Drew McLellan 2638 points
Perch Support

In that case the page URL would serve as a unique identifier, wouldn't it?

perch_comments(PerchSystem::get_page());

My lord why didn't I consider that!? Thank you for your patience Drew!! I really appreciate it :)