News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Limit smilies per post

Started by Owdy, September 27, 2004, 11:56:40 AM

Previous topic - Next topic

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

[Unknown]

<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]

DeadMetal

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.

Owdy

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

DeadMetal

I did add that string to my (dutch) language  file, but no error shows up.

Owdy

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

DeadMetal

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.)

Owdy

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

DeadMetal

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 :)

[Unknown]

Soon I will release the package SDK, version 1.0.  Hopefully.

-[Unknown]

mcalan2001

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?

Owdy

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

mcalan2001

I have done exactly the same as on RC2, but it just doesn't seem to find the error message.

Owdy

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

[Unknown]

Make sure you've scrolled down and viewed the whole thing.

-[Unknown]

Fanta


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

mcalan2001

Quote from: [Unknown] on January 02, 2005, 09:44:54 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.

Kraig K.

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.


Advertisement: