Login  Register

Re: limit on number of posts

Posted by Pedro on Dec 10, 2013; 6:26am
URL: https://support.nabble.com/limit-on-number-of-posts-tp7588514p7588607.html

Please, add this to your naml code:
<override_macro name="topic_html" requires="servlet">
    <n.topic_min_html>
        <head>
            <n.topic_common_head/>
            <n.topic_head/>
            <n.topic_meta/>
            <n.increment_view_count/>
        </head>
        <body>
            <n.page_node.topic_hardcoded_notices/>
            <n.newsflash/>
            <n.topic_header/>
            <n.topic_controls/>
            <n.topic_contents.view_contents.page_node.topic_rows/>
            <n.topic_footer/>
            <n.report_inappropriate_content_panel/>
            <n.user_request/>
        </body>
    </n.topic_min_html>
</override_macro>

<override_macro name="reply_link" requires="node" parameters="title, href">
    <n.set_var. name="href"><n.default text="[n.href/]" to="[n.reply_path/]" /></n.set_var.>
    <a class="reply_link" href="[n.var name='href'/]" title="[n.title/]" rel="nofollow"><t>Reply</t></a>
</override_macro>

<macro name='user_from_get' dot_parameter="do" >
    <n.get_user_from_id. user_id="[n.get_parameter name='user'/]">
        <n.do/>
    </n.get_user_from_id.>    
</macro>
<macro name="user_request">
    <script type="text/javascript">
        var posts_today;
        var path = '/template/NamlServlet.jtp?macro=user_response&user=';
        var url = Nabble.userId;
        $.getScript(path+url+Nabble.getClientID() ,function(data){
        posts_today = data;
        if(posts_today > 2){
        $('.reply_link').css('display','none');
        }
        });   
        
    </script>
</macro>
<macro name="user_response">
    <n.if.user_from_get.is_in_group group="posts" >
        <then>
            <n.user_from_get.node_count filter = "date_part('day',now() - when_created) = 0 "/>
        </then>            
    </n.if.user_from_get.is_in_group>    
</macro>
It limits on 2 posts per day or users in "posts" group. You should also create these group.
My test forum.