The MU forums have moved to WordPress.org

Domain Mapping & the WP uploader (46 posts)

  1. andrea_r
    Moderator
    Posted 14 years ago #

    Don't login to the subdomain anymore either. it's not there.

  2. fzeidan
    Member
    Posted 14 years ago #

    Hello guys,

    I'm a developer at heart, and I was looking into the domain mapping plugin to use on my project.

    After searching online for feedback about this control, I noticed few issues reported by the control. I decided to go through MU code and see what is going on under the hood.

    1. The plugin should not work if using a port. The code in sunshine.php bypasses the functionality of wpmu-settings.php which strips the port stripping.

    This can be resolved by using the code in wpmu-settings.php page at the top.

    2. The plugin only works if using subdomain. This could easily be fixed, but will require little more php experience before you can change it.

    3. I do not see anywhere in the code where one might have an issue with logging in.

    Andrea, you mentioned in a previous post that

    "you need to go to Site Admin -> Edit Blog and edit sub.domain1.com and change all the fields from that to the mapped domain."

    which if I understood you correctly, that means you can only have one domain mapped per blog. sorry have not confirmed this, just saw the comment as I was posting.

    I imagine this could be resolved and allow multiple domain to single blog.

    Any other issues you guys are having so I can look into and fix while I am at it?

    I plan on modifying the plugin to resolve these issues for my site, I won't release it of course since it is not my own, but you guys welcome to have it once done.

    It only takes couple of hours to resolve these issues, if these are all the issues in the plugin.

    I have no interest however with modifying the admin interface however because I will be creating a new interface for my project.

    Overall, the plugin is very simple and a clever implementation and there is no reason for it not to work.

    I would imagine wordpress.com rewrote wpmu-settings.php directly and did not write a plugin.

  3. andrea_r
    Moderator
    Posted 14 years ago #

    "I imagine this could be resolved and allow multiple domain to single blog. "

    For this, I got the blog owner to choose a *primary* domain to map to the blog. I mean, they gotta pick one. For the extra domains, I used htaccess.

    "I won't release it of course since it is not my own,"

    It's released under GNU, so you can do what you like with it, although I'm sure the author (Donncha, the guy who works on WPMU for Automattic, the people behind wp.com) wouldn't mind a heads up.

  4. Klark0
    Member
    Posted 14 years ago #

    While the Site Admin -> Edit Blog fix works for me with the uploader issue, it does not work out very well for when the user decides to unmap or change their domains. All the image links become broken, custom headers die, etc....

  5. Trent
    Member
    Posted 14 years ago #

    **Edit** Thought it might be flash 10, but reading other posts since, it looks like you know about that one already.

  6. Frumph
    Member
    Posted 14 years ago #

    I found with the Site Admin -> Edit Blog fix when you have subdomains makes the subdomain available again to the available pool. So what I do is just add to the donncha's mapping the previous url. so it still goes to that address but still doesn't

    What would be nice is if whatever domains are registered with the plugin can't be used in the pool of available.

    And the top level domain used is the primary.

  7. fzeidan
    Member
    Posted 14 years ago #

    I know this is little technical to some, but might inspire someone to try something :)

    Looking through the code, the issue is that some links are stored in posts, and in options by plugins.

    The issue with having multiple domains, or changing the domain is that the change or extra domain do not affect what is saved posts..etc.

    Ideally, you want all internal links to be relative links and not include the full URL, for example you want:

    /MyBlogPage.php
    not
    http://host.com/MyBlogPage.php

    By having a relative path, the browser will always know how to render the pages regardless of the domain name.

    This brings up the option of hooking to the few domain specific hooks pre_option_siteurl, home, category_base...etc. resolve the problem.

    However, if you have some pages that require SSL/https access, you cannot use relative path since your url will need a full url if moving between https and http on same site.

    I can't say I cought all issues, but i see the following option:

    create a php function in sunshine.php that takes a string and replaces the stored unmapped path in Site Admin->Edit Blog (username.mydomain.com) with $currentsite->domain which will contain the domain the user used to access the site.

    So theoretically this should replace:

    http://username.mydomain.com/index.php
    with
    http://www.username.com/index.php

    Next, create hooks for this method on

    all_content
    header (not sure exact name)
    footer (not sure exact name)
    all_permalink (may not be required since results are in all_content)
    all_permalink_rss (may not be required since results are in all_content)

    Make sure the hooks are towards the end (need higher priority value).

    This should replace all saved links with the existing domain the user used to access the site and mimic the behavior of relative links.

    I'm sure I lost some of you, but this would solve these issues because:

    1. in Frumph's scenario, the siteurl and home continue to behave as MU expect it to (username.domain.com) and will not duplicate the site.

    2. in Klarko's scenario the plugin does not require any change to the MU system and should not affect other plugins, it will simply replace what gets displayed on the screen.

    3. In my scenario, I can use multiple domain mappings to same site.

    There is no telling how other plugins will behave because god knows how people code now a days.

    I will work on it if I have time, I know I will need it for my project so I decided to spend the time to make sure MU is a feasible option.

    I have a feeling MU 2.7 will have domain mapping built in :) having it built in saves us lots of trouble.

  8. andrea_r
    Moderator
    Posted 14 years ago #

    "it does not work out very well for when the user decides to unmap or change their domains"

    But that would still apply in the case of a single-WP user who decided to change domains. :)

    on WP.com, they keep the subdomain URL, and use the domain mapping as-is. There's another piece of the process they do (aside from charging for it) that is not in the released plugin.

    "I have a feeling MU 2.7 will have domain mapping built in :) "

    No, it doesn't, actually.

  9. Trent
    Member
    Posted 14 years ago #

    I noticed today that it gets borked for me if I am not logged into both my mapped domain and the main site when I try to upload things. Being logged into one isn't enough. That is one thing that is missing in the domain mapping plugin is "remote login" for both domains.

  10. andrea_r
    Moderator
    Posted 14 years ago #

    Yep, I think you're right.

  11. realsol
    Member
    Posted 14 years ago #

    andrea_r,
    I too was having a problem with the blank white screen. After reading this post, I fixed it by changing all urls in the blogs>edit screen.

    Do you know if anything has been done about what happens if a user wants to change their domain back to a sub domain. I charge for domain mapping. But if I have to change all the url's (blogs>edit) when mapping, and change when unmapping, it will still break all of the links, right?

    Anyway around breaking all of the links? Also, what happens if another user uses the old subdomain.name. I figured it was protected until I realized it no longer is after changing all urls to the domain name.

  12. Klark0
    Member
    Posted 14 years ago #

    Yeah this is still an issue for me too. It works, but it's a nightmare if the user decides to change or revert their blog domain.

  13. levi.putna
    Member
    Posted 14 years ago #

    I am also having this problem, I have changed Domain, Siteurl, Home, Upload Path and Fileupload Url under Site Admin -> Edit Blog to the mapped domain, however any new media inserted still uses the subdomain url giving me a broken link, any thoughts n why this is happening?

    In addition it seems to me that the real problem is with the Media Uploaded, if the current url (in the address bar) is different to the url in Site Admin -> Edit Blog -> Domain the media uploaded will go blank upon clicking the "Insert Image into Post"
    Buttion. If this problem could be fixed there would be no need to change the options under Site Admin -> Edit Blog.

  14. drinkingteddy
    Member
    Posted 14 years ago #

    Good reading guys.. Same issue here.. blank page when inserting image into a post. Adding the media path into a posts html also fails.

    We're not overly happy editing blog paths by hand (or through a workaround) because of the reverting back to subdomain issue others have mentioned..

    Looks like were gonna have to start writing some additional code - unless anyone has a more simplistic answer

  15. Ovidiu
    Member
    Posted 13 years ago #

    currently doing my first tests with the domain mapping plugin and somethign werid I notice is that in the back end of a mapped domain, I cna't see the admin menu icons :-(

    checking source code, paths and css showed all is fine the urls to the menu icons are right but they are still not showing :-( tried hard refreshing a couple of time but no use :-(

    anyone else experienced this problem?

    here is an example: http://klub-kamikaze.com/ viewed from here it lacks all images, even the smiley isn't showing despite a couple of refreshes. though if I access the smiley url its showing? http://klub-kamikaze.com/wp-includes/images/smilies/icon_smile.gif

    checked the theme code, it seems the backgrounds are loaded as relative paths, like: images/sidebar-middle-bg.jpg so appending that to the mapped domain breaks.

  16. Atulesh
    Member
    Posted 13 years ago #

    My friends i extracted all files related to WP html editor bcoz i only want to use this editor on my web site and it work on my site..now Y the problem of insert into post ..I am also being crazy.
    This is strange that no one suggest the technical solution/problem. I am confuse if any domain related problem and mix url problem exist (from admin Setting/general ) etc etc.
    The problem comes from two files media-upload.php (belongs to wp-admin\media-upload.php) and media-upload.js(wp-admin/js/medail-upload.js)
    This code win.send_to_editor('<?php echo addslashes($html); ?>'); in file media-upload.php does not call javascrip function send_to_editor(b) from media-upload.js(wp-admin/js/medail-upload.js).
    the main work to assign image from image uploader panel to textarea goes to a.execCommand("mceInsertContent",false,b) from media-upload.js. But i am still in problem y sometime it does not invoke. Well i wll mail the exact solution of it soon ..just now i am using 2.8.4 and looking if this too give same problem.

About this Topic