The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
No Button Feedback ...
 
Share:
Notifications
Clear all

Issue No Button Feedback After Clicking "Post Comment" and "Reply" Buttons

18 Posts
2 Users
0 Reactions
668 Views
Posts: 106
Topic starter
(@aerostar)
Estimable Member
Joined: 5 years ago

Helpful:

The attached code snippet works great with WordPress' native comment system. Please give it a spin.

Perhaps you can adapt it for your plugin?

Thank you!

code snippet wp comments button text

 

Reply
1 Reply
Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7907

@aerostar 

Use this code: 

    $(document).on('wpdiscuz_new_comment', function(e, btn, form, depth){
        $(btn).val("Posting...");
    })

    $(document).on('wpdiscuz_comment_posted', function(e, btn, form, commentId, commentsCount){
       $(btn).val('Post Comment');
    });

This code works if you're using wpDiscuz 7.6.29 or a higher version.

Reply
Posts: 106
Topic starter
(@aerostar)
Estimable Member
Joined: 5 years ago

Regrettably, your code does not work at my end. Tested with wpDiscuz 7.6.29, all plugins deactivated except essentials, and flushed all cache.

These are the test code snippets I used:

PHP Code Snippet: https://prnt.sc/sR0Sp3BGvxl_
JS Code Snippet: https://prnt.sc/l0YwnRKbuN-Y

Does it work at your end? How did you exactly implement it?

Thank you!

Reply
1 Reply
Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7907

@aerostar 

Please try adding the JS code within jQuery(document).ready(function(){}); and also try adding it directly to the theme files.

We've checked the code multiple times and it's working fine.

Reply
Posts: 106
Topic starter
(@aerostar)
Estimable Member
Joined: 5 years ago

Hi @Asti,

Perfect! Worked like a charm.

Below please find the updated code snippet.

To see the code snippet in action, please visit this post and click on "Post Comment."

I cannot thank you enough for your help, dedication, and second-to-none plugin.

To help others, perhaps you can add this to your plugin's documentation?

Have a great week.

Cheers!

---------------------------

function wpdiscuz_button_feedack_onclick() {
  if ( is_singular( 'post' ) ) {  
    ?>
        <script type="text/javascript">
  			jQuery(document).ready(function ($) {
        		
				$(document).on('wpdiscuz_new_comment', function(e, btn, form, depth){
    			$(btn).val("Posting...");
    			})

				$(document).on('wpdiscuz_comment_posted', function(e, btn, form, commentId, commentsCount){
    			$(btn).val('Post Comment');
    			});
	
		});
		</script>
    <?php
  }
}
add_action('wp_footer', 'wpdiscuz_button_feedack_onclick');

 

Reply
Posts: 106
Topic starter
(@aerostar)
Estimable Member
Joined: 5 years ago

One final comment ... it would be great to further modify the above code snippet to allow the display of a "ajax spinner" instead of the word "Posting..." when the "Post Comment" button is clicked. I'll work on that. If successful, I'll post it here. Cheers!

Reply
Posts: 106
Topic starter
(@aerostar)
Estimable Member
Joined: 5 years ago

Note: The use of an "ajax spinner" vs the word "Posting..." works best for websites that use plugins such as GTranslate (i.e., use a language dropdown selector). This would eliminate translation issues with the word "Posting..." Cheers!

Reply
1 Reply
Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7907

@aerostar 

You can modify the code as you like. 

Reply
Page 2 / 2
Share: