The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

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

2 posters

Go down

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

Post by Ange Tuteur 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 = "https://2img.net/i/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 Post an automatic message on click of a "thanks" button Icon_thanks_off_en )
message : The message that will be posted on click of the button ( by default : "Thank you !" )




Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Tutorial Re: Post an automatic message on click of a "thanks" button

Post by skouliki February 11th 2020, 10:01 am

This code was updated to fit in with the new HTTPS address

updated 11.02.2020 by skouliki
skouliki
skouliki
Manager
Manager

Female Posts : 15411
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

trajce likes this post

Back to top Go down

Back to top

- Similar topics

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