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: Fatal error message completely preventing all use of the Control Panel after installing MSM

Status Resolved
Add-on / Version Publisher
Severity Trivial
EE Version 24

MDP Test

Mar 02, 2013

There seems to be an incompatibility between Publisher and MSM.

With a test install of a brand new ExpressionEngine, I installed a number of addons (Matrix, Playa, Stash, CE Images, CE Tweet, Low Variables, Safe Harbor, Wygwam, Publisher).  I then installed MSM and created two new sites.  On switching to a different site than the default, the control panel started returning nothing but 500 error messages.  Clearing cookies and restarting the browser allowed relogin to the control panel, but the behaviour returned after trying to switch a site again.

After turning on debugging, I found that after switching to another MSM site, the control panel returns the following error on any access:

A PHP Error was encountered
Severity: Notice
Message: Undefined property: Homepage::$publisher_helper_cp
Filename: models/publisher_model.php
Line Number: 125
Fatal error: Call to a member function mod_link() on a non-object in /srv/www/ipu.org.uk/ee/system/expressionengine/third_party/publisher/models/publisher_model.php on line 125

After uninstalling Publisher, the problem went away.

Why is this happening?

#1

BoldMinded (Brian)

Will look into it today, thanks.

#2

BoldMinded (Brian)

Open up the models/publisher_model.php file and go to line 124 or so and you’ll see

if ($copied)
{

Immediately after that { add the following:

if ($copied)
{
    $this->EE->load->library('Publisher/helpers/Publisher_helper_cp');
    $this->EE->publisher_helper_cp->set_cp_base_url();
#3

BoldMinded (Brian)

As for the 500 errors I’m unable to replicate that, but the code above fixed the error in the model file.

#4

MDP Test

Thanks Brian! I made the change suggested. The result is that the PHP error persists, but the error message changes to the following:

Fatal error: Call to undefined method stdClass::userdata() in /srv/www/ipu.org.uk/ee/system/expressionengine/third_party/publisher/libraries/Publisher/helpers/Publisher_helper_cp.php on line 238
#5

MDP Test

The following are the system cookies (which must have some relation to the issue, since clearing them makes the CP respond again until the next MSM site switch):

Name: exp_publisher_site_status Content: open Domain: .ipu.org.uk

Name: exp_sessionid Content: f1f4571a0b1a61496bdba75e5b2532bf9fc8ce85 Domain: .ipu.org.uk

Name: exp_cp_last_site_id Content: 2 Domain: .ipu.org.uk

Name: exp_expiration Content: 1393850076 Domain: .ipu.org.uk

Name: exp_expiration Content: 1393784417 Domain: .ipu.org.uk

Name: exp_last_activity Content: 1362314008 Domain: .ipu.org.uk

Name: exp_last_visit Content: 1362248275 Domain: .ipu.org.uk

Name: PHPSESSID Content: d7hnmtcji1uj407citm40uv3a6 Domain: www.ipu.org.uk

#6

MDP Test

(the last cookie is in a different domain than the rest - might that be the cause of the problem?)

#7

BoldMinded (Brian)

So after clearing your cookies everything works as expected?

#8

MDP Test

Yes, but only until the next MSM site switch. The sequence of events is currently as follows:

  1. Clear all cookies, restart browser and log in to CP -> all normal
  2. Switch to another MSM site than the default -> All CP access gives Publisher Fatal Error as above
  3. Clear all cookies, restart browser and log in to CP -> all normal again
  4. Repeat 2., same result as before.

I hope this is clear.

#9

BoldMinded (Brian)

That is strange. I was able to replicate your issues, but after I made the change it works fine for me locally. I can’t get to your CP with the provided info, it is a 404. What does the data in your exp_publisher_languages table look like? Specifically the sites column. With multiple sites it should look like this for each language.

a:2:{i:0;s:1:”1”;i:1;s:1:”2”;}

#10

MDP Test

This is what it has:

mysql> select sites from exp_publisher_languages; +——————–+ | sites | +——————–+ | a:1:{i:0;s:1:”1”;} | | a:1:{i:0;s:1:”1”;} | +——————–+ 2 rows in set (0.00 sec)

mysql>

The Admin CP should be up now - you may have tried to get to it when I was mucking around with debugging.

#11

Brian Litzinger

If you have 2 sites, you need those values to equal

a:2:{i:0;s:1:“1”;i:1;s:1:“2”;}

So manually update those columns and it should work.

#12

MDP Test

Hi Brian - Please clarify what you mean? I ran the command below, and the CP immediately started giving me a dozen PHP errors of the sort “Severity: Notice Message: unserialize(): Error at offset 9 of 38 bytes Filename: models/publisher_model.php Line Number: 106” - Also, is there a reason why this table would be incorrectly populated on install? All I did was activate Publisher from the Extensions menu and then use the Publisher menu to add the French language with code fr. Thanks

mysql> update exp_publisher_languages set sites=’a:2:{i:0;s:1:“1”;i:1;s:1:“2”;}’; Query OK, 2 rows affected (0.00 sec) Rows matched: 2 Changed: 2 Warnings: 0

mysql>

#13

BoldMinded (Brian)

The first errors you got might have caused this column to not update properly.

Lets try this, b/c I got another error when adding another site. In the Publisher_helper_cp.php file, find the set_cp_base_url() method around line 233 and change it to this:

public function set_cp_base_url()
    {
        if (REQ == 'CP')
        {
            //just to prevent any errors
            if (isset($this->EE->session) AND isset($this->EE->session->userdata))
            {
                $session_id = $this->EE->session->userdata('session_id');
            }
            else
            {
                $session_id = 0;
            }

            $s = ($this->EE->config->item('admin_session_type') != 'c') ? $session_id : 0;
            $base = SELF.'?S='.$s.'&D=cp';

            $this->base_url = $base.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=publisher';
            $this->form_base_url = 'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=publisher';
        }
    }

The run that same query you ran, but update it to this:

a:3:{i:0;s:1:”1”;i:1;s:1:”2”;i:2;s:1:”3”;}

I thought you had 2 sites, but it looks like you have 3.

#14

MDP Test

Thanks Brian,

  1. I made the change to the file above.
  2. I uninstalled and reinstalled Publisher
  3. On switching sites, it now gives me a warning that the languages are not installed for the given site, and tells me that it has copied them over (does this indicate a misconfig of my MSM install??)

The PHP errors have gone away and it all seems to be working fine. Will the file change be included in an upcoming Publisher release?

Best,

Login to reply