TGMPA / TGM-Plugin-Activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install, update and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference bundled plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
http://tgmpluginactivation.com/
GNU General Public License v2.0
1.76k stars 430 forks source link

Getting non WP hosted plugins to install #620

Closed hallshouse closed 8 years ago

hallshouse commented 8 years ago

Hi:

You've really done some great work with TGM Plugin Activation. It makes my child-theme development so much more professional being able to let users choose required and recommended plugins as well as automatically force the installation and activation of critical plugins.

Awesome work to the team!

I have to point out, however, that it does not seem to work when I attempt to install plugins from a non-WP.org site. I'm installing 2 ElegantThemes plugins; one is a free plugin for those Divi theme instances that are registered - like my child-theme is (i.e. If you do not own Divi, you would never even be able to install my child-theme anyhow). and the second is also dependent on Divi, but is OS on GitHub.

The issue is, for both plugins, the "external_url" are on Elegant Themes and GitHub respectively, and I have entered the URLs, but still get the Something went wrong with the plugin IPA message when trying to activate the plugins.

Any idea what could be done to correct this?

Here's my code:

array(
    'name'      => 'Monarch Plugin',
    'slug'      => 'monarch',
    'source'    => get_stylesheet_directory() . '/inc/plugins/monarch.zip',
    'required'  => false,
    'external_url' => 'http://www.elegantthemes.com/plugins/monarch/',
),
array(
    'name'      => 'Article Card',
    'slug'      => 'divi-100-article-card',
    'source'    => get_stylesheet_directory() . '/inc/plugins/divi-100-article-card.zip',
    'required'  => true,
    'external_url' => 'https://www.elegantthemes.com/blog/divi-resources/free-divi-extension-gives-the-divi-blog-module-a-brand-new-look',
    'force_activation'   => true,
),

Thanks in advance.

jrfnl commented 8 years ago

Nice to hear you like TGMPA.

I'd like to try and help you get things working, but your report is unclear. You're talking about installing plugins from a non-WP site, mention pointing the external_url config key to the source in combination with trouble with the activation...

Breaking this down and looking at your config, there is a lot of things which seem to go wrong:

Sorry, but with this much conflicting information, there is literally nothing I can do to try and help you fix this. Please clarify what the actual issue is, provide us with detailed error information and we might be able to help.

Oh and please also let us know what version of WP you're using and same for the version of TGMPA.

hallshouse commented 8 years ago

Hi @jrfnl Thanks for getting back. I've been using TGM Plugin Activation for a few Divi child-themes so far. My plugin zip files always reside in my inc/plugins folder in my child-theme and are zipped at their folder level (i.e. when I open the zip I see only the plugins folder) To date, the plugins I've used have always been available on WordPress.org, so it's been pretty straight-forward configuring them in the child-themes, however, now I'm trying to use plugins found in the Elegent Themes website (at the locations entered in the 'external_url' lines above.

Your answer above has helped me better understand the 'external_url' and now I see this would point to an actual plugin zip file on that server. I do not want that, I'm providing the plugin zip files.

The error message I'm getting from WordPress is the "Something went wrong with the plugin API" message. The error message occurs when I click install in the Install Plugins page.

I get the "An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums." error in the WordPress lightbox popup when I click on the informational link associated with the recommended or required links.

I'm using TGM Plugin Activation version 2.6.1

Here is my full script where all other plugins work, except for monarch, and Divi-100-articale-card. I've removed all the script from your config... to the add_action as nothing has changed in this.

function my_theme_register_required_plugins() {
    $plugins = array(
        array( // This plugin works fine
            'name'  => 'Black Studio TinyMCE Widget (Recommended if you import demo data)',
            'slug' => 'black-studio-tinymce-widget',
            'required' => false,
        ),
        array( // This plugin works fine
            'name' => 'TinyMCE Advanced (Recommended if you import demo data)',
            'slug' => 'tinymce-advanced',
            'required' => false,
        ),
        array( // This plugin works fine
            'name' => 'Testimonial Rotator (Recommended if you import demo data)',
            'slug' => 'testimonial-rotator',
            'required' => false,
        ),
        array( // Broken
            'name' => 'Monarch Plugin (Recommend if you import demo data)',
            'slug' => 'monarch',
            'required' => false,
        ),
        array( // Broken
            'name' => 'Article Card (Required if you import demo data)',
            'slug' => 'divi-100-article-card',
            'required' => true,
        ),
        array( // This plugin works fine
            'name'  => 'Black Studio TinyMCE Widget',
            'slug' => 'black-studio-tinymce-widget',
            'source' => get_stylesheet_directory() . '/inc/plugins/black-studio-tinymce-widget.zip',
            'required' => false,
        ),
        array( // This plugin works fine
            'name' => 'TinyMCE Advanced',
            'slug' => 'tinymce-advanced',
            'source' => get_stylesheet_directory() . '/inc/plugins/tinymce-advanced.zip',
            'required' => false,
        ),
        array( // This plugin works fine
            'name'  => 'Testimonial Rotator',
            'slug' => 'testimonial-rotator',
            'source' => get_stylesheet_directory() . '/inc/plugins/testimonial-rotator.zip',
            'required' => false,
        ),
        array( // Broken
            'name' => 'Monarch Plugin',
            'slug' => 'monarch',
            'source' => get_stylesheet_directory() . '/inc/plugins/monarch.zip',
            'required' => false,
        ),
        array( // Broken
            'name'  => 'Article Card',
            'slug' => 'divi-100-article-card',
            'source' => get_stylesheet_directory() . '/inc/plugins/divi-100-article-card.zip',
            'required' => true,
            'force_activation' => true,
        ),
);

Copies of the plugin zip files can be found at: http://www.products-and-services.ca/plugins/monarch.zip and at: http://www.products-and-services.ca/plugins/divi-100-article-card.zip

Thanks very much for your help with this.

Best Regards

jrfnl commented 8 years ago

Ok, first of all, you seem to be providing every plugin twice in the config array. This is wrong and could well be the source of your troubles.

Only provide each plugin once with all the relevant information.

For plugins like TinyMCE Advanced which are available from WP.org, do not provide a zip file and do not set the source attribute. If no source is given, the WP repo will be used to download the plugin which will make sure users always get the latest version. This makes for a much user-friendlier experience than installing a plugin only to get a "you need to upgrade" notice straight after.

For plugins like Monarch which are not available from WP.org, you do need to provide the source and - in your case - point it to the bundled zip.

The external_url attribute is used for the 'more information' url, so for non-WP repo plugins, it's a good idea to provide it, but you need to point it to a normal webpage which contains information about the plugin. DO NOT point this to a zip file.

If you'd read through the page I pointed you at earlier, you could have gotten that information yourself. Until you have a valid configuration I'm not even going to bother testing.

hallshouse commented 8 years ago

Hi:

Thanks for getting back.

If you look at my original issue, I had the external_url pointing to the plugin information page in each case. My understanding, from you previous response was to remove it as it was used for plugins that I would not include in my package.

Thanks for clarifying that my info was duplicated, I thought it needed to be that way.

I've now updated my original issue post to reflect the removal of unnecessary code while leaving the Elegant Themes external_url to link to their related info. pages.

The plugin zip files can be found at the previously linked locations.

Best Regards,

jrfnl commented 8 years ago

So have you tested with your updated configuration ?

hallshouse commented 8 years ago

@jrfnl Thanks for your patients helping me out with this. Everything is now working more properly. I've gained a greater understanding of the configuration and the purpose and function of each part. My final config for all plugins is as follows:

$plugins = array(
        array(
            'name'  => 'Black Studio TinyMCE Widget (Recommended if you import demo data)', //Found in wordpress.org
            'slug' => 'black-studio-tinymce-widget',
            'required'  => false,
        ),
        array(
            'name' => 'TinyMCE Advanced (Recommended if you import demo data)', //Found in wordpress.org
            'slug' => 'tinymce-advanced',
            'required'  => false,
        ),
        array(
            'name'  => 'Testimonial Rotator', // Included in theme
            'slug' => 'testimonial-rotator',
            'source' => get_stylesheet_directory() . '/inc/plugins/testimonial-rotator.zip',
            'required' => false,
        ),
        array(
            'name'  => 'Monarch Plugin',// Included in theme
            'slug' => 'monarch',
            'source' => get_stylesheet_directory() . '/inc/plugins/monarch.zip',
            'required' => false,
        ),
        array(
            'name'  => 'Article Card',// Included in theme
            'slug' => 'divi-100-article-card',
            'source' => get_stylesheet_directory() . '/inc/plugins/divi-100-article-card.zip',
            'required' => true,
            'force_activation' => true,
        ),
    );

Now I have a better understanding of when to get plugins from their source, how to get them from their source, as well as when I need to provide them.

Best Regards, Dennis Hall

jrfnl commented 8 years ago

Glad to hear you got it working.

If there is anything we can do to improve the documentation we provide through the website, please let us know or better yet: send in a pull request against the gh-pages branch.