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

Go down

Tutorial 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 !" )




avatar
Ange Tuteur
Forumaster

Male Posts : 13206
Reputation : 2928
Language : EN, JA, FR
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Back to top


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