• Resolved leokoltm

    (@leokoltm)


    I’m using your wpdiscuz_after_comment_post hook. But the code below does not work as it should. The message appears, but AJAX stops working when adding a comment. That is, the comment that the user left does not appear in the comment tree marked “Awaiting moderation”. How to fix it?

    add_action("wpdiscuz_after_comment_post", function () {
    
    ? ? $newCommentId = $newComment->comment_ID;
    
    ? ? $mes = 'Спасибо за ваш отзыв!'; // Текст благодарности
    
    ? ? echo '<script>console.log("' . esc_js($mes) . '");</script>';
    
    ? ? wp_die($mes);
    
    }, 10, 2);

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author AdvancedCoding

    (@advancedcoding)

    @leokoltm That’s because you’re interrupting the wpDiscuz ajax request. Check out the “wpdiscuz_comment_post” filter instead.

    Thread Starter leokoltm

    (@leokoltm)

    Well, how to use it? Can you bring an exemple?

    Plugin Author AdvancedCoding

    (@advancedcoding)

    @leokoltm,

    If you want to set a custom message after a comment has been added, check this hook also. You can pass your JS function name as a callback and do your stuff.
    Sorry, but we’re not providing the plugin customization support here.

    $response["callbackFunctions"] = [];
    $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wpdiscuz_after_comment_post’ is closed to new replies.