The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

How to limit number of posts per user a day?

View previous topic View next topic Go down

Solved How to limit number of posts per user a day?

Post by th4nhc0n9 on October 12th 2014, 2:29 pm

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.

th4nhc0n9
Forumember

Male Posts : 157
Reputation : 3
Language : Vietnam

http://vnbeauties.com

Back to top Go down

Solved Re: How to limit number of posts per user a day?

Post by Base on October 12th 2014, 2:33 pm

Hello,

As far as I know, it is not possible to limit how many times a user can post in one day.

Base
Forumaster

Male Posts : 10386
Reputation : 1687
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

Solved Re: How to limit number of posts per user a day?

Post by APE on October 12th 2014, 3:06 pm

Sorry this can not be done.

APE




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: How to limit number of posts per user a day?

Post by th4nhc0n9 on October 12th 2014, 5:01 pm

I hope it is possible to do by js or css. Away, thank for your info.

th4nhc0n9
Forumember

Male Posts : 157
Reputation : 3
Language : Vietnam

http://vnbeauties.com

Back to top Go down

Solved Re: How to limit number of posts per user a day?

Post by Ange Tuteur on October 12th 2014, 5:50 pm

Hello,

Yes, it's possible by JavaScript, but it can be bypassed if you disable it. Try this :
Administration Panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In all the pages
Paste the code below :
Code:
$(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;
 }
})

At the top are two variables you can modify :
perDay : The amount of posts a user can post a day. ( counted from the time they visit the forum )
errorMsg : The message displayed when they try to post, but have reached the limit.

Just to let you know, this can be bypassed if :
* Member is using an outdated browser
* Member disabled JavaScript
* Member has cleared their browser cache

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How to limit number of posts per user a day?

Post by th4nhc0n9 on October 12th 2014, 8:25 pm

It is OK. Thank U very much!

th4nhc0n9
Forumember

Male Posts : 157
Reputation : 3
Language : Vietnam

http://vnbeauties.com

Back to top Go down

Solved Re: How to limit number of posts per user a day?

Post by Ange Tuteur on October 12th 2014, 11:28 pm

You're welcome,

I may have made a small mistake in my previous post. However, If you notice anything wrong, try replacing it by this script :
Code:
$(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;
 }
})

Topic archived

If you have any trouble feel free to open a new topic. Smile

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum