Support » Requests and Feedback » limited number of smilies per comment.

  • hi
    is there some way of limiting the number of smilies commentators can insert in their comments e.g. 5?

Viewing 5 replies - 1 through 5 (of 5 total)
  • whooami



    a specific 5 or a random 5?

    the smilies displayed are determined inside wp-includes/vars.php

    Look for this:

    // if the config file does not provide the smilies array, let's define it here
    if (!isset($wpsmiliestrans)) {

    below that are the smilies; if youre interested in 5 specific ones just remove or comment out the ones you dont want displayed.


    Did you mean 5 different or a total maximum of five per comment (different or not)?

    I think I have miss-explained my self.

    max five similes but many to choose

    I meant that I want to allow maximum 5 smilies per comment. users can choose between 20 smilies I have placed for comment area but some of these users (you know) miss-use the feature and place 200 smilies in one comment and it is annoying.
    so, I would like to prevent this. just let them enter maximum 5 smilies in their comment and not more. if there are more then accept only the first 5 smiles and cut out the rest of them.

    do you guys think it is possible with some kind of text filter that looks for smilies and

    if (smilies >5) {
    replace with ”;

    something like that 🙂

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    One way to do it:

    There’s two main changes you have to make.
    In vars.php, find this line:
    $wp_smiliessearch[] = $smiley;

    and replace it with this one:
    $wp_smiliessearch[] = '/'.$smiley.'/';

    Then, in functions-formatting.php, find this:
    $content = str_replace($wp_smiliessearch, $wp_smiliesreplace, $content);

    and replace it with this:
    $content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content,5);

    And there you go. Note that this change is kinda dirty, and it will apply to your own posts as well, limiting the number of replacements. This also doesn’t prevent them from putting all the smilies in, it just prevents them from becoming images later.

    I could come up with a better solution, but it’s a bit late right now. 🙂

    thanks for reply. I will implement it later (I am at work right now) and see if it does the trick. it sounds OK to me. but as you also mentioned, it will also cut smilies from my own posts as well. it is a kind of global smilies limiting thing.

    thanks again.
    will get back to you soon with feedback.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘limited number of smilies per comment.’ is closed to new replies.