Support » Plugin: Front-end Editor » [Plugin: Front-end Editor] Frontend Editor and WordPress MU Domain Mapping plugins

  • Hello everyone, specially to Scribu who made this awesome plugin posible.

    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="<strong>http://mapped-domain.coms</strong>" ...

    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:

    1. I compared the source code present in a blog with mapped domain and another without it, one of the missing files was “aloha.js”
    2. Opened /wp-content/mu-plugins/front-end-editor/php/core.php, and started looking for “aloha.js”, found it around line 144:
      'src' => plugins_url( 'lib/aloha-editor/lib/aloha.js', FEE_MAIN_FILE ),
    3. Ok so, plugins_url( ‘lib/aloha-editor/lib/aloha.js’, FEE_MAIN_FILE ) was returning a wrong path to the file (a very wrong one), it seems that it just adds an “s” (from “.js” maybe?) to the end of the mapped domain, don’t know why and didn’t researched more about it, since I was focused on getting it working for now.
    4. In order to retrieve the right URL I replaced that piece of code with this: WPMU_PLUGIN_URL.’/front-end-editor/lib/aloha-editor/lib/aloha.js’. That did the trick by retrieving the URL as if it was a no-mapped domain, this means that you will include the file from: subdomain.mynetwork.com instead of from mappeddomain.com, which is fine, the file is actually there.
    5. Once that was done, I looked for other similar problems, and found the same issue with editor.min.js, editor.css and aloha.css and other ones that are included when the plugin’s debut mode is enabled.

    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 ) ) {
    			<em>//wp_register_style( 'aloha-editor', plugins_url( 'lib/aloha-editor/css/aloha.css', FEE_MAIN_FILE ), array(), ALOHA_VERSION );</em>
    			<strong>wp_register_style( 'aloha-editor', WPMU_PLUGIN_URL.'/front-end-editor/lib/aloha-editor/css/aloha.css', array(), ALOHA_VERSION );</strong>
    			$css_dependencies[] = 'aloha-editor';
    		}

    Line #92 /wp-content/mu-plugins/front-end-editor/php/core.php

    } else {
    			$min = defined('SCRIPT_DEBUG') ? '' : '.min';
    			<em>//self::register_script( 'fee-editor', "build/editor$min.js" );</em>
          <strong>wp_enqueue_script( 'fee-editor', WPMU_PLUGIN_URL."/front-end-editor/build/editor$min.js" ); </strong>
    
    			$css_path = 'build/editor.css';
    		}

    Line #99 /wp-content/mu-plugins/front-end-editor/php/core.php

    // Core style
    		<em>//wp_register_style( 'fee-editor', plugins_url( $css_path, FEE_MAIN_FILE ), $css_dependencies, FEE_VERSION );</em>
    		<strong>wp_register_style( 'fee-editor', WPMU_PLUGIN_URL.'/front-end-editor/'.$css_path, $css_dependencies, FEE_VERSION );</strong>
    		scbUtil::do_styles( 'fee-editor' );

    Line #144

    echo html( 'script', array(
    		<em>//'src' => plugins_url( 'lib/aloha-editor/lib/aloha.js', FEE_MAIN_FILE ),</em>
    		<strong>'src' => WPMU_PLUGIN_URL.'/front-end-editor/lib/aloha-editor/lib/aloha.js',</strong>
    		'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.

    PS: I also published this article in my website: http://davoscript.com/2012/02/07/front-end-editor-and-wordpress-mu-domain-mapping-plugins/

    http://wordpress.org/extend/plugins/front-end-editor/

Viewing 8 replies - 16 through 23 (of 23 total)
  • Ok – no avail – Did you have any luck: diesel12 ??

    I’ve the same problem as you.

    Cheers

    Here is what i get;

    <script type="text/javascript">var ajaxurl = "http://elliottaylor.com/wp-load.php";</script>

    Where elliottaylor.com is the remapped domain and the WPMU main domain is at artfulworks.co.uk

    Any ideas? Thanks for the help

    Plugin Author scribu

    (@scribu)

    That is from another plugin. FEE uses admin-ajax.php.

    Thanks for spotting that. I’m not too confident what to do with this, although it is from FEE – Any ideas? Thanks Scribu

    </script><script type='text/javascript'>
    var FrontEndEditor = {};
    FrontEndEditor.data = {"edit_text":"Edit","save_text":"Save","cancel_text":"Cancel","add_buttons":false,"spinner":"http:\/\/elliottaylor.com\/wp-admin\/images\/loading.gif","ajax_url":"http:\/\/elliottaylor.com\/wp-admin\/admin-ajax.php","nonce":"e5b218a311","image":{"url":"http:\/\/elliottaylor.com\/wp-admin\/media-upload.php?post_id=0&editable_image=1&TB_iframe=true&width=640","change":"Change Image","insert":"Insert Image","revert":"(Clear)","tb_close":"http:\/\/elliottaylor.com\/wp-includes\/js\/thickbox\/tb-close.png"}};
    </script>

    Ok – Found this… Looks very complicated though:

    Ajax is going to return an empty response in WP3.x.x MultiSite (with domain mapping) because, by design (in FF), ajax does not allow calls to a different domain (if not in jsonp as it’s the case).

    Th issue is that WP inits all the scripts with the siteurl domain (e.g. sub.mysite.com), but when the admin is invoked within a mapped site (www.mymappedsite.com) the ajax call needs to happen within that mapped domain too.

    http://wordpress.org/support/topic/empty-ajax-response-multisite-fix?replies=3

    @norilse: Unfortunately we had no luck and your last response may be the reason why …. we would LOVE to get this type of plugin working on a multisite install …. it will happen soon enough, but this plugin looks great, so we’ll see if anything changes in the future to enable multisite functionality …. 🙂

    I’m not using the WPMU plugin anymore as it is not compatible. Instead I’m using the dev edition of the Remapping Plugin from the wordpress repository and then deselected the options in settings – it now works. But it seems a compromise is that if you log onto the main site and then go to a child site, you have to login once again.

    Fix one problem and another pops up!

    If you are having login issues with child sites, that may be a cookie problem …. something that may be related to your different authentication keys and salts in wp-config ….. that has been my experience in the past at least. So you’re able to get FEE working when using reverting from WPMU mapping plugin to another mapping plugin… interesting. 🙂

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘[Plugin: Front-end Editor] Frontend Editor and WordPress MU Domain Mapping plugins’ is closed to new replies.