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.

Post an automatic message on click of a "thanks" button

View previous topic View next topic Go down

Post an automatic message on click of a "thanks" button

Post by Ange Tuteur on October 3rd 2014, 4:09 pm

Post an automatic message on click of a "thanks" button


A "Thanks" button is already included by Forumotion, and allows the author of a subject to thank one of the members who responded to their subject. This tutorial allows respondents to thank the author, such a system does not exist, but with this tutorial, you can add a "Thanks" button to the first post of a topic; on click of this button, a "Thank you" message will be posted automatically in the following topic.


Installing

Go to Administration Panel > Modules > JavaScript Codes Management and create a new script.

Title : Your choice
Placement : In the topics
Paste the code below :
Code:
$(function() {
 var url_img = "http://illiweb.com/fa/prosilver/icon_thanks_off_en.png",
 version = "phpbb3",
 message = "Thank you !";
 
 switch (version.toLowerCase()) {
  case 'phpbb2': var idi = '.post-options', addLi = '', closeLi = '';
  break;
  case 'phpbb3': var idi = '.profile-icons', addLi = '<li>', closeLi = '</li>';
  break;
  case 'punbb': var idi = '.post-options', addLi = '', closeLi = '';
  break;
  case 'invision': var idi = '.posting-icons', addLi = '<li>', closeLi = '</li>';
  break;
 }
 
 $(idi).first().prepend(addLi+'<img src="'+url_img+'" alt="Merci" id="mercipost" />'+closeLi);
 $('#mercipost').click(function() {
  $('#text_editor_textarea').sceditor('instance').insertText(message);
  $('input[name="post"]').click();
 });
});


Modifications

You can modify the first 3 variables in the script :

version : The version of your forum ( the values accepted are phpbb2, phpbb3, punbb, invision )
url_image : The url of your button ( by default this is the image displayed )
message : The message that will be posted on click of the button ( by default : "Thank you !" )





Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

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