Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Wesley

    (@wesleyenglish)

    Ok, so my fix doesn’t work completely since the “View Profile” page also has that action hook. This causes the edit Forum Signature field to appear when viewing people’s pages.

    My suggestion for moving the field still stands, I’m just not sure how to accomplish it anymore.

    Thanks!

    Wesley

    (@wesleyenglish)

    I also encountered this problem. After some research and experimentation, I found a fix that seems to work for me (I have not tested the fix extensively so I have no idea if this fix will work for you.)

    Unfortunately, it involves modifying a bbPress core file, which should be avoided wherever possible. However, if you really need this to work, feel free to give it a try!

    Problem: At a really high level, when bbPress moves the editor, it’s not moving the event bindings properly.

    Solution: Destroy and recreate the Visual Editor so that the event bindings are re-initiated.

    Replace all the code in /wp-content/plugins/bbpress/templates/default/js/reply.js with the following:

    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');
    
    		t.removeEditor();
    
    		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';
    			div.style.display = 'none';
    			respond.parentNode.insertBefore(div, respond);
    		}
    
    		reply.parentNode.insertBefore(respond);
    		if ( post && postId )
    			post.value = postId;
    		parent.value = parentId;
    		cancel.style.display = '';
    
    		t.addEditor();
    
    		cancel.onclick = function() {
    			var t = addReply, temp = t.I('bbp-temp-form-div'), respond = t.I(t.respondId);
    
    			t.removeEditor();
    
    			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;
    
    			t.addEditor();
    
    			return false;
    		}
    
    		try { t.I('bbp_reply_content').focus(); }
    		catch(e) {}
    
    		return false;
    	},
    
    	I : function(e) {
    		return document.getElementById(e);
    	},
    
    	removeEditor : function() {
    		try {
    			console.log('removing...');
    			tinyMCE.EditorManager.execCommand('mceFocus', false,'bbp_reply_content');
    			tinymce.EditorManager.execCommand('mceRemoveEditor',false, 'bbp_reply_content');
    		} catch(el) {}
    	},
    
    	addEditor : function() {
    		try {
    			console.log('adding...');
    			tinymce.EditorManager.execCommand('mceAddEditor',false, 'bbp_reply_content');
    		} catch (e) {}
    	}
    }

    Note: In my experience, Firefox doesn’t seem able to correctly insert the editor div underneath the nested reply regardless if this plugin is enabled or not. The editor will also appear at the bottom of the page.

    Wesley

    (@wesleyenglish)

    This worked for me, as well. Thank you!

    Wesley

    (@wesleyenglish)

    I have the same problem. I found a workaround, but it’s not a 100%.

    Add a “break;” to bbpress-pf.php after line 34 so that the function looks like this:

    //Disallowed?
        foreach($current_user->roles as $role){
            if(in_array($role, $disallowed_roles)){
                ob_start();
                add_action( 'bbp_theme_after_topic_form', 'pf_stop_capture');
                break;
            }
        }

    Otherwise the action gets called too many times, messing up the session and leading to the page rendering out of order.

    This is not a perfect workaround because it still causes the icons in the WordPress toolbar to not display. But otherwise it seems to solve the problem.

Viewing 4 replies - 1 through 4 (of 4 total)