Limit the number of responses to specific members Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
4 posters

    Limit the number of responses to specific members

    Milouze14
    Milouze14
    Forumember


    Male Posts : 59
    Reputation : 18
    Language : French
    Location : Vendée

    Solved Limit the number of responses to specific members

    Post by Milouze14 November 11th 2015, 8:02 pm

    Hi to all of you,
    I would like to block the number of responses (20) to specific members per day,
    and this on all pages of the forum.
    Thank you in advance.

    a++


    Last edited by Milouze14 on November 18th 2015, 4:57 pm; edited 1 time in total
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51497
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Limit the number of responses to specific members

    Post by SLGray November 11th 2015, 8:43 pm

    What exactly do you mean by block responses to a certain member? Do you mean the profile wall?



    Limit the number of responses to specific members Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Milouze14
    Milouze14
    Forumember


    Male Posts : 59
    Reputation : 18
    Language : French
    Location : Vendée

    Solved Re: Limit the number of responses to specific members

    Post by Milouze14 November 12th 2015, 3:46 am

    Hi SLGray,

    sorry for my language, I am French and my English is can not be explicit.

    I would like to block the number of responses to certain members and this day on every page of the forum, is it possible please?
    Arrived at the 21 th answer: answer button and a message appears disparraisse indicating a defined text.
    Thank you in advance.

    a++
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51497
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Limit the number of responses to specific members

    Post by SLGray November 12th 2015, 4:05 am

    Have you tired to get help from the official French support forum: http://forum.forumactif.com/ ?




    Limit the number of responses to specific members Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Milouze14
    Milouze14
    Forumember


    Male Posts : 59
    Reputation : 18
    Language : French
    Location : Vendée

    Solved Re: Limit the number of responses to specific members

    Post by Milouze14 November 12th 2015, 4:09 am


    Not because it has no answer most of the time here
    and Ange Tuteur and remarkable in this kind of question Wink .
    Thank you
    a++
    Michael_vx
    Michael_vx
    Forumember


    Male Posts : 659
    Reputation : 29
    Language : Arabic and some English
    Location : Egypt

    Solved Re: Limit the number of responses to specific members

    Post by Michael_vx November 13th 2015, 7:00 pm

    let me see if i understand the request
    you want to set a limit like if user viewed more then 20 page peer a day he should see that he is off limit or something like that
    am i right ?
    i hope if my guessing right that would be clear to the staff so they think about the answer
    Milouze14
    Milouze14
    Forumember


    Male Posts : 59
    Reputation : 18
    Language : French
    Location : Vendée

    Solved Re: Limit the number of responses to specific members

    Post by Milouze14 November 13th 2015, 7:05 pm

    Hi, I would not have a lock on some members who display too much message.
    but I'll wait Ange Tuteur, as I understand it also helps the French media time to time.
    Thank you.
    a++


    Last edited by Milouze14 on November 13th 2015, 7:08 pm; edited 1 time in total
    Michael_vx
    Michael_vx
    Forumember


    Male Posts : 659
    Reputation : 29
    Language : Arabic and some English
    Location : Egypt

    Solved Re: Limit the number of responses to specific members

    Post by Michael_vx November 13th 2015, 7:07 pm

    i see
    will ill be also waiting the answer i hope its a good news
    sorry for not helping
    im not good in coding
    Milouze14
    Milouze14
    Forumember


    Male Posts : 59
    Reputation : 18
    Language : French
    Location : Vendée

    Solved Re: Limit the number of responses to specific members

    Post by Milouze14 November 16th 2015, 3:42 am

    Hi to all of you,
    I go up the subject.
    Thank you in advance.
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Limit the number of responses to specific members

    Post by Ange Tuteur November 17th 2015, 12:48 pm

    Hi @Milouze14,

    It's possible, however, it can also be bypassed as the solution would be with JavaScript. Try adding the following script in all the pages :
    Code:
    $(function() {
      var storage = window.localStorage;

      if (storage && (!storage.post_count || +storage.post_count_exp > +new Date - 24*60*60*1000)) {
        storage.post_count = _userdata.user_posts;
        storage.post_count_exp = +new Date;
      }

      $('form[name="post"]').submit(function() {
        var storage = window.localStorage;

        if (storage && (+storage.post_count - _userdata.user_posts) > 20) {
          alert('You have reached the maximum number of posts for today.');
          return false;
        }
      });
    });

    It should prevent the post from being submitted once the limit has been reached. ( 20 )

    If any questions let me know. Smile

    P.S.
    Sorry for the late reply. I've been ill, but I'm slowly getting better.
    Milouze14
    Milouze14
    Forumember


    Male Posts : 59
    Reputation : 18
    Language : French
    Location : Vendée

    Solved Re: Limit the number of responses to specific members

    Post by Milouze14 November 17th 2015, 3:37 pm

    I Ange Tuteur Hello ,

    First of all thank you very much, sorry I bothered if you are suffering,
    the script does not work on my tests forums !!
    Take your time because I'm in no hurry.
    Get Well my friend Wink .

    a++
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Limit the number of responses to specific members

    Post by Ange Tuteur November 17th 2015, 9:22 pm

    Oops, I made a small mistake. Try now :
    Code:
    $(function() {
      var storage = window.localStorage;
     
      if (_userdata.session_logged_in && storage) {
        if (!storage.post_count || +storage.post_count_exp < +new Date - 24*60*60*1000) {
          storage.post_count = _userdata.user_posts;
          storage.post_count_exp = +new Date;
        }
     
        $('form[name="post"]').submit(function(e) {
          var storage = window.localStorage;

          if (storage && Math.abs(+storage.post_count - _userdata.user_posts) > 20) {
            alert('You have reached the maximum number of posts for today.');
            e.preventDefault();
          }
        });
      } else if (storage) {
        storage.removeItem('post_count');
        storage.removeItem('post_count_exp');
      }
    });

    If you need to test, you can change the post limit by modifying the
    Code:
    20
    . Since we use greater than ( > ), the posts must be greater than 20 for the alert message to display.

    Code:
    24*60*60*1000
    is the duration of time that the post count is stored.

    Note however, that this can be bypassed by disabling JavaScript or clearing the browser cache. I'm not sure, but the way I have it setup may also cause logging out to do the same. Think
    Milouze14
    Milouze14
    Forumember


    Male Posts : 59
    Reputation : 18
    Language : French
    Location : Vendée

    Solved Re: Limit the number of responses to specific members

    Post by Milouze14 November 18th 2015, 3:52 am

    Hi Ange Tuteur,

    It's not even my good friend, I have the alert that fires right after dropping the script by having emptied my browser cache.
    ok thank you, one more quick question on the duration of storage,
    Can you explain the operation please do

    Code:
    24*60*60*1000


    Thank you for your patience

    a++
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Limit the number of responses to specific members

    Post by Ange Tuteur November 18th 2015, 3:03 pm

    I found a better way to set it up, so replace the script with this :
    Code:
    $(function() {
      var storage = window.localStorage;
     
      if (_userdata.session_logged_in && storage) {
        if (!storage['post_count_' + _userdata.username] || +storage['post_count_' + _userdata.username + '_exp'] < +new Date - 24*60*60*1000) {
          storage['post_count_' + _userdata.username] = _userdata.user_posts;
          storage['post_count_' + _userdata.username + '_exp'] = +new Date;
        }
     
        $('form[name="post"]').submit(function(e) {
          var storage = window.localStorage;
     
          if (storage && Math.abs(+storage['post_count_' + _userdata.username] - _userdata.user_posts) > 20) {
            alert('You have reached the maximum number of posts for today.');
            e.preventDefault();
          }
        });
      }
    });

    This will add a storage item for a specific user. For example, "User A" has reached the limit and cannot post anymore, but your "User B" account can still post. Logging out will no longer remove the post limit for individual accounts, unless the duration is exceeded, then the post count is reset. You can of course still bypass this with clearing your cache, etc.. but it should be better than before.

    Code:
    24*60*60*1000
    is the amount of time until the user's post limit is reset. It is :
    Code:
    HH * MM * SS * MS
    ( 24 hours, 60 minutes, 60 seconds, 1000 milliseconds )
    Milouze14
    Milouze14
    Forumember


    Male Posts : 59
    Reputation : 18
    Language : French
    Location : Vendée

    Solved Re: Limit the number of responses to specific members

    Post by Milouze14 November 18th 2015, 4:57 pm

    what to say !!!!
    A big thank you my friend.
    I modified the alert message on the body :

    Code:

    $(function() {
              var storage = window.localStorage;
           
              if (_userdata.session_logged_in && storage) {
                if (!storage['post_count_' + _userdata.username] || +storage['post_count_' + _userdata.username + '_exp'] < +new Date - 24*60*60*1000) {
                  storage['post_count_' + _userdata.username] = _userdata.user_posts;
                  storage['post_count_' + _userdata.username + '_exp'] = +new Date;
                }
           
                $('form[name="post"]').submit(function(e) {
                  var storage = window.localStorage;
           
                  if (storage && Math.abs(+storage['post_count_' + _userdata.username] - _userdata.user_posts) > 2) {
                    $('body').append('<div id="M14_Alerte_PostMax">You have reached the maximum number of posts for today.</div>');
                    e.preventDefault();
                  }
                });
              }
            });




    and the stylesheet

    Code:

    #M14_Alerte_PostMax
    {
    position:fixed;
    top:30%;
    left:30%;
    width:40%;
    height:50px;
    text-align:center;
    color:white;
    background:red;
    padding:10px;
    border:5px solid white ;
    z-index:999;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
     
    }



    Get well soon and thank you again for your dedication.

    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Limit the number of responses to specific members

    Post by Ange Tuteur November 18th 2015, 6:01 pm

    You're welcome ! ^^

    Topic archived

    Thanks, and have a good day. Smile