<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									AddComment hook - How-To and Troubleshooting				            </title>
            <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/</link>
            <description>WordPress Plugins Support Forum</description>
            <language>en-US</language>
            <lastBuildDate>Sat, 08 Aug 2026 22:34:36 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16853</link>
                        <pubDate>Sat, 27 Jul 2019 15:01:05 +0000</pubDate>
                        <description><![CDATA[Awesome it works!I would like to make a small note if other people attempt this;Make sure your theme makes use of body classes that way you can easily keep this globally setup for all your C...]]></description>
                        <content:encoded><![CDATA[<p>Awesome it works!</p><p>I would like to make a small note if other people attempt this;<br />Make sure your theme makes use of body classes that way you can easily keep this globally setup for all your CPT's with the following wrapped around it; </p><pre>if ($("body").hasClass("single")) {}</pre><p>Otherwise wpdiscuzAjaxObj will not always be available ;)<br />(if you set it up to only load these assets on pages that have comments ... which ofcourse is more optimal)</p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>PatrickD</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16853</guid>
                    </item>
				                    <item>
                        <title>RE: AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16852</link>
                        <pubDate>Sat, 27 Jul 2019 13:39:49 +0000</pubDate>
                        <description><![CDATA[Thanks for getting back to me.Ah so I had  to change the way it was called .. ok that makes sense.Will give this a try later on. Kind regards,Patrick]]></description>
                        <content:encoded><![CDATA[<p>Thanks for getting back to me.<br />Ah so I had  to change the way it was called .. ok that makes sense.<br />Will give this a try later on. <br /><br />Kind regards,<br />Patrick</p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>PatrickD</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16852</guid>
                    </item>
				                    <item>
                        <title>RE: AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16848</link>
                        <pubDate>Sat, 27 Jul 2019 12:59:32 +0000</pubDate>
                        <description><![CDATA[@patrickdPlease try to replace the js function with this one: wpdiscuzAjaxObj.comment_sound = function () {   var sound = &#039;https://www.nintendoreporters.com/storage/themes/nintendoreporters/...]]></description>
                        <content:encoded><![CDATA[<p>@patrickd</p><p>Please try to replace the js function with this one: </p><pre>wpdiscuzAjaxObj.comment_sound = function () {<br />   var sound = '<a class="c-link" href="https://www.nintendoreporters.com/storage/themes/nintendoreporters/sounds/comment-sound.mp3" target="_blank" rel="noopener noreferrer">https://www.nintendoreporters.com/storage/themes/nintendoreporters/sounds/comment-sound.mp3</a>';<br />   var audio = new Audio(sound);<br />   var promise = audio.play();<br />   if (promise !== undefined) {<br />       promise.then(function() {<br />       }).catch(function(error) {<br />       });<br />   }</pre>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>Astghik</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16848</guid>
                    </item>
				                    <item>
                        <title>RE: AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16842</link>
                        <pubDate>Sat, 27 Jul 2019 07:38:08 +0000</pubDate>
                        <description><![CDATA[Sorry to bump this but if someone could point me in to what I am doing wrong that would be very much appreciated.Kind regards,Patrick Dankers]]></description>
                        <content:encoded><![CDATA[<p>Sorry to bump this but if someone could point me in to what I am doing wrong that would be very much appreciated.</p><p>Kind regards,</p><p>Patrick Dankers</p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>PatrickD</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16842</guid>
                    </item>
				                    <item>
                        <title>RE: AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16657</link>
                        <pubDate>Tue, 16 Jul 2019 21:10:38 +0000</pubDate>
                        <description><![CDATA[Sorry to pop in once again with this.We seem very close but it keeps throwing; &quot;comment_sound is not a function&quot; in the console.So let me check with you real quick if I overlooked something;...]]></description>
                        <content:encoded><![CDATA[<p>Sorry to pop in once again with this.<br />We seem very close but it keeps throwing; "comment_sound is not a function" in the console.<br />So let me check with you real quick if I overlooked something;<br /><br />In my functions.php I have;</p><pre>/**<br /> * WPDiscuz - Comment Sound<br /> */<br />add_filter('wpdiscuz_comment_post', function($messageArray){<br />    $messageArray[] = 'comment_sound';<br />    return $messageArray;<br />});</pre><p>In one of the main js files which I include I have;</p><pre>function comment_sound() {<br />    var sound = 'https://www.nintendoreporters.com/storage/themes/nintendoreporters/sounds/comment-sound.mp3';<br />    var audio = new Audio(sound);<br />    var promise = audio.play();<br />    if (promise !== undefined) {<br />        promise.then(function() {<br />        }).catch(function(error) {<br />        });<br />    }</pre><p>Calling that function directly in console as comment_sound(); does work.<br />But when issued as a callbackFunctions it keeps saying that it is not a function if a comment is made.<br /><br />Am I overlooking something here or did I do something weird syntax wise?<br /><br />Any help would be greatly appreciated.<br /><br />Best regards,<br />Patrick Dankers</p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>PatrickD</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16657</guid>
                    </item>
				                    <item>
                        <title>RE: AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16613</link>
                        <pubDate>Mon, 15 Jul 2019 16:13:50 +0000</pubDate>
                        <description><![CDATA[@astghikCool will look into this soon :)Thanks for the quick reply and follow up!]]></description>
                        <content:encoded><![CDATA[<p>@astghik</p><p>Cool will look into this soon :)<br />Thanks for the quick reply and follow up!</p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>PatrickD</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16613</guid>
                    </item>
				                    <item>
                        <title>RE: AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16582</link>
                        <pubDate>Mon, 15 Jul 2019 11:34:35 +0000</pubDate>
                        <description><![CDATA[Hi @patrickd,1. Create a new function and add your js code there, e.g function your_js_function_name()2. Add the function in some of the js files of the active theme. 3. Put the following co...]]></description>
                        <content:encoded><![CDATA[<p>Hi @patrickd,</p><p>1. Create a new function and add your js code there, e.g function <span style="color: #ff0000"><em><strong>your_js_function_name()</strong></em></span></p><p>2. Add the function in some of the js files of the active theme. </p><p>3. Put the following code in active theme's functions.php file</p><pre>add_filter('wpdiscuz_comment_post', function($messageArray){<br />   $messageArray[] = '<span style="color: #ff0000"><em><strong>your_js_function_name</strong></em></span>';<br />       return $messageArray;<br />});</pre><p>4. Replace the red marked function name with the function name you've created in step 1. </p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>Astghik</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16582</guid>
                    </item>
				                    <item>
                        <title>RE: AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16537</link>
                        <pubDate>Sat, 13 Jul 2019 16:33:37 +0000</pubDate>
                        <description><![CDATA[Hi Patrick,Thank you for using wpDiscuz and for contacting us.I&#039;m going to ask this question to the developers of the plugin. I&#039;ll update the topic once I get a response from them.]]></description>
                        <content:encoded><![CDATA[<p>Hi Patrick,</p><p>Thank you for using wpDiscuz and for contacting us.</p><p>I'm going to ask this question to the developers of the plugin. I'll update the topic once I get a response from them. </p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>Astghik</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16537</guid>
                    </item>
				                    <item>
                        <title>AddComment hook</title>
                        <link>https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16531</link>
                        <pubDate>Sat, 13 Jul 2019 15:02:19 +0000</pubDate>
                        <description><![CDATA[Hi there,I am looking for a way to hook / filter the AddComment action.What I want to do is add a audio queue to go along with it.Something simple like&lt;?php $sound = get_stylesheet_direct...]]></description>
                        <content:encoded><![CDATA[<p>Hi there,<br /><br />I am looking for a way to hook / filter the AddComment action.<br />What I want to do is add a audio queue to go along with it.<br /><br />Something simple like</p><pre>&lt;?php $sound = get_stylesheet_directory_uri() . '/sounds/comment-sound.mp3'; ?&gt;<br />&lt;script type="text/javascript"&gt;<br />  var sound = '&lt;?= $sound ?&gt;';<br />   var audio = new Audio(sound);<br />   var promise = audio.play();<br />   if (promise) {<br />       promise.catch(function(error) { console.error(error); });<br />   }<br />&lt;/script&gt;</pre><p>Above is working on other parts ... I just want to be able to set it up for the add comment action in WPDiscuz.</p><p>I am quite certain I should be looking at; wpdAddComment or AddComment but I have no idea as to how to adress them correctly.<br /><br />Any help would be greatly appreciated.<br /><br />Best regards,<br />Patrick</p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/how-to-and-troubleshooting/">How-To and Troubleshooting</category>                        <dc:creator>PatrickD</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/how-to-and-troubleshooting/addcomment-hook/#post-16531</guid>
                    </item>
							        </channel>
        </rss>
		