In my forum, users spam alot, I want to limit number of posts of user per 1 days.
E.g: 5 topics /1 day 20 posts/ day per user. Is it possible?
Thanks.
E.g: 5 topics /1 day 20 posts/ day per user. Is it possible?
Thanks.
$(function() {
Ā var perDay = 20,
Ā errorMsg = 'You\'ve reached the maximum number of posts per day.';
Ā
Ā if (localStorage.postExp > +new Date - 24*60*60*1000 && Math.abs(localStorage.postsThen - _userdata.user_posts) >= perDay) $('form[action="/post"] input[type="submit"]').click(function() {alert(errorMsg); return false});
Ā else if (localStorage.postExp === undefined) {
Ā Ā localStorage.postsThen = _userdata.user_posts;
Ā Ā localStorage.postExp = +new Date;
Ā }
})
$(function() {
Ā var perDay = 20,
Ā errorMsg = 'You\'ve reached the maximum number of posts per day.';
Ā
Ā if (localStorage.postExp > +new Date - 24*60*60*1000 && Math.abs(localStorage.postsThen - _userdata.user_posts) >= perDay) $('form[action="/post"] input[type="submit"]').click(function() {alert(errorMsg); return false});
Ā else if (localStorage.postExp === undefined && _userdata.session_logged_in === 1) {
Ā Ā localStorage.postsThen = _userdata.user_posts;
Ā Ā localStorage.postExp = +new Date;
Ā }
})