Advertisement:

Author Topic: Word Count Limits  (Read 20963 times)

Offline ethankcvds

  • Jr. Member
  • **
  • Posts: 312
  • Gender: Male
Word Count Limits
« on: September 08, 2009, 11:53:09 PM »
Link to Mod

Original Mod Author: Arantor 

As requested in http://www.simplemachines.org/community/index.php?topic=332053.0

This allows the admin to set a minimum and/or maximum number of words to be present in a post before allowing it to be accepted, e.g. minimum of 20 words in the post.

* allows both individual minimum and maximum, and 'off' limits - 0 = no limit, up to 10000 on either limit (you can set a maximum of 10,000 words for example)
* discounts numbers entirely
* treats punctuation (except ') as word breaking, e.g. two-worded is treated as two words
* considers words as 3 characters or more
* configurable on a per board level

HTML and BBcode is not considered.


Version history:
1.4 RC - 05 June 2019
Removed 1.1 support
Added 2.1 RC 2 support
Quoted posts no longer included in word count total

1.3b - 11 June 2011
Added 2.0 support
Removed 2.0 RC5 support.

1.3a - 13 February 2011
Added 2.0 RC5 support
Removed 2.0 RC4 support.

1.3 - November 2010
Added 2.0 RC4 support
Removed 2.0 RC3 support.
Added Turkish Translations

1.2 - 9 March 2010
Added 2.0 RC3 support
Removed 2.0 RC 1.2 and 2.0 RC2 support.
Added Russian Translations

1.1 - 1 November 2009
Provided compatibility for older PHP/PCRE combinations
Added 2.0 RC2 support

1.0 - August 31, 2009
First public release

Beta - August 28, 2009
Beta release
« Last Edit: June 11, 2011, 11:56:04 PM by ethankcvds »
No Pm's for support please!

Offline cme1st2302

  • Sophist Member
  • *****
  • Posts: 1,075
  • Gender: Male
    • East Coast Astro
Re: Word Count Limits
« Reply #1 on: September 08, 2009, 11:59:01 PM »
Very cool mod Arantor!!!  This will come in handy!!

Chris
SMF Version: 1.1.11
SimplePortal Version: 2.3.2

Admin

He who waits for perfect conditions sees nothing!!
If you need help adding a button or tab PM me!!

Offline Blinker

  • Full Member
  • ***
  • Posts: 472
  • Gender: Male
Re: Word Count Limits
« Reply #2 on: September 09, 2009, 05:31:51 AM »
Another triumph mate...well done. Keep up the great work.

Offline digit

  • Sophist Member
  • *****
  • Posts: 1,364
  • Gender: Male
Re: Word Count Limits
« Reply #3 on: September 09, 2009, 12:48:03 PM »
Yes.  This is good.  REAL good.  Is there any possibility of setting the number of  characters too?  8)  Keep up the great work.
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Offline ოկtђ

  • Sr. Member
  • ****
  • Posts: 858
  • Gender: Male
  • Burak
Re: Word Count Limits
« Reply #4 on: September 09, 2009, 12:58:14 PM »
This is  good really

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Word Count Limits
« Reply #5 on: September 09, 2009, 02:08:39 PM »
Well... global maximum of character count is already possible; it's a setting in Post Settings, adding a minimum character count wouldn't be impossible - but would likely be the scope of a separate mod to this.
No good deed goes unpunished
All helpful urges should be circumvented

Offline alex30

  • Full Member
  • ***
  • Posts: 605
  • Gender: Male
Re: Word Count Limits
« Reply #6 on: September 11, 2009, 04:58:13 PM »
Great mod Arantor!

What if people have many boards. Can this mod be updated with option that will allow to modify all boards at once?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Word Count Limits
« Reply #7 on: September 11, 2009, 05:04:22 PM »
I suppose it could be but generally you wouldn't apply the same figures to all boards - at least that's not what I thought.

It's easy enough SQL though, and I'm not sure where to put it without giving it its very own page in the admin panel.
No good deed goes unpunished
All helpful urges should be circumvented

Offline SimonSays

  • Newbie
  • *
  • Posts: 7
    • Whedonage
Re: Word Count Limits
« Reply #8 on: September 16, 2009, 12:57:34 PM »
I suppose it could be but generally you wouldn't apply the same figures to all boards - at least that's not what I thought.

It's easy enough SQL though, and I'm not sure where to put it without giving it its very own page in the admin panel.
Allowing a word-limit to be applied to all boards would make sense, which could then be tweaked on a per-board basis. On my site, we have 50+ boards, which makes setting the limit individually tedious. I'd prefer that it could be set all at once.

The appropriate place, it seems to me, for such a setting would be in the "Manage Boards --> Settings" menu (ala, hxxp:www.foo.com/index.php?action=manageboards;sa=settings [nonactive])

Thanks for the cool mod.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Word Count Limits
« Reply #9 on: September 16, 2009, 03:43:07 PM »
It would make sense, but at the same time which takes priority, global or board specific? How do you override at board level, given that you can set a 'no limit' option too at board level?

The only way I can see of doing that is adding a tick box in each board to override the global value.

To be honest I'm not sure I'm going to add this in; I've said elsewhere that I'm not making any more mods, massive enhancement to one mod (which, being honest, this is a fair enhancement) isn't something I personally have much time or energy for.

You can set a default however with SQL:
Code: [Select]
UPDATE smf_boards SET min_words = 1, max_words = 50
Change smf_ to suit your database prefix, set the defaults to values that suit you and you can instantly have a default set right there for all boards.
No good deed goes unpunished
All helpful urges should be circumvented

Offline Jeep29

  • Semi-Newbie
  • *
  • Posts: 32
Re: Word Count Limits
« Reply #10 on: October 12, 2009, 03:28:38 AM »
This is a very good mod !

It is possible to assign it to a group rather than a board


Ps : sorry for my very bad english

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Word Count Limits
« Reply #11 on: October 12, 2009, 04:19:46 AM »
It is possible to assign it to a group rather than a board

Not without a complete rewrite, not really.
No good deed goes unpunished
All helpful urges should be circumvented

Offline javierjp

  • Semi-Newbie
  • *
  • Posts: 81
Re: Word Count Limits
« Reply #12 on: October 16, 2009, 05:35:41 PM »
First at all, great job man!  :)

I installed in a clean smf 1.1.10 installation, set the minimum to 3 and the maximum to 6 (for testing proposes)  but Not worked for me :(

All i get its "there are no enought words in this post" no matter if i write 1, 10 or 30 words, i get the error always! , smf totally ignore both limits.

The only way i found for write a post its using 0 as minimum.

Any idea for solve this?
thanks in advance




Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Word Count Limits
« Reply #13 on: October 16, 2009, 05:37:16 PM »
What words are you using and is there anything in the error log?
No good deed goes unpunished
All helpful urges should be circumvented

Offline javierjp

  • Semi-Newbie
  • *
  • Posts: 81
Re: Word Count Limits
« Reply #14 on: October 16, 2009, 06:12:40 PM »
Error log:

2: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
File: W:\www\smf10\Sources\Post.php
Line: 2468


Im testing in local mode in my own PC, not in a live enviroment.
« Last Edit: October 16, 2009, 06:18:00 PM by javierjp »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Word Count Limits
« Reply #15 on: October 16, 2009, 06:23:33 PM »
What version of PHP are you using? That is the result of an older PHP build normally.

Anyway, it's clear that I need to figure out another way of doing this.
No good deed goes unpunished
All helpful urges should be circumvented

Offline javierjp

  • Semi-Newbie
  • *
  • Posts: 81
Re: Word Count Limits
« Reply #16 on: October 16, 2009, 07:23:32 PM »
php 4.3.6 in local mode.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Word Count Limits
« Reply #17 on: October 16, 2009, 07:26:37 PM »
Yes, that will definitely cause that. I would note that even 4.4 series is now almost 2 years old, and 4.3 is much older.
No good deed goes unpunished
All helpful urges should be circumvented

Offline javierjp

  • Semi-Newbie
  • *
  • Posts: 81
Re: Word Count Limits
« Reply #18 on: October 16, 2009, 07:58:01 PM »
Thanks for all man  ;)
I will forget about local mode and try in my live enviroment (php5)

grettings
Javierjp

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Word Count Limits
« Reply #19 on: October 16, 2009, 08:02:15 PM »
Let me know how that goes. Meantime I'll see if I can find a better solution.
No good deed goes unpunished
All helpful urges should be circumvented