Domain mapping & Javascript issue

I’m having problems with WP-Polls and Domain Mapping.

On regular blogs, WP-Polls works fine, but on blogs with their own domain through domain mapping WP-Polls doesn’t seem to ahve permission to run javascript. I’ve tried to chmod the js file but it doesn’t seem to work.

Anyone got an idea of what can be done?

  • Qlof
    • The Crimson Coder

    The problem seems to be that the page is trying to load the javascript from the blogs subdomain and not from the new domain. Maybe this can be fixed in domain mapping, so that javascript calls are made to the users domain?

  • Barry
    • DEV MAN’s Mascot

    If the wp-polls is using get_option, then the domain mapping plugin will replace it with the correct setting.

    What version of wp-polls are you using and can you provide me with a link to it and I will have a quick look and see if I can work out the issue.

  • Qlof
    • The Crimson Coder

    Not sure I understand your question but there is a function called plugin_basename to find the base dir. Maybe it can be manipulated.

    There is also a file wp-content/plugins/wp-polls/polls-js.js where a bunch of javascript calls are gathered.

    Example: wp_enqueue_script(‘wp-polls’, plugins_url(‘wp-polls/polls-js.js’:wink:, array(‘jquery’:wink:, ‘2.50’, true);

  • Barry
    • DEV MAN’s Mascot

    If the plugins_url function uses get_option(‘home’:wink: or get_option(‘siteurl’:wink: to get the address of the site/blog, then the domain maping plugin will convert it to the correct address. If it builds its own then it won’t.

    So just want to have a quick check to see if it’s a simple fix like that, or something more indepth :slight_smile:

  • Aaron
    • Ex Staff

    Tracing source, plugins_url() gets domain from WP_PLUGINS_URL which gets it from WP_CONTENT_URL which in turn uses get_option(‘siteurl’:wink:.

    So that shouldn’t be the problem. Though get_option(‘siteurl’:wink: is called in wp-settings.php, which is probably loaded before our domain mapping filter. If so Barry you could use the ‘plugins_url’ filter.

  • Mason
    • DEV MAN’s Sidekick

    I am noticing this same problem with the wp e-Commerce plugin. If the site has domain mapping enabled then the javascript functions no longer work, but with domain mapping turned off, everything works as expected.

    I’ve emailed the plugin developers to see if a similar resolution can be found for them. I’d like to hear what you guys eventually find here as well.

    Thanks.

  • -
    • New Recruit

    I bet this might be related to what’s causing our problem with "Preview Post" function for users with domains assigned to their account as well. They’re all getting a "permission denied" error when they try to preview posts, but can otherwise make posts and function in the back-end without problem…..

  • -
    • New Recruit

    @Andrew

    No, when you first click on "preview" it tries to open the preview to the unmapped domain, then you get auto-redirected to the mapped domain, which then gives you the "You do not have permission to preview drafts." error.

  • -
    • New Recruit

    @Aaron+Andrew

    Actually I spoke a bit too soon, it’s not just previews of the premium themes, but previews in all themes, which I would assume means it’s not an issue with the supporter plugin itself.

    It seems to only be happening if you log into the subdomain, but as there are things in the backend of the mapped admin area that tend to redirect you back to the subdomain, and as I’ve found that most of our users on several of our sites are logging into their subdomain admins anyway (thats what they were use to before they upgraded, have bookmarked, etc), this is indeed the source of problem for the end-user.

    Thanks as always guys!

  • -
    • New Recruit

    Thanks so much for the update.

    Unfortunately, a few bugs remains.

    If you have a domain mapped to an account, but are logged in to the subdomain, and attempt to preview posts you get "You do not have permission to preview drafts."

    If you have a domain mapped to an account, but are logged in to the subdomain, and attempt to preview a theme, the preview window is of the theme already assigned to the account, and not of the one you’re attempting to view.

  • Barry
    • DEV MAN’s Mascot

    @Inspirosity

    Can you do me a favour. Can you load the page, in something like firefox with the firebug extension, with the Net tab open.

    Have a look down the list of files on there and tell me if any are from the "alternate" domain. e.g. if you are logged into the subdomain, then any that are from the mapped domain and vice versa.

    There should be a single file loaded from the alternate domain, but if there are more than that(in particular javascript files) then it may still be missing a filter.

    @qlof

    If you have WPMU translated, then you should have the WP_LANG define set in your config file. The translation files for the domain mapping plugin should go in the same directory but have the name format in the changelog (domainmap-en_US.mo) – change the en_US bit to whatever the locale of the language in the translation is.

  • -
    • New Recruit

    @Barry

    The problem is basically if the user logs into their account from the primary MU domain (instead of their subdomain or mapped domain), they get redirected to their subdomain dashboard, instead of to their mapped domain dashboard.

    Once they’re in there, everything’s mucked…….

  • Barry
    • DEV MAN’s Mascot

    Hi

    At the moment if they log in to the main domain (not their subdomain blog) then the domain mapping plugin shouldn’t do anything as their isn’t a mapped domain for the main domain.

    It will only kick in IF they log in to their subdomain blog address OR they log in to their mapped domain blog address.

    That is, if I am reading your message correctly.

  • sabbella
    • Design Lord, Child of Thor

    Hi Barry,

    This issues:

    "If you have a domain mapped to an account, but are logged in to the subdomain, and attempt to preview published posts you get "You do not have permission to preview drafts."

    **If the post is not published (draft) you get "Sorry, no post" (in the blog)

    If you have a domain mapped to an account, but are logged in to the subdomain, and attempt to preview a theme, the preview window is of the theme already assigned to the account, and not of the one you’re attempting to view."

    I installed the 2.0 domain mapping plugin, but it doesn´t fix it,

    Thank you

  • sabbella
    • Design Lord, Child of Thor

    Anyone? any help to fix this bugs of the domain mapping plugin will be greatly appreciated:

    This issues:

    “If you have a domain mapped to an account, but are logged in to the subdomain, and attempt to preview published posts you get “You do not have permission to preview drafts.”

    **If the post is not published (draft) you get “Sorry, no post” (in the blog)

    If you have a domain mapped to an account, but are logged in to the subdomain, and attempt to preview a theme, the preview window is of the theme already assigned to the account, and not of the one you’re attempting to view.”

    Thank you