Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Unyson framework and extensions auto activation

Open ziuzea87 opened this issue 11 years ago • 9 comments

Ive been using your Unison framework for few days now, and it seems no doubt very usefull plugin. I was just wondering, is it possible to automatically include extensions for my theme and also that they are allready activated. Im asking this, because I was thinking about to build a theme with this framework, and it would be much more easier for users if all necessery extensions were ready to use allready, when they install my theme.

ziuzea87 avatar Dec 18 '14 23:12 ziuzea87

At the moment, if extensions is a first level extension (not a sub-extension) and has in its manifest.php:

$manifest['display'] = false; // not visible on the Unyson Extensions page
$manifest['standalone'] = true; // can exist alone, without being required by some other extension

then it is activated automatically.


In the database is stored a list of extensions that are active ['portfolio', 'styling', ...], those extensions are activated. If the user click on the "Disable" button, the extension is removed from that list.


If all extensions that are located in the theme (including visible) will be activated automatically, how the user will be able to disable one that it doesn't need ?

ghost avatar Dec 19 '14 10:12 ghost

Thank you for your reply. Im using Unyson as a plugin, so am I still able to use manifest.php, or do I need to include Unyson bundled with the theme?

ziuzea87 avatar Dec 21 '14 23:12 ziuzea87

You don't need to include it bundled with the theme, because you theme will not pass the themecheck verification. You are able required to use manifest in your extension.

ghost avatar Dec 22 '14 05:12 ghost

I really hate to be a pain in the ass, but all my extensions have already: $manifest['standalone'] = true;

in their manifest.php file. I also tried to create a new manifest.php file in my theme and call the extension from it, but it did nothing to it. So there is still something, I just cannot get it.

What Im trying to do here, is to get certain extensions downloaded and activated automatically, when user installs my theme and Unyson framework from WordPress repository, as a plugin. So what exactly I need to add and in which file to get this thing to work?

ziuzea87 avatar Dec 22 '14 15:12 ziuzea87

all my extensions have already: $manifest['standalone'] = true;

Not only the 'standalone' parameter does the auto-activation, but the combination of these two parameters:

$manifest['display'] = false;
$manifest['standalone'] = true;

// also the extension must be a first level extension, not a sub-extension

This was done because it's impossible to activate manually hidden extensions that are not required by other extensions. But I am not sure if your extensions are hidden, so this may not be the solution for your question.

What Im trying to do here, is to get certain extensions downloaded and activated automatically, when user installs my theme and Unyson framework from WordPress repository, as a plugin. So what exactly I need to add and in which file to get this thing to work?

For this we created the supported_extensions parameter in the theme manifest

/**
 * Extensions compatible with the theme
 * After plugin activation, the user will be redirected to a page to install these extensions
 */
$manifest['supported_extensions'] = array(
    /*
    'extension_name' => array(),
    */
);

You can test it:

  • Delete some of the "Compatible with your current theme" extensions
  • Deactivate Unyson plugin
  • Active the Unsyon plugin

Then you will be redirected to a page to install all not installed compatible extensions.

Unfortunately the extensions from theme will not be in that list and will not be activated, also already installed supported extensions will not be activated. But we fixed that recently in v2.1.10, so please update and let us know if it works as expected.

ghost avatar Dec 22 '14 19:12 ghost

Bundling the /framework/ directory with: require dirname( FILE ) . '/framework/bootstrap.php'; and editing the extensions manifest.php file seems to make the extension work exactly as I want, so thanks for your help. This framework generates anyway lots of errors with ThemeCheck, as you mentioned allready. I hope there will be a fix for this, because I don't know how those different marketplaces will take this(?)

ziuzea87 avatar Dec 23 '14 11:12 ziuzea87

Bundling the /framework/ directory with: require dirname(__FILE__) . '/framework/bootstrap.php'; This framework generates anyway lots of errors with ThemeCheck. I don't know how those different marketplaces will take this(?)

That's why we moved the framework from theme to plugin, to be accepted on marketplaces.

We don't recommend include it in theme, use it is as plugin if you want to sell your theme on marketplaces (In your theme you can install the TGM-Plugin-Activation script, like in Scratch Theme). But if you build your theme for another purpose (not selling it) then you can use the framework however you want.

ghost avatar Dec 23 '14 11:12 ghost

@moldcraft I love the TGM Plugin Activation script but I need a few patches. 1.I do not want to show module activation page.Rather I want to auto install the extensions those I dropped in framework/extension folder.

webangon avatar Dec 24 '14 19:12 webangon

@webangon Please open separate issue and give us more details.

ghost avatar Dec 25 '14 08:12 ghost