Version 2.1.5 multisite [options not saving on child blogs]

This topic contains 12 replies, has 2 voices, and was last updated by  Sebastian 6 years, 1 month ago.

Author Posts

Abland

Notice: this information was written when Microthemer version 2 was current. On Dec 26th, 2014 version 3 was released with a completely new interface. Some of the information may be redundant, but as much of the functionality remains the same in version 3 we haven't deleted this post.

Hi,

I upgraded to the recent version 2.1.5, and multisite themes on sub blogs behave as though the microtheme was deactivated. It worked properly on version 2.1.2, though.

I did notice that in the microtheme’s options there’s only “Delete” and no option to Deactivate or Activate.

I tried saving the options again to the theme and it said saved and activated but it still behaved as if deactivated.

I exported the microtheme, then deleted, then uploaded my backup which seemed to install automatically with no option to activate, and again still behaved as though not activated.
I reverted to 2.1.2 then upgraded again to 2.1.5 but still the same issue.

Wordpress is current, it’s multisite, and I’m using an Artisteer theme on the blog and sub blogs. I’ve had to revert to 2.1.2 because it’s a production site.

Thanks.

** NOTE: I cannot confirm whether the main blog behaves activated or deactivated as it was not designed via Microthemer


Sebastian

Ah, this is probably something to do with a change I made to get-dir-paths.inc.php where it checks the version number for backwards compatibility with pre WP 3.0 versions. There’s probably a mistake in the logic there.

I will look into this now…

Cheers,

Seb


Abland

Hi, Sebastian,

Confirmed. When I remove the version check it works. I’ve tried rewriting the version check a few ways and haven’t hit the correct way yet. I’ll post if I find it.

Thanks for the quick reply 🙂


Abland

Hi again, Sebastian,

Maybe this:

global $wp_version;
if ($wp_version >= ‘3’):
if (is_multisite()) {
global $blog_id;
$this->micro_root_dir = $wp_content_dir . ‘/blogs.dir/’ . $blog_id . ‘/micro-themes/’;
$this->micro_root_url = $wp_content_url . ‘/blogs.dir/’ . $blog_id . ‘/micro-themes/’;
}
else {
$this->micro_root_dir = $wp_content_dir . ‘/micro-themes/’;
$this->micro_root_url = $wp_content_url . ‘/micro-themes/’;
}
endif;

I changed my version file to 2.5 but cannot confirm the above works as my theme also required version 3 or higher.

Just confirmed it works as changed above to require 3.2 and set my wp to 3.1 and Microthemer gave me the alert about version.


Sebastian

Hey,

Your code would make all WordPress versions 3 or later not have any values set for micro_root_dir and micro_root_url (if not multi-site)

Could you see if this works on multi-site please?


global $wp_version;
if ($wp_version >= 3 and is_multisite()) {
global $blog_id;
$this->micro_root_dir = $wp_content_dir . '/blogs.dir/' . $blog_id . '/micro-themes/';
$this->micro_root_url = $wp_content_url . '/blogs.dir/' . $blog_id . '/micro-themes/';
}
else {
$this->micro_root_dir = $wp_content_dir . '/micro-themes/';
$this->micro_root_url = $wp_content_url . '/micro-themes/';
}


Abland

Good Catch, Sebastian,

I didn’t realize I had cut off all the options. (And people pay me to code – lol 🙂 )

Yes, the above code works.


Sebastian

Great! Thanks for your help Abland.

I removed the Activate Link from the Manage Theme page because the user can achieve the same result by importing their theme via the Microthemer UI (with the overwrite method). I decided it was best to only have one way to do this to prevent people from accidentally overwriting their work on the UI page. The connection between the UI and activating a Micro Theme isn’t necessarily obvious.

I will release version 2.1.9 shortly which will contain the multi-site fix and some additional CSS properties (min/max width and height and cross-browser opacity).

Cheers,

Seb


Abland

Hi, Sebatian,

The code does throw errors on a lower WP version. What if leave as only a multisite check and do versioning in “tvr-microthemer.php”?

global $wp_version;
if ($wp_version >= 3 ) { }
else {
add_action(
‘all_admin_notices’,
create_function(
”,
‘echo ‘Microthemer requires WordPress® version 3 or higher to function fully.’;’
)
);
}

I modified some of your own coding for the above. This way it doesn’t throw the errors but does keep the admin notice in the blog and the network admin, too.


Sebastian

Hey,

Did you adjust the version number on your multi-site testing server? Because I just tested the code I suggested on a regular 2.8 install of WordPress and it works fine…

I’d prefer to keep supporting older version if possible.

Cheers,

Seb


Abland

On my multisite the errors were for not finding the theme directory. Current code requires version 3 or higher for multisite to work. The alert for tvr-microthemer.php allows it to continue working but just adds a notice to the top of the admin pages, including network admin.

Basically use the original if is_multisite without version check. Then use the admin notice in tvr-microthemer.php instead.


Sebastian

WordPress will throw a fatal error if the is_multisite() function gets called on older versions of WordPress. Hence the version check just before the call (if it returns false PHP won’t even evaluate the 2nd condition, so no fatal error).

I think I may be beginning to get a bit lost in what you’re saying now though lol! 🙂

Seb


Abland

My error – the code works fine. Multisite didn’t exist prior to version 3. My test was on multisite and versions were hypothetical.

Quote me: (And people pay me to code – lol 🙂 )


Sebastian

Right, gotcha. And don’t worry, I make these kind of mistakes all day long!

Cheers,

Seb

You must login or register to reply to this topic.