News:

Wondering if this will always be free?  See why free is better.

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.


Mike Frith

thanks the code works great... thanks guys

dtm.exe

I find this to be useful, especially for the users on my forum ;).

-Dan The Man

Mike Frith

yeah definatly... nice and simple to do as well... didnt take too long

Reinno

I know this topic is kinda old so sorry for posting but with the next SMF release soon to come and blah blah...  :P

Ok, what I wanted to suggest was whether it would be possible to implement this great feature into SMF before the 1.1 Final release? Just thought I wanted to add my two cents here. This is a great mod.

JayBachatero

At this moment all feature additions have been stopped and its bug checking/code cleaning time.  Maybe it will make it to 1.2/2.0.

-JayBachatero
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Jay T

Not working. Here is my section of the post.php code.

elseif (!empty($modSettings['max_messageLength']) && strlen($_POST['message']) > $modSettings['max_messageLength'])
{
$post_errors[] = 'long_message';
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';
}
unset($_POST['message']);

Owdy

#26
WFM

heres mine in that area:

// Check the subject and message.
if (!isset($_POST['subject']) || htmltrim__recursive($_POST['subject']) == '')
$post_errors[] = 'no_subject';
if (!isset($_POST['message']) || htmltrim__recursive($_POST['message']) == '')
$post_errors[] = 'no_message';
elseif (!empty($modSettings['max_messageLength']) && $func['strlen']($_POST['message']) > $modSettings['max_messageLength'])
$post_errors[] = 'long_message';

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';
}
if (isset($_POST['calendar']) && !isset($_REQUEST['deleteevent']) && htmltrim__recursive($_POST['evtitle']) == '')
$post_errors[] = 'no_event';
// You are not!
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

Jay T

Not sure but it doesnt work. I tried your code too, as it is a little different.

I really need this. Can you help me figure it out?


CeZa


geezmo

Ok now I'm confused here. Can somebody summarize which templates needed to be edited, which codes need to be replaced, and what codes should be added if I want to apply this to 1.1 RC2. The posts here are rather confusing so I hope somebody here can update this mod. Thanks.

geezmo


Owdy

Quote from: geezmo on May 07, 2006, 04:47:56 PM
anyone?

Run this via package manager. Works with SMF 1.1 RC2 with english language. Enjoy.
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

GetRank


PrizeLive.com

Installed smoothly and modified to allow 5 smilies.... Thanks!!
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

Brianw1212

Hi guys, installed this mod and it works great.. my only question is how do i change the number of smileys allowed in a post? The default is set at 3, but I want to change it to 4 if possible.

Thanks

PrizeLive.com

Quote from: Brianw1212 on July 16, 2006, 07:57:59 PM
Hi guys, installed this mod and it works great.. my only question is how do i change the number of smileys allowed in a post? The default is set at 3, but I want to change it to 4 if possible.

Thanks

In Modifications.english.php

Find:

$txt['error_smiley_limit'] = 'Max 3 smiles please. Remove smilies and try again.

Replace With:

$txt['error_smiley_limit'] = 'Max 4 smiles please. Remove smilies and try again.

In Post.php

Find:

$smileyLimit = 3;

Replace With:

$smileyLimit = 4;

That should do it for you...  ;D
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

Brianw1212

Quote from: SurfExcelerator.com on July 16, 2006, 08:02:57 PM
Quote from: Brianw1212 on July 16, 2006, 07:57:59 PM
Hi guys, installed this mod and it works great.. my only question is how do i change the number of smileys allowed in a post? The default is set at 3, but I want to change it to 4 if possible.

Thanks

In Modifications.english.php

Find:

$txt['error_smiley_limit'] = 'Max 3 smiles please. Remove smilies and try again.

Replace With:

$txt['error_smiley_limit'] = 'Max 4 smiles please. Remove smilies and try again.

In Post.php

Find:

$smileyLimit = 3;

Replace With:

$smileyLimit = 4;

That should do it for you...  ;D

Great!

I'll try it tonight..  thanks alot   :)


Brianw1212

#38
Just one more quick question...

Is there a way to limit the smileys in an actual post and have it not count the ones that are included in a quote?

For example, since installing the smiley mod, alot of my members have been complaining that when they quote someone who has used 3 smileys in their post, they're not allowed to use any because the limit per post is 3.. so they're having to go back and edit out the smileys in the quote in order to post some smileys of their own...

I'm curious if there is a fix for this..  thanks

Owdy

Quote from: Brianw1212 on July 16, 2006, 07:57:59 PM
Hi guys, installed this mod and it works great.. my only question is how do i change the number of smileys allowed in a post? The default is set at 3, but I want to change it to 4 if possible.

Thanks
First post ;)
Quote from: Owdy on September 27, 2004, 11:56:40 AM

You can set that limit number in this $smileyLimit = 3;

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

Brianw1212

Quote from: Owdy on July 16, 2006, 11:12:21 PM
Quote from: Brianw1212 on July 16, 2006, 07:57:59 PM
Hi guys, installed this mod and it works great.. my only question is how do i change the number of smileys allowed in a post? The default is set at 3, but I want to change it to 4 if possible.

Thanks
First post ;)
Quote from: Owdy on September 27, 2004, 11:56:40 AM

You can set that limit number in this $smileyLimit = 3;


Owdy, I'm going to direct this to you because it's your mod. I don't know if you read my previous post or not, but I was wondering if there was a way to limit the smileys per post and not have the ones in a quote to count towards the limit amount. For example, if the limit is 3, and i quote someone who has used 2 in his post, i can only use 1 because he already used 2 and i'm quoting him.. Is there any way to get around that?

Thanks

Owdy

That i dont know. My php isint that good ;D
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

Brianw1212

Quote from: Owdy on July 18, 2006, 01:25:56 PM
That i dont know. My php isint that good ;D

I'm attempted to play around with it myself and see if i could figure it out.. although i can guarantee your php is better than my php   :D


RODEOSOLSTICE

smileyLimit.zip

This is a great mod, and I definatly need it. It works on my V1.1, but not on V1.1.1

Any way to get it working for V1.1.1

and, newbie question. What is RC2 and RC3??

thanks!

RODEOSOLSTICE

Quote from: RODEOSOLSTICE on January 17, 2007, 12:52:44 PM
smileyLimit.zip

This is a great mod, and I definatly need it. It works on my V1.1, but not on V1.1.1

Any way to get it working for V1.1.1

and, newbie question. What is RC2 and RC3??

thanks!

Please forgive me, I found the solution here:
http://www.simplemachines.org/community/index.php?topic=107685.msg898559#msg898559

I'd still like to know what RC1 etc means??

Owdy

Code updated for SMF 1.1.2. Please read first post.
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

MultiformeIngegno

Hi, I dredge this old topic to ask you how can I limit the number of smilies per post in SMF 2.0b4.. please help me! :)

'bye! ;)
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Diabolo.ca

#47
Just a few small changes needed to make it work in 2.0 beta 4. The new edits:

<edit file>
Sources/Post.php
</edit file>

<search for>
    $_POST['message'] = $smcFunc['htmlspecialchars']($_POST['message'], ENT_QUOTES);
</search for>

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

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

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

<search for>
?>
</search for>

<add before>
$txt['error_smiley_limit'] = 'You can only have 3 smileys per post. Remove some smileys and try again.';
</add before>


But here's the kicker that had me puzzled at first. Read the comments at the beginning of index.english.php:
Quote/* Important note about language files in SMF 2.0 upwards:
   1) All language entries in SMF 2.0 are cached. All edits should therefore be made through the admin menu. If you do
      edit a language file manually you will not see the changes in SMF until the cache refreshes. To manually refresh
      the cache go to Admin => Maintenance => Clean Cache.

In other words, with 2.0, until you delete the old cache files you won't see the warning you added, although the posts with more than 3 smileys will still be rejected.

I assume similar updates could be made to the official mod as well to update for 2.0.

sirNemanjapro

#48
Is this working for SMF 1.1.11 or is there option in the board?

I have just checked, 1.1.11 doesn't have an limit number of smileys per post.


So, question is. Can I use this code that is updated for my installation?
None of the above applies.

MultiformeIngegno

Does this still work with RC3? I repeat that IMO this feature should be available by default...
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

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

Advertisement: