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.

Data Model Questions

Adding Comments to DataObjects


Go to End
Reply

20 Posts   3461 Views

Avatar
pingu

22 March 2011 at 1:24pm Community Member, 75 Posts

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.

Avatar
Willr

22 March 2011 at 4:48pm Forum Moderator, 5511 Posts

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

Avatar
pingu

24 March 2011 at 3:46am (Last edited: 24 March 2011 3:53am), Community Member, 75 Posts

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.

Avatar
Willr

24 March 2011 at 8:52pm Forum Moderator, 5511 Posts

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.

Avatar
pingu

27 March 2011 at 5:12am (Last edited: 27 March 2011 5:19am), Community Member, 75 Posts

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

Avatar
swaiba

27 March 2011 at 5:22am Forum Moderator, 1796 Posts

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

Avatar
pingu

27 March 2011 at 8:33pm (Last edited: 27 March 2011 10:32pm), Community Member, 75 Posts

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 :(

Avatar
swaiba

28 March 2011 at 1:49am Forum Moderator, 1796 Posts

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

Go to Top