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   3572 Views

Avatar
pingu

Community Member, 75 Posts

22 March 2011 at 1:24pm

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

Forum Moderator, 5513 Posts

22 March 2011 at 4:48pm

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

Community Member, 75 Posts

24 March 2011 at 3:46am

Edited: 24/03/2011 3:53am

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

Forum Moderator, 5513 Posts

24 March 2011 at 8:52pm

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

Community Member, 75 Posts

27 March 2011 at 5:12am

Edited: 27/03/2011 5:19am

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

Forum Moderator, 1799 Posts

27 March 2011 at 5:22am

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

Community Member, 75 Posts

27 March 2011 at 8:33pm

Edited: 27/03/2011 10:32pm

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

Forum Moderator, 1799 Posts

28 March 2011 at 1:49am

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