Jump to:

3430 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Adding Comments to DataObjects

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

Page: 1 2 3
Go to End
Author Topic: 3349 Views
  • pingu
    Avatar
    Community Member
    75 Posts

    Adding Comments to DataObjects Link to this post

    Hi guys,

    Is there a way to extend the page comments system to include them with a DataObject?

    My project, a user-submitted database of recipes, will require recipes to render on their own page, with comments. I don't want to save the recipes as pages, as I don't want them added to the SiteTree. I'd like to use the existing comments functionality if possible to utilize the anti-spam mechanisms.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Adding Comments to DataObjects Link to this post

    Part of the work for 3.0 is to strip out the built in comments system so you could do exactly this. Try the module and see how far you get - https://github.com/silverstripe/silverstripe-comments

  • pingu
    Avatar
    Community Member
    75 Posts

    Re: Adding Comments to DataObjects Link to this post

    Ahh! Will this is exactly what I need. It will change my life. Actually, Silverstripe 3.0 will change my life.

    Unfortunately - this isn't working for me. I've downloaded the module and managed to install it, i.e., got to the stage where the dev/build ran fine, and it's created all the right tables. But my Recipes now won't load up in ModelAdmin (I get DataObject::get_by_id passed a non-numeric ID #" at line 2924 of \core\model\DataObject.php, plus I can't access the Comments section within the CMS.

    I got a heap of duplicate class warnings during install so had to temporarily move the existing comment stuff that was causing the conflict.

    It would be AWESOME if I could use this for this project - but I may need to roll my own.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Adding Comments to DataObjects Link to this post

    I got a heap of duplicate class warnings during install so had to temporarily move the existing comment stuff that was causing the conflict.

    Hm I was trying to get the module backwards compatible. Haven't used it on 2.4 though saying that (using master to test). Do you have the backtraces for both errors?

    It would be AWESOME if I could use this for this project - but I may need to roll my own.

    Would be great to get people using this comments module, always better to have 1 solid working module than a bunch of ones with different states of stableness, hopefully the issues are minor.

  • pingu
    Avatar
    Community Member
    75 Posts

    Re: Adding Comments to DataObjects Link to this post

    Warnings below, this is trying to install on 2.5.
    I've also manually cleared silverstripe-cache to no avail.

    Warning: There are two files both containing the same class: '../cms/code/CommentAdmin.php' and '../comments/code/CommentAdmin.php'. This might mean that the wrong code is being used. in ..\sapphire\core\ManifestBuilder.php on line 487

    Warning: There are two files both containing the same class: '../cms/code/sitefeatures/SSAkismet.php' and '../comments/code/SSAkismet.php'. This might mean that the wrong code is being used. in ..\sapphire\core\ManifestBuilder.php on line 487

    Warning: There are two files both containing the same class: '../cms/code/CommentTableField.php' and '../comments/code/formfields/CommentTableField.php'. This might mean that the wrong code is being used. in ..\sapphire\core\ManifestBuilder.php on line 487

    Warning: There are two files both containing the same class: '../cms/code/CommentTableField.php' and '../comments/code/formfields/CommentTableField.php'. This might mean that the wrong code is being used. in ..\sapphire\core\ManifestBuilder.php on line 487

    Warning: There are two files both containing the same class: '../cms/code/sitefeatures/Akismet.php' and '../comments/code/thirdparty/Akismet.php'. This might mean that the wrong code is being used. in ..\sapphire\core\ManifestBuilder.php on line 487

    Warning: There are two files both containing the same class: '../cms/code/sitefeatures/Akismet.php' and '../comments/code/thirdparty/Akismet.php'. This might mean that the wrong code is being used. in ..\sapphire\core\ManifestBuilder.php on line 487

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: Adding Comments to DataObjects Link to this post

    That is stating that you have duplicated a class name...
    '../cms/code/CommentAdmin.php'
    and
    '../comments/code/CommentAdmin.php'

    simply remove the duplication - either by not duplicating the class or by using a different name for the second class

  • pingu
    Avatar
    Community Member
    75 Posts

    Re: Adding Comments to DataObjects Link to this post

    Hi Swaiba,

    Yep I did that when I first installed the comments module, but then ran into further problems with it (see my reply to Willr: I get DataObject::get_by_id passed a non-numeric ID #" at line 2924 of \core\model\DataObject.php, plus I can't access the Comments section within the CMS) - so I uninstalled the module.

    Willr mentioned that it should be backwards compatible though, so I thought I'd try again but no joy

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: Adding Comments to DataObjects Link to this post

    ok, was just explaining that those errors are easily fixed, search and replace across files to change the name of the classes in the module

    3349 Views
Page: 1 2 3
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.