• Resolved mikeboltonca

    (@mikeboltonca)


    First of all, great work on Slim Stat. It’s a seriously impressive plugin.

    I’ve encountered a compatibility issue between WP Slim Stat and bbPress dynamic reply forms.

    The dynamic reply forms are an extension that uses AJAX to put a reply form directly below its parent comment without reloading the page.
    Details:
    https://bbpress.org/forums/topic/how-to-create-dynamic-reply-box/
    https://bbpress.org/forums/topic/how-to-create-dynamic-reply-box/#post-178454

    With WP Slim Stat disabled, this bbPress extension works correctly. When WP Slim Stat is enabled:
    1. Clicking ‘reply’ moves the reply form using AJAX as expected
    2. The page reloads
    3. The reply form is back to its original position.

    I recognize this is a compatibility issue, not an issue with WP Slim Stat per se. With that in mind, I’m not expecting the Slim Stat crew to spend their limited time looking for a fix. However, if you could provide a bit of insight on how Slim Stat works, it might give me a starting point to finding a solution.
    Some questions to consider:
    1. What would cause Slim Stat to reload a page?
    2. Is there any way to disable Slim Stat when the current page is a bbPress page?

    Thanks a lot for your help. Your team is amazing!

    For quick reference, this is the dynamic reply form code that WP Slim Stat is conflicting with:

    addReply = {
    	moveForm : function(replyId, parentId, respondId, postId) {
    		var t = this, div, reply = t.I(replyId), respond = t.I(respondId), cancel = t.I('bbp-cancel-reply-to-link'), parent = t.I('bbp_reply_to'), post = t.I('bbp_topic_id');
    
    		if ( ! reply || ! respond || ! cancel || ! parent ) {
    			return;
    		}
    
    		t.respondId = respondId;
    		postId = postId || false;
    
    		if ( ! t.I('bbp-temp-form-div') ) {
    			div = document.createElement('div');
    			div.id = 'bbp-temp-form-div-123';
    			div.style.display = 'none';
    			respond.parentNode.insertBefore(div, respond);
    		}
    
    		reply.appendChild(respond); //This is the critical line that has been patched according to https://bbpress.org/forums/topic/how-to-create-dynamic-reply-box/page/2/#post-178847
    		if ( post && postId ) {
    			post.value = postId;
    		}
    		parent.value = parentId;
    		cancel.style.display = '';
    
    		cancel.onclick = function() {
    			var t = addReply, temp = t.I('bbp-temp-form-div'), respond = t.I(t.respondId);
    
    			if ( ! temp || ! respond ) {
    				return;
    			}
    
    			t.I('bbp_reply_to').value = '0';
    			temp.parentNode.insertBefore(respond, temp);
    			temp.parentNode.removeChild(temp);
    			this.style.display = 'none';
    			this.onclick = null;
    			return false;
    		};
    
    		try { t.I('bbp_reply_content').focus(); }
    		catch(e) {}
    
    		return false;
    	},
    
    	I : function(e) {
    		return document.getElementById(e);
    	}
    };
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter mikeboltonca

    (@mikeboltonca)

    After a bit more testing, I found the following console message right before the page reloads:
    Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effect to the end user's experience. For more help, check https://xhr.spec.whatwg.org [wp-slimstat.js:190]
    This message does not appear when Slim Stat is disabled.

    I’m following this lead now, but the support request still stands. Thanks!

    • This reply was modified 8 years, 4 months ago by mikeboltonca.
    • This reply was modified 8 years, 4 months ago by mikeboltonca.
    Thread Starter mikeboltonca

    (@mikeboltonca)

    I’ve isolated the issue to the Tracking module. Specifically, if I change the settings as follows, the page-reload issue goes away:

    Tracking Mode: Server
    Track Client Info: Off

    I don’t use a caching plugin currently, so Tracking Mode: Server shouldn’t cause any direct issues. That said, it’s not clear how this will affect Slim Stat. There doesn’t seem to be any documentation about the setting in the Slim Stat Knowledge Base.

    I do want to collect information about my users’ browser and screen size, but it that’s the only thing Track Client Info: Off will cost me, I can live with it. Again, there doesn’t seem to be any detail about this setting in the Knowledge Base. Can you confirm what information is limited when this setting is turned to Off?

    Another lead I followed is this thread:
    https://wordpress.org/support/topic/slimstat-bbpress-need-to-double-click-links-ff-or-wait-chrome-to-load/

    Jason Crouse from the Slim Stat team mentions (1 year ago):

    One thing we can do, though, is to introduce a new option in the plugin’s settings, to let the administrator decide if his/her server is fast enough and use the async mode (which our script already supports).

    I’m wondering if this setting was implemented. It seems like it may be relevant to the issue I’m experiencing.

    Thanks for any insight!

    • This reply was modified 8 years, 4 months ago by mikeboltonca.
    Plugin Author Jason Crouse

    (@coolmann)

    Hi,

    thank you for doing all this research. It will hopefully help other people experiencing the same issue. Please take a look at our knowledge base to learn how to solve this problem:

    https://slimstat.freshdesk.com/support/solutions/articles/5000528534-i-noticed-a-conflict-with-your-lightbox-library-here-what-can-i-do-

    Let me know if this helps.

    Best,
    Jason

    Thread Starter mikeboltonca

    (@mikeboltonca)

    Hi Jason,

    That solution worked flawlessly.
    Thanks very much for the link. I wouldn’t have thought to compare my issue to a lightbox problem, but the root cause is the same.

    I hope this thread will help guide someone else to the right answer in the future.

    Have a good one, and thanks again for the great work on the plugin.

    • This reply was modified 8 years, 4 months ago by mikeboltonca.
    Plugin Author Jason Crouse

    (@coolmann)

    Yes, I see how the title of that article could be a little misleading, we’ll work on that.

    Please consider writing a review for Slimstat as a token of appreciation for the support you received. It would be a nice way to say thank you and to let people know how much you value this plugin:

    https://wordpress.org/support/plugin/wp-slimstat/reviews/#new-post

    Best,
    Jason

    Thread Starter mikeboltonca

    (@mikeboltonca)

    Glad to leave a positive review. Thanks for the fast and thorough support, Jason!

    Plugin Author Jason Crouse

    (@coolmann)

    Thank you for your kind words. Much appreciated.

    Jason

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Slim Stat forcing page reload in bbPress when using dynamic reply forms’ is closed to new replies.