Somewhere in this code the number of Comments is counted?

Hello,

Somewhere in this code the number of Comments is counted, and restricted according to the Admin setting of X amount of comments allowed per day.

I would like to know what piece or pieces of code are used to count the number of Comment submissions.

Because I would like to add this Comments control code to the Blog Entry code to also control the number of Blog Entries that can be submitted per day.

All help appreciated :smile:

<!-- IF entry_allow_comments AND session.can_view_all_blogs_comments -->

                <div class="comments page_member_blogs_comments">

                    <div class="subtitle">
                        <h2>{lang:"member","comments_list"}</h2>
                        <div class="progress" id="get_comments_progress"></div>
                    </div>
                    <div id="comments_page">
                        {comments:type="blog",member_id=member_id,content_id=entry_id}
                    </div>

                    <div class="commentsform page_member_blogs_comments_submit">
                        <div class="dataitem single">
                            <div class="form">
                                <form name="edit" method="post" action="">
                                    <div class="fieldset">
                                        <dl class="fieldset">
                                            <dt><label for="field_comment_body">{lang:"member","add_comment"}</label></dt>
                                            <dd><textarea class="text text_small" id="field_comment_body" onKeyDown="limitText(this,248);" cols="80" rows="4" name="body">{comment_body}</textarea></dd>
                                            <span id='show' style="font-size:12px "></span>
                                            <!-- IF settings.blogs_comments_captcha -->
                                                <dt><label for="field_captcha">{lang:"member","verify_number"}</label></dt>
                                                <dd>
                                                    <input type="text" id="field_captcha" class="text captcha" name="captcha" maxlength="5" />
                                                    <img src="{virtual_path}includes/fns/fns.captcha.php" alt="" border="0" class="captcha" /><div class="clear"></div>
                                                </dd>
                                            <!-- ENDIF -->
                                            <dd class="submit"><input class="submit" type="submit" name="submit" value="{lang:"member","submit"}" /></dd>
                                        </dl>
                                    </div>
                                    <input type="hidden" name="iscomment" value="1" />
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clear"></div>

You might need to give a bit more background to this, as you’ve mainly posted HTML, which doesn’t do anything like that. There are some hooks in there, presumably for a JS framework, but even so, there’s nothing in there that will do anything without the rest of the JS.

Hello ralpm, thank you for your reply, my knowledge is small, yet I will try to give you more useful info.

These is my steps of investigation.

In Admin the code that limits the Comment number is:

array('label' => 'can_add_blog_comments_delay', 'type' => 'number'),

So I did a search through the website code for: an_add_blog_comments_delay

and found:

//------------------------------------------------
    // Check settings
    //------------------------------------------------
    $SESSION->conf['settings'] = get_members_conf($SESSION->conf['member_id']);
    if ($SESSION->conf['settings']['last_blog_comment_num'] >= $SESSION->conf['can_add_blog_comments_delay']  &&
        date("Ymd", $SESSION->conf['settings']['last_blog_comment_time']) == date("Ymd", time()))
    {
        $TEMPLATE->set_message("error", str_replace("%max%", $SESSION->conf['settings']['last_blog_comment_num'], ($LANG['member']['cant_comment_delay'])), 0, 0);
        return;
    }

Hello, was the information I provided able to help in determining the code?

"I would like to know what piece or pieces of code are used to count the number of Comment submissions.

Because I would like to add this Comments control code to the Blog
Entry code to also control the number of Blog Entries that can be
submitted per day."

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.