1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

No Increase In Post Count for Short Posts 1.0a

Posts not reaching the character limit are not counted towards the user's post count.

  1. Chris D

    Chris D XenForo Developer Staff Member

    ragtek likes this.
  2. HoddzDJ

    HoddzDJ Active Member

    Hi Chris. Will this add-on alter current post counts if the posts don't hit the character limit already, or is it just for future posts once the add-on has been installed?
  3. ragtek

    ragtek Guest

    Hm,,,,, sorry i can't resist:

    I wouldn't code it this way:p
    Instead of adding an second query to remove the added +1, you could should set XenForo_DataWriter_Discussion::OPTION_CHANGE_USER_MESSAGE_COUNT to false

    Another reason for this is, if you create an post and the standard dw adds +1 & your addons removes -1 and you delete the post again, you'll lose another post because it's ,...

    so if i make 10 posts and delete them, my new counter will be -20 ;)

    sooo, change it as suggested, OR AT LEAST include an check for isDelete inside of _updateUserMessageCount ;) and don't remove -1 again
    (if it sounds rude, i'm sorry, don't want to criticise anybody, it sounds just so because of my bad english :)
    Chris D likes this.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Just once the add-on has been installed, HoddzDJ.
  5. Chris D

    Chris D XenForo Developer Staff Member

    ragtek, I would never think you sound rude - even if you were being rude, I'd not take offence because I like having the opportunity to learn from experts like you :)

    I tried a few ways to get this working (even before your post) to affect a change to stop it from being counted at all, but I was unsuccessful. That's why I went down the route of the query.

    I have just fixed the double delete issue. I see now that my query to -1 was running on both posts being added and also posts being hidden from view as well.

    My code is now wrapped in:

    if ($this->get('message_state') == 'visible' && $this->getExisting('message_state') != 'visible')
    This makes it only run for new posts.

    Thanks so much for your help.
  6. Chris D

    Chris D XenForo Developer Staff Member

    Elly likes this.
  7. account8226

    account8226 Guest

    What do you mean by only select from nodes, I can't get it working.
    And what will happen if the chars limit is 7 and a user write one letter with spaces for example ?
  8. Chris D

    Chris D XenForo Developer Staff Member

    In the options (Admin CP > Options) you can select which forums you want this to apply to.

    The forums that you select will not allow the post count to be increased if the post is too short.

    A space counts as a character, but the XenForo editor automatically strips out subsequent spaces. T plus 5 spaces plus a full stop (7 characters) will actually simply truncate to "T ." (T plus 1 space plus a full stop) which is 3 characters.

    But it's a pretty bad example, because not many people will make posts like that. But yeah, spaces do count so:

    Hello my name is Chris

    is 12 characters.

    Due to encoding and multibyte characters, it may be the case that letters such as áéíóú count as two characters.
  9. account8226

    account8226 Guest

    Thanks for the awnser Chris, and what will happen for linebreaks ?
  10. Chris D

    Chris D XenForo Developer Staff Member

    I think each line break is counted as one or two characters.

    I can't be entirely sure.
  11. account8226

    account8226 Guest

    Ok thanks you, that still worth it, maybe it will increase the quality of some posts ;)
  12. mistypants

    mistypants Well-Known Member

    First of all, thanks a lot for the add-on. :)

    One of my users has reported a small issue--for posts below the character count (therefore, that do not get the +1 to message count), if they are deleted, the user will still see a -1 to their message count. I tested it and it appears to be true.

    I understand if this takes you a while to fix as I know you've got plenty of other more important projects but I thought I'd notify you! Thanks again.
  13. Liam W

    Liam W Well-Known Member

Share This Page