Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Help installing comments module


Go to End


8 Posts   1693 Views

Avatar
nw

Community Member, 3 Posts

30 September 2012 at 3:18pm

I'm trying to get comments working on a site (using SS3.0.1), but seem to be running into some problems.
I've tried using the comments module from here and from Github (just to make sure I wasn't using an outdated version), and both seem to work, provided that I am not logged in (as admin). As soon as I am logged in and try to access a page with a comments area, an error appears:

[User Error] Couldn't run query: SELECT COUNT(*) FROM "PageComment" WHERE "NeedsModeration"=1 Table 'SS3_plural.PageComment' doesn't exist
GET /SS3.0.1/blog/sample-blog-entry/
Line 568 in /var/www/SS3.0.1/framework/model/MySQLDatabase.php

I've re-built the installation (/dev/build), which doesn't seem to fix it. Looking at the MySQL database, there does not appear to be any table called 'PageComment', so that seems to be part of the issue, but I'm still not sure how to go about solving the problem. Any help would be appreciated.

Avatar
Willr

Forum Moderator, 5523 Posts

30 September 2012 at 5:50pm

Could you please attach the full back trace. PageComment table shouldn't exist (it's part of the old 2.4 code) so make sure if you have any custom code that has been updated as well.

Avatar
nw

Community Member, 3 Posts

30 September 2012 at 8:09pm

hmm... I went to grab the full output, but everything seems to be working fine now (despite having not changed anything), and I can't seem to recreate the problem. How peculiar. Thanks anyway for the prompt reply Will.

Avatar
Lexandclo

Community Member, 55 Posts

1 October 2012 at 2:23am

HI
I seem to have that problem, i keep flushing, re-installing widget but keep getting the error,

Trace
Couldn't run query: SELECT COUNT(*) FROM "PageComment" WHERE "NeedsModeration"=1 Table 'lexandcl_batavi.PageComment' doesn't exist
MySQLDatabase.php:568
MySQLDatabase->databaseError(Couldn't run query: SELECT COUNT(*) FROM "PageComment" WHERE "NeedsModeration"=1 | Table 'lexandcl_batavi.PageComment' doesn't exist,256)
MySQLDatabase.php:127
MySQLDatabase->query(SELECT COUNT(*) FROM "PageComment" WHERE "NeedsModeration"=1,256)
DB.php:129
DB::query(SELECT COUNT(*) FROM "PageComment" WHERE "NeedsModeration"=1)
BlogManagementWidget.php:39
BlogManagementWidget->CommentLink()
call_user_func_array(Array,Array)
Object.php:602
Object->__call(CommentLink,Array)
ViewableData.php:366
BlogManagementWidget_Controller->CommentLink()
ViewableData.php:366
ViewableData->obj(CommentLink,,,1,)
ViewableData.php:408
ViewableData->cachedCall(CommentLink,)
ViewableData.php:421
ViewableData->hasValue(CommentLink,,1)
call_user_func_array(Array,Array)
SSViewer.php:128
SSViewer_Scope->__call(hasValue,Array)
SSViewer.php:459
SSViewer_DataPresenter->__call(hasValue,Array)
.cache.blog.templates.BlogManagementWidget.ss:19
SSViewer_DataPresenter->hasValue(CommentLink,,1)
.cache.blog.templates.BlogManagementWidget.ss:19
include(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.blog.templates.BlogManagementWidget.ss)
SSViewer.php:778
SSViewer->includeGeneratedTemplate(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.blog.templates.BlogManagementWidget.ss,BlogManagementWidget_Controller,,Array)
SSViewer.php:844
SSViewer->process(BlogManagementWidget_Controller,)
ViewableData.php:335
ViewableData->renderWith(Array)
Widget.php:200
Widget_Controller->Content()
ViewableData.php:366
ViewableData->obj(Content,,,1)
ViewableData.php:443
ViewableData->XML_val(Content,,1)
call_user_func_array(Array,Array)
SSViewer.php:128
SSViewer_Scope->__call(XML_val,Array)
SSViewer.php:459
SSViewer_DataPresenter->__call(XML_val,Array)
.cache.widgets.templates.WidgetHolder.ss:25
SSViewer_DataPresenter->XML_val(Content,,1)
.cache.widgets.templates.WidgetHolder.ss:25
include(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.widgets.templates.WidgetHolder.ss)
SSViewer.php:778
SSViewer->includeGeneratedTemplate(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.widgets.templates.WidgetHolder.ss,BlogManagementWidget_Controller,,Array)
SSViewer.php:844
SSViewer->process(BlogManagementWidget_Controller,)
ViewableData.php:335
ViewableData->renderWith(WidgetHolder)
BlogManagementWidget.php:58
BlogManagementWidget_Controller->WidgetHolder()
ViewableData.php:366
ViewableData->obj(WidgetHolder,,,1)
ViewableData.php:443
ViewableData->XML_val(WidgetHolder,,1)
call_user_func_array(Array,Array)
SSViewer.php:128
SSViewer_Scope->__call(XML_val,Array)
SSViewer.php:459
SSViewer_DataPresenter->__call(XML_val,Array)
.cache.widgets.templates.WidgetArea.ss:6
SSViewer_DataPresenter->XML_val(WidgetHolder,,1)
.cache.widgets.templates.WidgetArea.ss:6
include(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.widgets.templates.WidgetArea.ss)
SSViewer.php:778
SSViewer->includeGeneratedTemplate(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.widgets.templates.WidgetArea.ss,WidgetArea,,Array)
SSViewer.php:844
SSViewer->process(WidgetArea,)
ViewableData.php:335
ViewableData->renderWith(WidgetArea)
WidgetArea.php:58
WidgetArea->forTemplate()
ViewableData.php:444
ViewableData->XML_val(SideBar,,1)
call_user_func_array(Array,Array)
SSViewer.php:128
SSViewer_Scope->__call(XML_val,Array)
SSViewer.php:459
SSViewer_DataPresenter->__call(XML_val,Array)
.cache.blog.templates.Includes.BlogSideBar.ss:5
SSViewer_DataPresenter->XML_val(SideBar,,1)
.cache.blog.templates.Includes.BlogSideBar.ss:5
include(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.blog.templates.Includes.BlogSideBar.ss)
SSViewer.php:778
SSViewer->includeGeneratedTemplate(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.blog.templates.Includes.BlogSideBar.ss,BlogHolder_Controller,Array,Array)
SSViewer.php:844
SSViewer->process(BlogHolder_Controller,Array)
SSViewer.php:872
SSViewer::execute_template(BlogSideBar,BlogHolder_Controller,Array)
.cache.themes.bussagev2.templates.Includes.SideBar.ss:5
include(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.themes.bussagev2.templates.Includes.SideBar.ss)
SSViewer.php:778
SSViewer->includeGeneratedTemplate(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.themes.bussagev2.templates.Includes.SideBar.ss,BlogHolder_Controller,Array,Array)
SSViewer.php:844
SSViewer->process(BlogHolder_Controller,Array)
SSViewer.php:872
SSViewer::execute_template(SideBar,BlogHolder_Controller,Array)
.cache.themes.bussagev2.templates.Page.ss:101
include(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.themes.bussagev2.templates.Page.ss)
SSViewer.php:778
SSViewer->includeGeneratedTemplate(/home4/lexandcl/public_html/bussage/new2/silverstripe-cache/.cache.themes.bussagev2.templates.Page.ss,BlogHolder_Controller,,Array)
SSViewer.php:844
SSViewer->process(BlogHolder_Controller)
Controller.php:204
Controller->handleAction(SS_HTTPRequest)
RequestHandler.php:168
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:149
Controller->handleRequest(SS_HTTPRequest,DataModel)
ContentController.php:197
ContentController->handleRequest(SS_HTTPRequest,DataModel)
ModelAsController.php:68
ModelAsController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:281
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:112
Director::direct(/blog/,DataModel)
main.php:126

any ideas?

Thanks

Darren

Avatar
Willr

Forum Moderator, 5523 Posts

1 October 2012 at 7:26pm

Oh this is related to BlogManagementWidget, have you updated your Blog module installation to the latest master?

Avatar
Lexandclo

Community Member, 55 Posts

1 October 2012 at 8:15pm

HI Will

Yes i have the latest version of the blog? and the latest version of the comments and widgets installed.

Thanks

Darren

Avatar
Lexandclo

Community Member, 55 Posts

2 October 2012 at 7:45am

Found it
in BlogManagementWidget.php

it had Pagecomment instead of just comment

from line 23 to 34 should read

function CommentText() {

if(!class_exists('Comment')) return false;
$unmoderatedcount = DB::query("SELECT COUNT(*) FROM \"Comment\" WHERE \"Moderated\"=1")->value();
if($unmoderatedcount == 1) {
return _t("BlogManagementWidget.UNM1", "You have 1 unmoderated comment");
} else if($unmoderatedcount > 1) {
return sprintf(_t("BlogManagementWidget.UNMM", "You have %i unmoderated comments"), $unmoderatedcount);
} else {
return _t("BlogManagementWidget.COMADM", "Comment administration");
}
}

thanks will

Avatar
Willr

Forum Moderator, 5523 Posts

2 October 2012 at 8:13pm

Which is why I suspect you have an old version of blog module as it seems fine in https://github.com/silverstripe/silverstripe-blog/blob/master/code/widgets/BlogManagementWidget.php