1

I've got an MSM installation with 2 sites (Site 1, Site 2). I'm building out a custom control panel menu using Zoo Flexible Admin. I would like my admin to be able to click a custom link in the CP which will:

  1. switch the MSM site from Site 2 to Site 1
  2. take them to a specific channel edit page on Site 1

I can't seem to figure out how to combine these two into a single link, as the CP url for switching sites seems to include a query string of "C=sites" and the link to a specific channel edit page also uses the query string "C=content_edit".

The reason for the season is that Site 1 holds a Member Profile channel (using Profile:Edit). I'd like my admin (who administers both Site 1 and Site 2) to be able to quickly go to this Member Profile channel from Site 2 (avoiding the extra step of having to switch sites first, and avoiding the confusing conversation where I try to explain why the admin must go to Site 1 to change settings for a Site 2 member).

0
+50

MSM switcher is encoded the current pages in base64 as

&page=Qz1jb250ZW50X3B1Ymxpc2h8TT1lbnRyeV9mb3JtfGNoYW5uZWxfaWQ9Mw__

if to decode it, we will get

C=content_publish|M=entry_form|channel_id=3

So you can coded your pages the same way, or the most simple way - go to a specific channel edit page on Site 1, click on MSM menu and just copy the link for current site.

update

no, this is not working because this function is commented in system/expressionengine/controllers/cp/site.php line 139 - 161

"// Commenting this out for the time being, as I'm not pleased with how it's working // Depending on the page you're on, you can be hit with PHP errors. So rather than // keeping this as is, we'll redirect to the CP homepage of the site switched to. // We should examine this in the future to see if a better experience for the end users // can be had."

     if ($this->input->get_post('page') !== FALSE && 
            preg_match('/^[a-z0-9\_]+$/iD', $this->input->get_post('page')))
     {
        $parts = explode('|', base64_decode(str_replace('_', '=', $this->input->get_post('page'))));

        $page = BASE;

        foreach($parts as $part)
        {
            if ($part == '' OR ! preg_match('/^[a-z0-9\_\=]+$/iD', $part))
            {
                continue;
            }

            $page .= AMP.$part;
        }
     }
     else
     {
        $page = BASE;
     }

so I don't see way do this w/o uncommend this lines or write ext. which will do the same.

| improve this answer | |
  • The problem is that when you follow the copied link from site 2, EE will switch to site 1 but it always redirects to the site 1 control panel home page instead of going to the page encoded in base64. – Josh KG Nov 21 '13 at 19:42
  • yes, you right, just add update into answer – Max Lazar Nov 21 '13 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.