Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: MSM & Entry Previews

Status Resolved
Add-on / Version Publisher Lite 1.6.10
Severity
EE Version 2.10.2

Nick Lane

Oct 06, 2016

Description:
We have an EE install using Publisher Lite that involves MSM. Any entries being managed that do not align with the domain used for login will always show our 404 on the entry preview after saving a draft or publishing. Is there a way to overcome this in anyway without requiring the user to logout and login to the CP under alternate domain names to make this work?

Detailed steps to reproduce the issue:
1. Login to CP via Domain A. Editing any entries on this site, the entry previews work fine.
2. Using EE MSM switcher, we change to a different site (Domain B) and try editing an entry here. Any saves give us our 404 page. This happens for any site that does not reflect the domain used to login to the CP with.

#1

BoldMinded (Brian)

There may be a way to fix this, but with my current work load it could be a few weeks.

#2

Nick Lane

Comment has been marked private.

#3

BoldMinded (Brian)

No updates, sorry. I’ll try to take a look this week though.

#4

Nick Lane

Comment has been marked private.

#5

BoldMinded (Brian)

Hi Nick. Publisher 1’s is at end of life next month and I have not been adding or changing anything in Publisher 1 unless its a critical security issue. I can take a look at this for Publisher 2 though.

#6

Nick Lane

Comment has been marked private.

#7

BoldMinded (Brian)

I can look into fixing it in Publisher 2, and if its minimal work to port to 1 I’ll just go ahead and do that, but if it turns out to be a couple hours or more of work I’ll let you know and we can discuss doing it as a small contract piece. I’m in the process of updating Wyvern Video to EE3 too, so its kind of a priority right now. I’ll do what I can though in the next week or so in looking into this.

#8

BoldMinded (Brian)

Just to confirm, I’m assuming when saving an entry in site B is showing the site url in the preview modal from site A (the default site), thus the 404?

#9

BoldMinded (Brian)

Are you saving an entry managed by Structure or Pages when this happens?

#10

Nick Lane

Comment has been marked private.

#11

BoldMinded (Brian)

Nick, instead of sending a full build I’d like you to try this change. Find the Publisher_helper_url.php file and go to line 250. Replace the get_site_url function with this and let me know if it works. Similar code seems to work fine in EE3.

public function get_site_url()
    {
        // If MSM isn't enabled, return as soon as possible with least resistance.
        if (ee()->config->item('multiple_sites_enabled') != 'y') {
            return ee()->config->item('site_url');
        }

        if (isset($this->cache['site_url'])) {
            return $this->cache['site_url'];
        }

        $prefs = ee()->db
            ->select('site_system_preferences')
            ->where('site_id', ee()->config->item('site_id'))
            ->get('sites')
            ->row('site_system_preferences');

        $prefs = unserialize(base64_decode($prefs));
        $siteUrl = $prefs['site_url'];

        // Slash it
        if ($siteUrl != '' && substr($siteUrl, -1) != '/') {
            $siteUrl .= '/';
        }

        $this->cache['site_url'] = $siteUrl;

        return $siteUrl;
    }
#12

Nick Lane

Just tested Brian…unfortunately it’s not changing the URL on the preview window. It’s still just pulling the domain I’m logged into at the moment.

I took your code above and simply replaced this line:

return ee()->config->item('site_url');
#13

Nick Lane

Have an idea…going to try something in addition to your update.

#14

Nick Lane

$siteUrl is being set properly to the MSM site domain in your function above, and I have to assume it’s being returned correctly with the next line “return $siteUrl;”. However, this must be overwrote elsewhere in the process, as it’s still outputting the URL I’m logged into.

#15

Nick Lane

Okay, a bit further on this…the pages channel on each MSM site uses the Pages Module for setting a template and URI. Under “Publisher - Preview Templates”, if I set a single template for this channel per site, the previews work on each site. However, in many cases it’s using the wrong template since I can only assign a single option for this channel. If I leave the preview template blank for all sites, the domain I’m logged into works with the correct templates chosen automatically, but I receive the “Page Not Found” for all other sites.

Login to reply