Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • rich hamilton 117 posts 136 karma points
    Jan 09, 2013 @ 11:34
    rich hamilton
    0

    Do not auto-approve comments

    Comments seem to be automatically approved. How do I change this so that the admin approves them?

     

  • rich hamilton 117 posts 136 karma points
    Jan 10, 2013 @ 15:09
    rich hamilton
    0

    I have added to the NewComment Event Handler, it sends an email, but don't get the ID of the Comment which would be useful to make further changes.

     

  • Tim Geyssens 6420 posts 15053 karma points MVP 2x c-trib
    Jan 10, 2013 @ 15:43
    Tim Geyssens
    0

    Guess you'll have to customize the source for you needs, you can find it here http://ucomment.codeplex.com

  • rich hamilton 117 posts 136 karma points
    Jan 10, 2013 @ 15:44
    rich hamilton
    0

    ok, wanted to check first that I wasn't missing anything, thanks.

  • rich hamilton 117 posts 136 karma points
    Jan 10, 2013 @ 17:37
    rich hamilton
    0

    Strange, because looking at the source code, the ID should be set before, so don't know why it isn't being passed through to OnCommentCreated

  • Tim Geyssens 6420 posts 15053 karma points MVP 2x c-trib
    Jan 10, 2013 @ 17:41
    Tim Geyssens
    0

    Yeah looks like it,time to debug then ;)

  • rich hamilton 117 posts 136 karma points
    Jan 10, 2013 @ 18:07
    rich hamilton
    0

    I am just using

    sender.Id.ToString()

    in

    public void NewComment(Comment sender, EventArgs e)
            {}

    but its coming out as '0'

     

  • rich hamilton 117 posts 136 karma points
    Jan 10, 2013 @ 18:35
    rich hamilton
    0

    I see its this

    line 146:                      c.Id = sqlHelper.ExecuteScalar<int>(..

    it returns null

  • rich hamilton 117 posts 136 karma points
    Jan 10, 2013 @ 18:50
    rich hamilton
    0

    Fixed:

    Need to change this in Cooment.cs:

       c.Id = sqlHelper.ExecuteScalar<int>(
                    @"insert into Comment(mainid,nodeid,name,email,website,comment,spam,created)
                            values(@mainid,@nodeid,@name,@email,@website,@comment,@spam,@created)
                        SELECT CAST(scope_identity() AS int)",
                     sqlHelper.CreateParameter("@mainid", -1),
                    sqlHelper.CreateParameter("@nodeid", c.ParentNodeId),
                    sqlHelper.CreateParameter("@name", c.Name),
                    sqlHelper.CreateParameter("@email", c.Email),
                    sqlHelper.CreateParameter("@website", c.Website),
                    sqlHelper.CreateParameter("@comment", c.CommenText),
                    sqlHelper.CreateParameter("@spam", c.Spam),
                    sqlHelper.CreateParameter("@created", c.Created),
                    sqlHelper.CreateParameter("@approved", c.Approved),
                    sqlHelper.CreateParameter("@thumbsUp", 0),
                    sqlHelper.CreateParameter("@thumbsDown", 0));

Please Sign in or register to post replies

Write your reply to:

Draft