-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional installation? #1
Comments
This may be a bit more difficult than we think. Besides, if a plugin is truly a dependency, shouldn't it always be installed and activated? |
Not necessarily. A plugin could be an optional dependency. E.g. it's not required for the original plugin to run, but would enable extra functionality of the original plugin when active. Regarding the code above, I probably should've changed the param from |
If the dependency is optional should we ask to install, install and not activate, or something different? Right now I'm not sure. I haven't really thought about how to make it optional. |
I can certainly code that up, but we would have to figure something about the text as it would need to be more generic. So optional dependencies would be listed under the plugin wanting them installed. |
I think is going to require the json file, and likely a bit of code, to be rewritten. No other clean way to ensure that the dependencies are correctly listed with their plugins. |
Matt, I have to say I'm failing in trying to get that Install Now link to work. Somehow I need to use the link to run the |
I'll try to take a look early next week. We may want to step back from the code and try to nail down all the requirements first. |
I just merged much of what I was working on today. It will install all listed plugins but will not activate optional dependencies. Additionally, the dependent plugin and all dependencies are labeled. FYI, if testing the json format changed. |
So I tried merging what you've done with this to allow for a json config file and multiple plugins. It's in the |
Haha, I'll check it out shortly. |
Thanks Matt |
I've got the additional plugin rows for each optional install listed but the don't work. 😝 It would be great and future proof concept to be able to have them install similarly to how shiny updates work. |
How were you thinking it would look when a plugin has multiple dependencies?
You're right... optional dependencies make things a lot more complicated 😉 |
It would likely look and feel most like core if each dependency were on it's own line with an 'Install' button. If the install then looks/works like shiny updates then it's a bonus. Once installed the line would then disappear, on a page reload. If the dependency is installed and not activated, we should probably include an 'Activate' button. |
@mgibbs189 I just had a thought as another dev was interested in this for his themes, the current method of adding to I'm going to make a new branch for this and we should probably work along that path. Let me know your thoughts. |
@afragen Are we just referring to plugins able to register themes as dependencies? Or can a theme itself require another theme as a dependency? Sorry for the delay, been swamped with FacetWP work this week |
No, a theme registering plugins as dependencies. As we consciously try to get theme developers to separate form and function, they will require certain plugins for function. Don't worry about being swamped with paid work. 👍 |
@mgibbs189 I made a number of simplifications to Of course, we ( you 😈 ) still need to get the js working. |
I understand that this (optional dependency) never saw the light of day? |
@senlin it's there. It will show up in an admin notice. The admin notice is dismissable for a week at a time. What didn't work was adding the dependencies to the after_plugin_row or after_theme_row. Just add |
The thing is that the notice actually cannot be dismissed; after a refresh it pops right up again. we posted at the same time, so in the json file I'm doing it correct. Yeah, the after_plugin_row would have been very nice :) |
You can try this out using my lean-wp plugin. I have just added there admin menu manager plugin as "optional". If you don't activate that plugin and dismiss the notice, it comes right back at you after a refresh. Also a nice addition would be to only show the notice on the Plugins page, not on the other backend pages as that might come across as pretty irritating ;) |
I just tried it out using lean-wp. The required plugins installed and activated. The optional plugin admin notice did not reappear on any page reload after being dismissed. Do you have something interfering with transients perhaps? |
huh? I will reset the lot and report back. |
I hope the Lean-WP plugin is also active. 😉 |
hahaha, yup it is. Did a reset with a default theme (twentyseventeen) and still the dismissed notice returns right after the page refresh. |
Yes, it disappears when I click the dismiss icon. And then I visit the Dashboard or any other page in the backend and then it shows again. |
Can you test locally? It did work for me on my test site. |
We are talking about the same thing. |
I only tested dismissing the install not the activation. Let me test. |
dismissing the install gives the same result for me: also comes back :( |
Unfortunately I'm away for the weekend and don't have my laptop. It's still dismissed for me after reinstalling and re-activating. I'll have to figure out how to remove the transient before I can test more. |
No worries Andy, please enjoy your weekend! This is not something urgent and I am not even entirely sure whether I need to include that plugin as there seem to be a few hiccups, which basically is also the reason I want to make it an optional dependency in the first place... I won't be releasing Lean WP this weekend, so that's all right and I can always add the dependency later on! Have a great weekend! |
Out of curiousity are there any JS errors after you click the dismiss? |
As far as I can see, not |
Response is empty |
I'll have to test more next week. |
Sure, no worries, I need to run now too. Talk later. |
There should be a |
not there I'm afraid :( |
@senlin I've been playing around and if you've got an object cache running then the transient storing the timeout gets stored there. If that cache clears sooner, and it's likely to, then the notice will come back sooner. |
The problem that I have been experiencing is that the notice comes back on page refresh. And the backend usually doesn't use caching or does it? |
Hi Andy, how are you doing? Is there anything that can be done to resolve this? |
The admin notice should be dismissed for a week. |
Yes, it should, but it seems that sometimes it works and sometimes it doesn't. I have tried to find the period of one week in the code and cannot find it. If I can, then I can simply change it to forever. Is there a way to do that? |
The line is here, https://github.com/afragen/wp-dependency-installer/blob/master/wp-dependency-installer.php#L380 The I'll try to test again in a clean install this weekend. |
Thanks Andy, before I change the number I will await your tests then. |
@senlin I think the issue is I needed to ensure that the admin notice dismissal dependency is initialized. I have it initialized in another plugin so I missed it here. Replace your current Let me know if the dismissal works. If it works, I'll push to master and a release so a |
Hi @afragen it looks like you nailed it! I can confirm that using the Regarding the P.S. I already checked the time of dismissal in the other library and it seems to be |
You can just replace the file. |
figured it out with |
From @mgibbs189
Some users might not want plugins to be installed automatically. In each item's JSON settings, what are your thoughts on supporting an (optional) confirm setting? If it exists and is set to TRUE, the user will need to confirm installation (by clicking an "Install" link within an admin notice).
The text was updated successfully, but these errors were encountered: