The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

moderator smiles

View previous topic View next topic Go down

Solved moderator smiles

Post by sunshine_222 on January 12th 2015, 11:53 am

moderator smiles

Is it possible to give me some script to make a special category for moderator smiles?
the idea is only moderators to have the possibility and able to see them, when attaching them into the posts, but after that all to see them in the post.


Last edited by sunshine_222 on January 17th 2015, 4:14 pm; edited 1 time in total

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Ange Tuteur on January 12th 2015, 12:45 pm

Hi @sunshine_222,

Of course, it's possible to make a set of smilies that only appear for moderators / administrators. The only thing is that members can still use them since they're only images. Try the following :
Go to Administration panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In all the pages
Paste the code below :
Code:
$(function() { if (!_userdata.user_level || !document.getElementById('#smileyContainer')) return; $('#smileyContainer').append('<div id="customSmilies"></div>');
 
  emoticons(
    'http://illiweb.com/fa/i/smiles/icon_biggrin.png',
    'http://illiweb.com/fa/i/smiles/icon_smile.gif',
    'http://illiweb.com/fa/i/smiles/icon_sad.gif',
    'http://illiweb.com/fa/i/smiles/icon_eek.gif'
  );
 
  function emoticons() {
    for (var i=0,args=arguments; i<args.length; i++) {
      var emo = document.createElement('IMG');
      emo.src = args[i];
      emo.onclick = function() { $('#text_editor_textarea').sceditor('instance').insertText('[img]' + this.src + '[/img]',' ') }
      document.getElementById('customSmilies').appendChild(emo);
    }
  };
});

To add remove emoticons, simply edit this part :
Code:
  emoticons(
    'http://illiweb.com/fa/i/smiles/icon_biggrin.png',
    'http://illiweb.com/fa/i/smiles/icon_smile.gif',
    'http://illiweb.com/fa/i/smiles/icon_sad.gif',
    'http://illiweb.com/fa/i/smiles/icon_eek.gif'
  );

Insert your images, and make sure that multiple images are separated by a comma !

The emoticons should show up directly under the emoticon box when using the full editor :

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 12th 2015, 2:03 pm

Thank you, Ange Tuteur! This is in the case that the smiles are shared in internet.
Code:
http://illiweb.com/fa/i/smiles/icon_biggrin.png
If they are already uploaded in the forum, how to customize certain groups (Categories of smiles) from them?

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 14th 2015, 2:43 pm

@Ange Tuteur I'm waiting for the script, but I want to add, that it doesn't work and it blocked all the JSs that I use in my modules, can you fix it somehow?

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Ange Tuteur on January 15th 2015, 4:56 am

Hi @sunshine_222,

I apologize, I made a few mistakes. Try now :
Code:
$(function() {$(function() {
  if (!_userdata.user_level || !document.getElementById('smileyContainer')) return;
  $('#smileyContainer').append('<div id="customSmilies"></div>');
 
  emoticons(
    'http://illiweb.com/fa/i/smiles/icon_biggrin.png',
    'http://illiweb.com/fa/i/smiles/icon_smile.gif',
    'http://illiweb.com/fa/i/smiles/icon_sad.gif',
    'http://illiweb.com/fa/i/smiles/icon_eek.gif'
  );
 
  function emoticons() {
    for (var i=0,args=arguments; i<args.length; i++) {
      var emo = document.createElement('IMG');
      emo.src = args[i];
      emo.onclick = function() { $('#text_editor_textarea').sceditor('instance').insertText('[img]' + this.src + '[/img]',' ') };
      document.getElementById('customSmilies').appendChild(emo);
    }
  };
})});

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 15th 2015, 12:15 pm

Unfortunately, nothing happened at all. I don't see any from these smiles.
And it block again some of my JS.

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Ange Tuteur on January 15th 2015, 1:10 pm

It appears to be working correctly for me. Could you post the link of your forum ?


Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 15th 2015, 3:10 pm


sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Ange Tuteur on January 15th 2015, 3:31 pm

I get an error on your forum, which I believe may be caused by what we're discussing here : http://help.forumotion.com/t138287-add-a-form-on-creation-of-a-new-topic#936058

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 15th 2015, 3:46 pm

Thank you, Ange Tuteur! Now it works.But is it possible this script to modify, so the smiles will be got not from the internet, but from Display/avatars/smiles/categories -
from them to choose one or even better 2 categories? /I need to use much more number of smiles/ Thanks!

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Ange Tuteur on January 15th 2015, 4:28 pm

If you add them in the administration then they'll be accessible to all. As far as I know, this would be your best option.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 15th 2015, 5:27 pm

Yes, I have them in the administration and now they are accessible to all. But the idea is they to be used only by moderators. I would like do not misunderstand (bewilder?) my members. I don't want they to use them. The question is not that they could see them, but not to use them. That's why I think it's better if they can't see them.

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Ange Tuteur on January 16th 2015, 8:55 am

Replace your current script with this :
Code:
$(function(){
  var filter = [1, 2, 3, 4, 5];
 
  _userdata.user_level != 0 && $(function(){
    $('#smileyContainer iframe').load(function() {
      for (var i=0; i<filter.length; i++) $('#smileyContainer iframe').contents().find('#smiley_' + filter[i]).hide()
    });
  });
});

At the top you will see filter, this holds the ID of the simlies you want to hide for members. To know the ID of the smilies go to Display > Smiles

You will see the ID in the first column :

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 16th 2015, 11:23 am

I don't know where is the problem - in the script or in the groups, but it doesn't work.

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Ange Tuteur on January 16th 2015, 10:25 pm

Ooops, try now :
Code:
$(function(){
  var filter = [1, 2, 3, 4, 5];
 
  _userdata.user_level == 0 && $(function(){
    $('#smileyContainer iframe').load(function() {
      for (var i=0; i<filter.length; i++) $('#smileyContainer iframe').contents().find('#smiley_' + filter[i]).hide()
    });
  });
});

I had it to where it will remove the smiles for Moderators and Admins. lol!

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 17th 2015, 9:25 am

Thank you, but still don't work. They still could be used by any member.

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Ange Tuteur on January 17th 2015, 10:19 am

Well, of course, it's only an image. If I can't use the code, then I can download the image, upload it, and use it just the same.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: moderator smiles

Post by sunshine_222 on January 17th 2015, 10:41 am

So, it seems I should abandon this idea.
Anyway, thank you very much for your hard work!

sunshine_222
Forumember

Posts : 99
Reputation : 3
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: moderator smiles

Post by Base on January 17th 2015, 9:23 pm

Marked as Solved => Archived

Base
Forumaster

Male Posts : 10386
Reputation : 1687
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum