1

I have a strange scenario where I have a news Component created in Publication 3 and I have referred to this parent item from another Publication (ID 10).

Now when I added a comment through the CMS, I added them from Publication 3 and it got stored in the UGC DB with Publication ID 3.

The Component however is published and a DCP is generated from the Publication with ID 10 and so the UGC code generated refers to tcm:10-4952. Since there are no comments saved with ID 10, the DCP returns no output.

How can I fetch all the comments for that Component (referred, it is not localized)?

1

If you wish to manage your comments on your content level (Publication 3) you will have to do some customization here, since the UGC auto generated code indeed does not consider BluePrinting to this level.

So rather than using the generated code, you can simply add the tags manually with the correct Publication ID considering your BluePrint, so something like:

<ugc:Comments itemURI="tcm:3-4952">                    
  ...
    <input type="hidden" name="commentIdtcm:3-4952" value=""/>
      <textarea rows="4" cols="30" name="editCommenttcm:10-4952"></textarea><br/>
      <input type="submit" value="Save comment"/>
  ...
</ugc:Comments>

You could also use the TCDL tags <tcdl:Comments> in your templates, as long as you make sure they are transformed to the tags. But the main idea is that you bring in the knowledge of your BluePrint yourself.

Through this way you could even add comments from multiple Publications in, in the case you want to display all comments from all languages for example.

  • Thanks Bart. In the C# code I have manually added the itemURI to pick the comments for publication 3. I had one doubt. "Through this way you could even add comments from multiple Publications in, in the case you want to display all comments from all languages for example." Here again this is possible provided they are referring to the parent publication and not local copies, right? In case of multiple languages, the content would be a local copy. So the comments will be separate for the two contents. – user858 Jan 22 '14 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.