WordPress.org

Ready to get started?Download WordPress

Forums

limited number of smilies per comment. (6 posts)

  1. Kishmish
    Member
    Posted 8 years ago #

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

  2. whooami
    Member
    Posted 8 years ago #

    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.

  3. Medizinische Abkuerzungen
    Member
    Posted 8 years ago #

    @Kishmish

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

  4. Kishmish
    Member
    Posted 8 years ago #

    Hi
    @whooami
    I think I have miss-explained my self.

    @StefanSuedfeld
    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

    wp_get_comment_text(commetn->$post)
    if (smilies >5) {
    replace with '';
    }

    something like that :)

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

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

  6. Kishmish
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.