Advertisement:

Author Topic: Limit smilies per post  (Read 59389 times)

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,590
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Limit smilies per post
« on: September 27, 2004, 11:56:40 AM »
« Last Edit: July 15, 2010, 09:20:12 AM by Owdy »
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Limit smilies per post
« Reply #1 on: September 27, 2004, 05:29:50 PM »
Code: [Select]
<edit file>
Sources/Post.php
</edit file>

<search for>
$post_errors[] = 'long_message';
</search for>

<add after>
if (isset($_POST['message']))
{
$smileyLimit = 3;

$prev = substr_count($_POST['message'], '[img') + substr_count($_POST['message'], '[IMG');
$tempmsg = doUBBC($_POST['message'], true);
if (substr_count($tempmsg, '<img') > ($prev + $smileyLimit))
$post_errors[] = 'smiley_limit';
}
</add after>

<edit file>
Themes/default/languages/Post.english.php
</edit file>

<search for>
?>
</search for>

<add before>
$txt['error_smiley_limit'] = 'You can ad x smilies per post. Remove some smilyes and try again.';
</add before>

-[Unknown]

Offline DeadMetal

  • Jr. Member
  • **
  • Posts: 122
  • Gender: Male
Re: Limit smilies per post
« Reply #2 on: October 25, 2004, 12:04:10 PM »
Unfortunately it doesn't work at my forum. It correctly checks the number of smileys but does not show an error message when the message exeeds the limit.

My forum is dutch (I don't have english language files installed), so added the $txt phrase to Post.dutch.php
Using SMF RC2.

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,590
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Limit smilies per post
« Reply #3 on: October 25, 2004, 12:16:50 PM »
Yes, it wont show any errors unless you dont ad that lang string to your lang file.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline DeadMetal

  • Jr. Member
  • **
  • Posts: 122
  • Gender: Male
Re: Limit smilies per post
« Reply #4 on: October 25, 2004, 12:38:58 PM »
I did add that string to my (dutch) language  file, but no error shows up.

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,590
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Limit smilies per post
« Reply #5 on: October 25, 2004, 12:46:00 PM »
Test account? Url? :) Does it work with english?
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline DeadMetal

  • Jr. Member
  • **
  • Posts: 122
  • Gender: Male
Re: Limit smilies per post
« Reply #6 on: October 25, 2004, 02:21:04 PM »
I found the solution. I was running RC2 for Charter members and upgrading to the public RC2 solved the problem. I thought both versions were the same, but it seems that they are not.

Allright, it works great now, thanks.
I manually edited the files, is there a way to automate it, because of the format used? (<add before>  etc.)

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,590
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Limit smilies per post
« Reply #7 on: October 25, 2004, 02:23:37 PM »
It should work fine from beta6.

You can make mod from it to automate. I have made mod all my hackcs, so upgrade is easyer :)
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline DeadMetal

  • Jr. Member
  • **
  • Posts: 122
  • Gender: Male
Re: Limit smilies per post
« Reply #8 on: October 27, 2004, 03:46:06 AM »
The charter member RC2 version didn't show me errors at all (no error when no subject entered for example), so it's not the fault of this mod, but was perhaps a forum bug. It works great on the public RC2.

I searched the forum but couldn't fine any information about it: how can I create mods myself? The idea of making mods of all the hacks is great :)

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Limit smilies per post
« Reply #9 on: October 27, 2004, 05:07:16 AM »
Soon I will release the package SDK, version 1.0.  Hopefully.

-[Unknown]

Offline mcalan2001

  • Jr. Member
  • **
  • Posts: 102
  • Gender: Male
  • I've found a likeness
Re: Limit smilies per post
« Reply #10 on: January 02, 2005, 07:18:44 AM »
Help please.

On release RC2 I had worked out that the error message should be in Errors.english.php and it worked fine.

However in Final, the limit works, but I don't get an error message again.

Has there been a change in the way these messages are handled?

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,590
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Limit smilies per post
« Reply #11 on: January 02, 2005, 09:31:06 AM »
It works just fine in my forum. Have you done this?

<edit file>
Themes/default/languages/Post.english.php
</edit file>
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline mcalan2001

  • Jr. Member
  • **
  • Posts: 102
  • Gender: Male
  • I've found a likeness
Re: Limit smilies per post
« Reply #12 on: January 02, 2005, 10:54:58 AM »
I have done exactly the same as on RC2, but it just doesn't seem to find the error message.

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,590
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Limit smilies per post
« Reply #13 on: January 02, 2005, 10:56:37 AM »
I use code what [Unknown] posted, and it works. I have no idea why it wont work for you.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Limit smilies per post
« Reply #14 on: January 02, 2005, 09:44:54 PM »
Make sure you've scrolled down and viewed the whole thing.

-[Unknown]

Offline Fanta

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
    • Potty For Potter
Re: Limit smilies per post
« Reply #15 on: January 04, 2005, 10:34:34 AM »
Where do I put that code?

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,590
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Limit smilies per post
« Reply #16 on: January 04, 2005, 01:54:24 PM »
Look what code says ;)
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline mcalan2001

  • Jr. Member
  • **
  • Posts: 102
  • Gender: Male
  • I've found a likeness
Re: Limit smilies per post
« Reply #17 on: March 04, 2005, 12:39:17 PM »
Make sure you've scrolled down and viewed the whole thing.
-[Unknown]

Found it  :D

At some point around RC2, it seems that the messages directory changed names, from 'Languages' to 'languages'. So I have both on my server.
Guess which one I edited.
The wrong one.

Offline Kraig K.

  • Semi-Newbie
  • *
  • Posts: 23
Re: Limit smilies per post
« Reply #18 on: April 08, 2005, 09:15:18 AM »
In addition to this mod, how about being able to limit the consecutive use of the same smiley?
i.e. only being able to put  :) :) :) say once or twice.

Offline Kraig K.

  • Semi-Newbie
  • *
  • Posts: 23
Re: Limit smilies per post
« Reply #19 on: April 27, 2005, 10:32:12 AM »
??