Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » General Usage Page Comments, potential bug; SS 3.0.1

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 976 Views
  • silverDe
    Avatar
    Community Member
    1 Post

    General Usage Page Comments, potential bug; SS 3.0.1 Link to this post

    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!

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: General Usage Page Comments, potential bug; SS 3.0.1 Link to this post

    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)

  • mishell
    Avatar
    Community Member
    19 Posts

    Re: General Usage Page Comments, potential bug; SS 3.0.1 Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: General Usage Page Comments, potential bug; SS 3.0.1 Link to this post

    mishell - can you submit the fix through github?

  • mishell
    Avatar
    Community Member
    19 Posts

    Re: General Usage Page Comments, potential bug; SS 3.0.1 Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: General Usage Page Comments, potential bug; SS 3.0.1 Link to this post

    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

    976 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.