1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Smilies removal from dropdown

Discussion in 'Styling and Customization Questions' started by MOZ, Jul 3, 2012.

  1. MOZ

    MOZ Well-Known Member

    On the forum we are setting up, we are looking at using the smilies in a unique manner and for accomplishment of some task, for this we need the smiley replacement mechanism but the smilie shouldn't be listed in the dropdown menu.

    Is there a way to remove an individual smiley or group of smilies (Say between IDs x to y) from the dropdwon menu.

    We are using the default TinyMCE Editor without any changes except cosmetic ones done via EXTRA.CSS

    Thank You.
     
  2. Shelley

    Shelley Well-Known Member

    I don't think this is possible you'll probably need an add-on to do this though i could be mistaken though i'm sure someone will pop on and either dismiss that or confirm whether it can be accomplished.
     
  3. MOZ

    MOZ Well-Known Member

    So no way to do it using some condition based change in the template or somewhere else.
     
  4. Shelley

    Shelley Well-Known Member

    just took a look at the dropdown menu couldn't you do something like the following? Adding the code in extra.css you'll notice the smilie img id which would change pending on the smilies your not wanting to display?

    Code:
    img.mceSmilieSprite.mceSmilie1 {
        display: none!important;
    }
     
  5. MOZ

    MOZ Well-Known Member

    Didn't exactly get what you mean. :oops:
     
  6. Shelley

    Shelley Well-Known Member

    If your using a spritesheet the images come with their own unique ids therefore it is possible to hide them (above) but that hinges on you using a spritesheet as far as I'm aware. For example mceSmilie1 is the barefooting smiley so you keep adding the Ids to hide them. below is an example, I haven't tested it and only tried it through firebug here because I don't actually use spritesheets on my site.

    Code:
    img.mceSmilieSprite.mceSmilie1, img.mceSmilieSprite.mceSmilie2
    {
        display: none!important;
    }
     
    
     
  7. MOZ

    MOZ Well-Known Member

    Thank You. That worked wonders!
     
  8. MOZ

    MOZ Well-Known Member

    Spoke too soon, now the smilie is removed from posts as well, just want to hide it from the dropdown :(
     
  9. Shelley

    Shelley Well-Known Member

    try adding .xenForoSkin .mceSmiliesMenu div a

    like the following below, not sure this will work but worth a shot

    Code:
    .xenForoSkin .mceSmiliesMenu div a img.mceSmilieSprite.mceSmilie1,.xenForoSkin .mceSmiliesMenu div a  img.mceSmilieSprite.mceSmilie2
    {
        display: none!important;
    }
    
     
  10. MOZ

    MOZ Well-Known Member

    Seems to be working for now. Will confirm after some more testing.
     
  11. MOZ

    MOZ Well-Known Member

    Working.

    Thanks for the support in the Smilies removal. Thank you very much. I took that two steps ahead and removed the smilies from the Minorin editor that we are using and also the Smilies help menu. Thank you for guiding me in the right direction.

    I however need one more help, I would like to know how I can prevent some smilies from showing in the forum based on a condition. The first code you suggested hid the smilie, but I want this to be based on a custom user field (Yes/No for seeing some possibly offending smilies).
     
  12. MOZ

    MOZ Well-Known Member

    I tried and found a solution myself, if other are interested I can post it for them :D
     
    Shelley likes this.
  13. Shelley

    Shelley Well-Known Member

    I always think any solution somebody has managed to accomplish somebody else on the forum will always benefit from so it's always worth post for others that may want to do this in the future. BTW nice work resolving it.
     
  14. MOZ

    MOZ Well-Known Member

    Thanks. Will post the solution.
     
  15. MOZ

    MOZ Well-Known Member

    On our forum we had some smilies that we thought the user might not want to see. So we needed the option of hiding those. To go about this, here is what we did:

    1. Create a Custom User Field, Users --> Custom User Fields --> Create New Field:
    Basic Information:
    -Field ID: hidesmilie
    -Title: Title of your choice
    -Display Location: Preference
    -Field Types: Radio Buttons

    Options for Choice Field:
    -Possible Choices: "yes" & "Yes" and "no" and "No"

    General Options:
    -Only user editable ticked.


    2. Create a css file named "smiliehide.css. The code for which is below:
    Code:
    img.mceSmilieSprite.mceSmilie59, img.mceSmilieSprite.mceSmilie60
    {
        background: url(images/removed.png);
    width: 40px;
    height: 18px;
    }
    In the above code, 59, 60 are the smilies ID. And images/removed.png is the link of image to be displayed, with the appropriate height and width. The height and width are very important as this is a sprite smilie being replaced.


    3. In the "message" template I made the following change:
    Right at the top, under:
    Code:
    <xen:require css="message.css" />
    <xen:require css="bb_code.css" />
    I added:
    Code:
    <xen:if is="{$visitor.customFields.hidesmilie} == 'yes'">
    <xen:require css="smiliehide.css" />
    </xen:if>
    As you can see in the code, here we have used the custom user field defined in the first step and the css file defined in the second step.
     

Share This Page