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.

All other Modules /

Discuss all other Modules here.

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

General Usage Page Comments, potential bug; SS 3.0.1


Reply


6 Posts   1315 Views

Avatar
silverDe

Community Member, 1 Post

4 September 2012 at 2:29am

Dear Willr,

as far as I can see you're maintaining page comments which are a standalone module by now. I try to provide comments only to one type of page (Page -> DirectoryPage). In mysite/_config.php I add:

Commenting::add('DirectoryPage', array(
   'show_comments_when_disabled' => false,
   'comments_per_page' => 10,
   'require_moderation' => true,
   'use_ajax_commenting' => false,
   'order_comments_by' => '"Created" DESC',
   'comments_holder_id' => 'comments-holder',
'comment_permalink_prefix' => 'comment-'
));

Also I do copy CommentsInterface.ss et al. into my themes folder. Although I don't wan't to have the comments static I tried this first. The right amount of comments (10 in that case) are shown. But some variables aren't filled, these variables won't work:

DeleteAllLink, Comments.MoreThanOnePage, Comments.PrevLink, Comments.NextLink also since Comments.Pages always returns 1 I guess it isn't populated too.

Nevertheless first page of comments will be shown.

Second question: I'd like to rather load comments (per page) and submit form as ajax call than loading it within the page itself. But CommentingController/CommentsForm returns always 400 "Sorry, your session has timed out...."

Thanks for any help!

Avatar
Willr

Forum Moderator, 5513 Posts

7 September 2012 at 10:29pm

Second question: I'd like to rather load comments (per page) and submit form as ajax call than loading it within the page itself.

Ajax commenting has not been enabled yet, it is on the todo list for someone to add.

Not sure about your template issues, I had a quick look at the latest master version of the module and those links work for me so try that (not the 1.0 download)

Avatar
mishell

Community Member, 19 Posts

17 September 2012 at 4:21am

I will join the subject I think there's a bug in CommentsExtention @67 line

The moderation is being set but it's not checked when displayed.

   public function Comments() {
      $order = Commenting::get_config_value($this->ownerBaseClass, 'order_comments_by');
      
if(Commenting::get_config_value($this->ownerBaseClass,'require_moderation')) {
$list = new PaginatedList(Comment::get()->where(sprintf(
"ParentID = '%s' AND BaseClass = '%s' AND Moderated = %s", $this->owner->ID, $this->ownerBaseClass,1
))->sort($order));
}
else
$list = new PaginatedList(Comment::get()->where(sprintf(
"ParentID = '%s' AND BaseClass = '%s'", $this->owner->ID, $this->ownerBaseClass
))->sort($order));

      $list->setPageLength(Commenting::get_config_value(
         $this->ownerBaseClass, 'comments_per_page'
      ));

      $list->setPaginationGetVar("commentsstart". $this->owner->ID);

      return $list;
   }

should solve the case, or there something I missed.

M.

Avatar
Willr

Forum Moderator, 5513 Posts

17 September 2012 at 9:00pm

mishell - can you submit the fix through github?

Avatar
mishell

Community Member, 19 Posts

19 September 2012 at 3:50am

Sure, first I'll need to figure out, how to use it ;)

But I'll try to find some free time today to put it in the proper place.

Avatar
Willr

Forum Moderator, 5513 Posts

19 September 2012 at 5:54pm

Edited: 19/09/2012 5:55pm

Signup to Github (free account) and just click the edit file button (https://github.com/silverstripe/silverstripe-comments/edit/master/code/extensions/CommentsExtension.php) if you want to make your changes directly through the UI. No need to setup git, clone or anything. Great easy way to get started. Of course, you wouldn't want to do this for large changes :)