subscribe-to-comments domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home1/davoscri/public_html/wp-includes/functions.php on line 6170You can also find the following post at: http://wordpress.org/support/topic/plugin-front-end-editor-frontend-editor-and-wordpress-mu-domain-mapping-plugins?replies=2#post-2610913
People, I’ve been commeting about this on my website with Scribu http://davoscript.com/2012/02/07/front-end-editor-and-wordpress-mu-domain-mapping-plugins/#comments and after some research I’ve found that the problem is actually with WordPress MU Domain Mapping plugi, check out this code:
domain_mapping.php Line #656
// fixes the plugins_url
function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL ) {
return get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, PLUGINDIR ) - 1 );
}
function domain_mapping_themes_uri( $full_url ) {
return str_replace( get_original_url ( 'siteurl' ), get_option( 'siteurl' ), $full_url );
}
if ( defined( 'DOMAIN_MAPPING' ) ) {
add_filter( 'plugins_url', 'domain_mapping_plugins_uri', 1 );
...
}
The domain_mapping_plugins_uri function is used to filter the plugins_url function and return the plugins folder (or file inside it) url with the mapped domain, it does it by searching “wp-content/plugins” but it fails when the plugin is loaded from the “wp-content/mu-plugins”. This can be fixed by validating if the passed URL contains the “mu-plugins” string or not.
This is the fix I added:
// fixes the plugins_url
function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL ) {
if ( false !== strpos($full_url, 'wp-content/mu-plugins') )
$mapped_url = get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, 'wp-content/mu-plugins' ) - 1 );
else
$mapped_url = get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, 'wp-content/plugins' ) - 1 );
return $mapped_url;
}
Note that I use “wp-content/plugins” and “wp-content/mu-plugins” instead of the “PLUGINDIR” constant which is deprecated by the way.
Please not that this is not an official fix, since I’m not the author of the plugin, however I hope this can solve this problem for other people as it did for me, so you can enjoy and empower your network with this 2 amazing wordpress plugins!
Regards,
Davo.
I have a WordPress Multisite instance which uses WordPress MU Domain Mapping plugin to map domains like domain1.com with the subdomains in my WordPress network like: domain1.mynetwork.com.
Yasterday I started using Frontend Editor plugin in my network as a “must use” plugin (inside mu-plugins folder), but noticed it didn’t work in mapped domains but it did with no problem in no mapped websites (subdomain.mynetwork.com). A little bit of research showed me that the problem as that some of the Javascript files used by FEE (Frontend Editor) were not being included with the propper URL in the src attribute, like this:
OK (no mapped domains):
<script src="http://subdomain.mynetwork.com/wp-content/mu-plugins/front-end-editor/lib/aloha-editor/lib/aloha.js" ...
WRONG (mapped domains):
<script src="http://mapped-domain.coms" ...
So, it looked like there was a problem when generating the javascript files URL, time to read the plugin code! This is a step by step description of what I did:
'src' => plugins_url( 'lib/aloha-editor/lib/aloha.js', FEE_MAIN_FILE ),So, to recap, I’ll show you which pieces of code I replaced. Italic is the original code, Bold is the one I replaced it with:
Line #61 /wp-content/mu-plugins/front-end-editor/php/core.php
if ( in_array( 'rich', $wrapped ) ) {
//wp_register_style( 'aloha-editor', plugins_url( 'lib/aloha-editor/css/aloha.css', FEE_MAIN_FILE ), array(), ALOHA_VERSION );
wp_register_style( 'aloha-editor', WPMU_PLUGIN_URL.'/front-end-editor/lib/aloha-editor/css/aloha.css', array(), ALOHA_VERSION );
$css_dependencies[] = 'aloha-editor';
}
Line #92 /wp-content/mu-plugins/front-end-editor/php/core.php
} else {
$min = defined('SCRIPT_DEBUG') ? '' : '.min';
//self::register_script( 'fee-editor', "build/editor$min.js" );
wp_enqueue_script( 'fee-editor', WPMU_PLUGIN_URL."/front-end-editor/build/editor$min.js" );
$css_path = ‘build/editor.css’;
}
Line #99 /wp-content/mu-plugins/front-end-editor/php/core.php
// Core style
//wp_register_style( 'fee-editor', plugins_url( $css_path, FEE_MAIN_FILE ), $css_dependencies, FEE_VERSION );
wp_register_style( 'fee-editor', WPMU_PLUGIN_URL.'/front-end-editor/'.$css_path, $css_dependencies, FEE_VERSION );
scbUtil::do_styles( 'fee-editor' );
Line #144 /wp-content/mu-plugins/front-end-editor/php/core.php
echo html( 'script', array(
//'src' => plugins_url( 'lib/aloha-editor/lib/aloha.js', FEE_MAIN_FILE ),
'src' => WPMU_PLUGIN_URL.'/front-end-editor/lib/aloha-editor/lib/aloha.js',
'data-aloha-plugins' => implode( ',', $plugins )
) ) . "\n";
People, I hope this help others but also I hope Scribu get to see this and comment something, as long as I have tried this, it works, but maybe he has something to say about my “fix” because remember this is not an official fix.
** Note for Scribu: I get this warning in Chrome: “event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future”. Maybe it can be fixed by using a more general attribute of the event?
Thanks a lot and best regards to all of you.
Davo.
As you can see in the comments of this post, I shared some thoughts with Scribu, Front-end Editor plugin’s author and after some research on the issue I found what I think is a bug (?) in the WordPress MU Domain Mapping plugin, so if you are having the same problem described in this post I’d say forget about hacking Front-end Editor plugin and try this new small fix in Domain Mapping plugin instead.
thoughts
]]>