• Resolved baedyllion

    (@baedyllion)


    Hello, I’m enjoying the plugin a lot, both free version and the premium version. But I need to solve a problem of mine.

    I have a couple of code snippets I integrated with the plugin. One is I set a quota for the comments per post as in If the post gets 5 comments , the comment form will not be displayed. Second is I prevented my users to comment more than once per post. It’s looking good so far but the problem is these rules are only applied when the page is refreshed. If a user does not refresh the page , he can comment unlimited messages. So I’m looking for a way to solve this problem and the only think I could think of is change the post comment link. I was wondering If it is possible to change the link for post comment button.

    I need this button to comment the message and refresh the page at the same time.
    Is it possible to achieve this? I’d really appreciate any help. Thanks in advance.
    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support gVectors Support

    (@gvectorssupport)

    Hi baedyllion,

    I need this button to comment the message and refresh the page at the same time.

    Please follow the solution below:

    1. Put this code in the active theme JS files.

    jQuery(document).ready(function ($) {
       wpdiscuzAjaxObj.refreshPageWhenCommentPosted = function (r) {
          if (r.success) {
             location.reload();
          }
       };
    });

    2. Then put the code below in the active theme functions.php file:

    add_filter("wpdiscuz_comment_post", function ($r) {
        $r["callbackFunctions"][] = "refreshPageWhenCommentPosted";
        return $r;
    });
    Thread Starter baedyllion

    (@baedyllion)

    Hello,

    Thank you for the quick reply. I did as you instructed. It’s working great now.

    I appreciate the help.

    Cheers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change post comment button link’ is closed to new replies.