User generated content using second web database, how to work with in CMS?


I am attempting to store User Generated Content in a second web databased (renamed ugc).  The database has been added, I have added the appropriate connection strings and when in the CMS you can choose UGC to view that content.  I have also created the template to store the content (in this case a comment for a blog post) and the C# code is correctly writing to this database.   I can also publish this content to the true Web database so that I can access it and display it on the page. I did it this way to prevent writing directly to the master database for security reasons and also because we are requiring a review of the comment and approval before it is posted.

When I am in the CMS I can switch to the UGC and see the comments which I have created in a second root called UserGeneratedContent outside of the main website root to keep things clean.  What I'm wondering is, is there a way to view the master content and the ugc content at the same time? At this point a standard user cannot switch databases and view the UGC database in order to approve and publish the content. I was following a method I found online however, the override they were doing to show both databases at the same time was using a method that is listed as Obsolete and thus I don't want to use it even if it does work.  

Has anyone run into this and what was the best solution? Perhaps I'm just missing something in the process that would make this work correctly.

Thanks and appreciate the guidance.

  • Hi Mike,

    If I understand your scenario correct, you want to have moderation to the comments of the blog post you have in Sitecore. I will just give your different solution here.

    The template you created for comments can have one more field "Show On Website", so when the user submits the comment, this field will be unchecked. Once your author validates the comment and is okay to display on Frontend then s/he can check this field. In your MVC view you will have a logic to check this field value to display the comments.

    If the above logic is implemented, then you dont need the additional db (ugc).

    Second scenario to see the data of Master DB and comments together, you can create a new publishing target with Target Database as "master". And create a scheduler to pass the comments from Web DB to Master DB in specific intervals.

    So when the Authors login to Sitecore Interface, they will be able to see the Master content and the user generated comments in one place.

    Hope this helps. In case I have confused you, we always connect to discuss it further.
  • In reply to Rohan Kenkre:

    Hi Rohan,

    Yes, you are exactly correct. The first part I have and that field (Show on Website, or a similar name) is part of my template. I will have a check for that in my code to make sure that the comment has been approved.

    In reading about utilizing the master database for user generated content (ugc), I've been trying to be careful about security which is why I am not writing directly to the master db from the production environment. Question, if I create another publishing target and the scheduler to "publish" that content to the master db, would I be opening any security holes? My guess is that since this would not be executed on the web db and would be done inside the CMS that it would not.

    This is an interesting way to handle this that I had not considered.

    Thanks so much for your response, I really appreciate it.
  • In reply to Mike Brodeur:

    Hi Mike,

    There won't be any security holes that will be generated from this logic. I had implemented such logic in past for a similar request.

    Hope it helps you too. :)
  • In reply to Rohan Kenkre:

    Hi Rohan,

    I was able to do this successfully so thank you for the information. I'm running into one issue with migrating my local UGC (web clone) db into Azure but locally I have everything working as it should. Once I got going down this route it really wasn't too bad.
  • In reply to Mike Brodeur:

    Glad I could help!!!

    Ya I saw another thread with the last hurdle you are stuck into. Let me check if I can get something for you!

    I will reply on the other thread in case I get anything on it!