You could add a new attribute (that is an EPiServer community attribute) to the Poll class of type Blog. Then create a new module with module dependencies for the Poll- and Blog-modules. In your module you add a listener for the PollAdded-event on PollHandler in which you create a new Blog and assign it to the comment attribute of the newly created Poll.
This way all new Polls will have their own blog which can be accessed via GetAttributeValue (you might want to abstract the access by creating an extension method or by inheriting Poll and wrapping the attribute in a property). Each comment can then be an entry in the Polls blog.
Hope this helps. If my above explanation is a bit tricky to follow let me know and I can give you some code examples, given that I find some time :)
To add a blog to all new polls create a module like this:
using System;
using System.Web;
using EPiServer.Common;
using EPiServer.Community.Blog;
using EPiServer.Community.Poll;
namespace EPiServer.Templates.RelatePlus.HttpModules
{
public class PollCommentsModule : IHttpModule
{
private static bool _communityStarted;
private static readonly Object _lockObject = new Object();
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.EndRequest += new EventHandler(EndRequest);
}
private static void EndRequest(object sender, EventArgs e)
{
if (_communityStarted)
{
return;
}
lock (_lockObject)
{
if (_communityStarted)
{
return;
}
PollHandler.PollAdded += (s, args) =>
{
Poll poll = (Poll)args.Object;
string blogName = string.Format("Comments blog for poll with ID {0}", poll.ID);
Blog blog = new Blog(blogName);
blog = BlogHandler.AddBlog(blog);
poll.SetAttributeValue("CommentsBlog", blog);
PollHandler.UpdatePoll(poll);
};
_communityStarted = true;
}
}
}
}
You can then retrieve the Blog by using:
Blog commentsBlog = poll.GetAttributeValue("CommentsBlog");
I need the users to be able to comment on a poll. I cant find a way to do this.
Any good ideas?