+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Notification of Blog Comment

Notification of Blog Comment

13 posts, 0 answered
  1. Steve
    Steve avatar
    31 posts
    Registered:
    03 May 2011
    18 Nov 2011
    Link to this post
    Is there a way for Sitefinity to send an email notification out when a comment is posted to a blog entry?
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    19 Nov 2011
    Link to this post
    Sadly no...a notification system should be in early 2012...I've been pestering them for that one for a while

    Sorry :/

    The only thing we have right now is a marketplace addon which adds FORM submission notifications.
  3. Gary
    Gary avatar
    7 posts
    Registered:
    22 Dec 2010
    21 Feb 2012
    Link to this post
    Is this part of Sitefinity yet?

    Thanks,
    Gary
  4. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    08 Dec 2016
    23 Feb 2012
    Link to this post
    Hello,

    It is not available out of the box, but can be done with this customization.
    Create a class in your solution and crete a custom comment class as in the sample below.

     For blog comments:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Net.Mail;
    using Telerik.Sitefinity.Configuration;
    using Telerik.Sitefinity.Services;
    using System.Text;
    using Telerik.Sitefinity.Web.Mail;
    using System.ComponentModel;
      
    namespace SitefinityWebApp
    {
        public class CustomComments : Telerik.Sitefinity.Modules.GenericContent.Web.UI.Views.CommentsDetailsView
        {
            protected override void SubmitComment()
            {
                base.SubmitComment();
                var smtpSettings = Config.Get<SystemConfig>().SmtpSettings;
                MailMessage message = new MailMessage();
                message.From = new MailAddress(smtpSettings.DefaultSenderEmailAddress);
                message.To.Add(new MailAddress("stanislav.velikov@telerik.com"));
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("You have one new form response on  form. The response is sent from IP address");
                message.Subject = "Forms notification";
                message.Body = sb.ToString();
                message.IsBodyHtml = true;
                message.BodyEncoding = Encoding.Unicode;
                message.SubjectEncoding = Encoding.Unicode;
                EmailSender.Get().Send(message);
            }
        }
    }

    Go to Administration->Settings->Advanced->ContentView->Controls->BlogCommentsFrontend->Views->CommentsDetailView-> find the textbox ViewType and enter in it the namespace.class of the class created (in my case SitefinityWebApp.CustomComments ).
    This will send email for  blog comments only. Following the same pattern the same class can be used to send comments for news, events

    To receive the e-mail you mut have valid SMTP settings configured in Administration->Settings->Advanced->System->SMTP

    Regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. MARI
    MARI avatar
    17 posts
    Registered:
    31 Aug 2011
    15 May 2012
    Link to this post
    Hi Stanislav Velikov,

    While posting a comment the event get fired, but unfortunately i am not able to get the "Commented" information ex:(Name,Email,Comment Text). I need to send a mail with Commented information. Can u please help me around this?


    Thanks
  6. MARI
    MARI avatar
    17 posts
    Registered:
    31 Aug 2011
    16 May 2012
    Link to this post
    Hi Stanislav Velikov,

    At the time of submittion,  the "Comment" form not get validated. After the event fires on server side the validation get fired. Is this a bug?
  7. Nick
    Nick avatar
    113 posts
    Registered:
    21 Oct 2008
    26 Jun 2012
    Link to this post
    Hi Mari,

    Did you work out how to get the content of the form (name, email, comments)? If so can you share the code please?

    (or failing that can anyone help?)

    thanks
    Pete
  8. Nidhi
    Nidhi avatar
    40 posts
    Registered:
    20 Jul 2010
    14 May 2013
    Link to this post
    This should retrieve the content of the form
    protected override void SubmitComment()
    {
            var content = this.ContentControl.Value.ToString();
            var authorName = this.Page.Server.HtmlEncode(this.AuthorNameControl.Value.ToString());          
            base.SubmitComment();
                
     }

    - Nidhi
  9. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    08 Dec 2016
    14 May 2013
    Link to this post
    Hi,

    A better solution is to subscribe to sitefinity event when a comment has been created (here is the documentation for comments events) the submitted comment data is in the event arguments for the event.

    Greetings,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Chris Aybar
    Chris Aybar avatar
    25 posts
    Registered:
    20 Oct 2008
    17 Oct 2013 in reply to Stanislav Velikov
    Link to this post
    What's the best place to subscribe to this event, global.asax.cs, under Application_Start()?

    For example:
    Telerik.Sitefinity.Services.EventHub.Subscribe<Telerik.Sitefinity.Modules.GenericContent.Events.ICommentCreatingEvent>(evt => MySampleCommentNotificationMethod(evt));

    ???
  11. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    08 Dec 2016
    22 Oct 2013
    Link to this post
    Hello,

    Yes this way the event subscription will be registered every time the application starts, here is a sample
    protected void Application_Start(object sender, EventArgs e)
    {
        Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
    }
    void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
    {
        EventHub.Subscribe<IDynamicContentUpdatedEvent>(evt => UpdatedEventHandler(evt));
          
        EventHub.Subscribe<IDynamicContentCreatedEvent>(evt => CreatedEventHandler(evt));
    }
    public void CreatedEventHandler(IDynamicContentCreatedEvent eventInfo)
    {
        var userId = eventInfo.UserId;
        var creationDate = eventInfo.CreationDate;
        var dynamicContentItem = eventInfo.Item;
        var visible = eventInfo.Visible;
     
        //Your email logic upon item dynamic item creation.
    }
    public void UpdatedEventHandler(IDynamicContentUpdatedEvent eventInfo)
    {
        var userId = eventInfo.UserId;
        var modificationDate = eventInfo.ModificationDate;
        var dynamicContentItem = eventInfo.Item;
        var visible = eventInfo.Visible;
     
        //Your email logic upon item dynamic item update.
    }


    Regards,
    Stanislav Velikov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  12. Chris Aybar
    Chris Aybar avatar
    25 posts
    Registered:
    20 Oct 2008
    22 Oct 2013 in reply to Stanislav Velikov
    Link to this post
    Thanks for the reply. I think, however, I'm interested in seeing how this could be achieved with regular comment events, i.e., ICommentCreatingEvent.  We're unable to intercept/handle this event.

    For example, we're trying to handle the ICommentCreatingEvent for comments that are created again blog posts in order to send an email notification.
  13. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    08 Dec 2016
    25 Oct 2013
    Link to this post
    Hello,

    If you are using sitefintiy 6.1 I indicate a problem executing comment events, those are executed with success in sitefintiy 6.2.

    Regards,
    Stanislav Velikov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
13 posts, 0 answered