• Page 1 of 1
  • 1
Forum moderator: bigblog  
uCoz Community » For Webmasters » Custom Solutions » Reply button in forum
Reply button in forum
lanh
Posts: 135
Reputation: 0

Message # 1 | 5:00 AM
Dear All,

Currently, there is not Reply button in forum.

I would like to make a reply button. When we click on it, the post we want to reply will be be quoted in the Reply Form. I think it is possible.

Could you please help on this?

joexyz
JOE-vascript
Posts: 1770
Reputation: 78

Message # 2 | 8:53 AM
lanh, here's a solution that works with the BB-code editor (it will not work with the visual editor).

In the Appearance of entries template, find this code:
Code
<?if($EDITEDBY$)?><br><br><div class="edited">Message edited by $EDITEDBY$</div><?endif?><hr />

and paste this one under it:
Code
<p style="text-align: right"><a href="javascript://" class="uforum-reply">Reply</a></p>


In the General appearance of forum pages template, insert this code after the $BODY$ tag:
Code
<script type="text/javascript">
  $(document).ready(function(){
    $(".uforum-reply").click(function(){
      var $parent = $(this).parent().parent();
      var $post = $parent.find(".ucoz-forum-post");
      var $postid = $post.attr("id").replace("ucoz-forum-post-", "");
      var $msgauthor = $parent.parent().parent().find(".postUser").text();
      $("#message").val($("#message").val() + "[quote=" + $msgauthor + ";" + $postid +"]" + $post.text() + "[/quote]")
    });
  });
</script>


Please, keep in mind that this code is very relative which means it might not work in non-system templates.

Don't forget that you can change the style of the .uforum-reply class in the CSS template of your website. You can change the contents too (to an image, for example), just keep the same class.

If you want to place the button somewhere else, provide the URL address of your forum and the exact place where you want to insert the button. I will get back to you with a new code for the General appearance of forum messages template.

hey i'm joe and i do not work for the company anymore, please contact other staff or tech support
icon by ch-chau

sometimes i lurk here
lanh
Posts: 135
Reputation: 0

Message # 3 | 1:38 AM
Dear bigblog,

It works well. Thank you very much for your kind support. This feature is so convenient.

May I ask one more question?

Is it possible to scroll user to Reply form when clicking on Reply? Thanks a lot.

Post edited by lanh - Wednesday, 2017-08-16, 2:07 AM
joexyz
JOE-vascript
Posts: 1770
Reputation: 78

Message # 4 | 1:45 PM
lanh, sure, use this code instead of the one I sent before for the General appearance of forum pages template:

Code
<script type="text/javascript">
  $(document).ready(function(){
    $(".uforum-reply").click(function(){
      var $parent = $(this).parent().parent();
      var $post = $parent.find(".ucoz-forum-post");
      var $postid = $post.attr("id").replace("ucoz-forum-post-", "");
      var $msgauthor = $parent.parent().parent().find(".postUser").text();
      $("#message").val($("#message").val() + "[quote=" + $msgauthor + ";" + $postid +"]" + $post.text() + "[/quote]")
      $("#message").focus();
    });
  });
</script>

hey i'm joe and i do not work for the company anymore, please contact other staff or tech support
icon by ch-chau

sometimes i lurk here
uCoz Community » For Webmasters » Custom Solutions » Reply button in forum
  • Page 1 of 1
  • 1
Search: