We plan to develops blogs using Kentico.
One of the feature we are providing in the Blog page is subscribing to the blog.
The subscribed user then gets email when new post is published
Right now I only see that Kentico provides subscribe to blog post and when new comments are added the user gets emails on the new comment added.
We tried getting the webpart ContentSuscbription working but unfortunately we are using Base version of the CMS and Notification module is not available.
Has anyone come across such a scenario , if so how did you get email subscription working.
For now what I have attempted to trigger an issue when new blog post is added.
This is done with the help of CMSModuleLoader with which we can manipulate DocumentEvents. If the document is in published step and a Blog post a new issue is generated in the Dynamic Newsletter which user has subscribed.
This piece of code does rest of the JOB
// Get dynamic newsletter
InfoDataSet<Newsletter> newsletter =
NewsletterProvider.GetNewsletters("NewsletterName = '" + newsLetterName + "'", "", 1, "NewsletterID");
if (newsletter.Items != null && newsletter.Items.Count > 0)
{
try
{
int newsletterId =
ValidationHelper.GetInteger(
DataHelper.GetDataRowValue(newsletter.Tables[0].Rows[0], "NewsletterID"), 0);
int issueId = EmailQueueManager.GenerateDynamicIssue(newsletterId);
if (issueId > 0)
{
Issue issue = IssueProvider.GetIssue(issueId);
if (issue != null)
{
issue.IssueText = body;
issue.IssueSubject = "New Blog Post!";
}
//Generate emails to be send
EmailQueueManager.GenerateEmails(issueId);
//Send all emails
EmailQueueManager.SendAllEmails(false);
}
}
catch (Exception ex)
{
}
}