WordPress.org is a very capable platform for plugin/theme developers to host their creations. There are many advantages of hosting your plugin on WordPress.org, for example –
- Exposure to millions of WordPress users without actually spending anything on advertising
- An easy source control repository option – subversion
- Automatic release management and automatic updates to users
- Automatic web-page generation for the plugin using simple to write README
- Download statistics for the plugin
- A very good rating system too
However, recently WordPress has become very strict on licensing of code uploaded on their repositories. They no more allow you to use any code that is licensed under Creative Commons. This is a big problem for me as I’m using a third-party tool licensed under creative commons, and many of my users were dissapointed when I had to remove this tool from my plugin.
So, I decided to host my plugin somewhere else to be able to use code licensed under creative commons. The most important aspect of this decision is that, I’ll loose ability to provide auto-update for my plugins. Then I came across this excellent script written by Kaspars. It allows you to setup auto-update mechanism for your plugin which is not hosted on WordPress.org.
When I started using this script, I realized that there is huge potential in this script to be useful for many more WordPress developers like me. So I developed this script further to make it easier to deploy and added more features to it, for example –
- Serve multiple plugins using same script
- Serve different types of versions like stable, alpha, beta, lite, pro, test etc.
- Easy to configure ini file
I plan to add some more features to this script in future, so I uploaded the same on GitHub.com as a project.
Visit the project page of this script on GitHub.com to download this script or get more details.
Hey! Just wanted to say “thank you!” I’m going to use this in my plugin. I already set it up and modified it with my very own license check. Will give you a hint/link on launch
That’s awesome Markus. All the best for your launch.
Hi, Sorry to be a bit nit picky … but when you say ‘not hosted on WordPress.org’ do you not actually mean ‘not hosted on WordPress.COM’?
.COM is where you have your blog hosted with WordPress. Whereas, .ORG is where they keep the platform and plugins files and etc for those of us who use our own hosting.
On the upside, your information and plugin are great! 😀
No, I meant wordpress.org. When I say ‘not hosted on WordPress.org’ I’m referring to plugins, not blogs. Check out the WordPress.org Plugins Directory which is hosted on wordpress.org.
http://wordpress.org/extend/plugins/
yup I use that site frequently… thanks for the clarification on what you meant… 🙂
A tip to people who want to use this for multiple plugins: Rewrite the test-plugin into a generic “Custom Update Enabler” plugin, then you can use Plugin Dependencies ( http://wordpress.org/extend/plugins/plugin-dependencies/ ) and make all your private plugins depend on your Custom Update Enabler plugin.
This way, you only need to include only the “new WpPluginAutoUpdate”.. line and the add_filters in your other private plugins, and they can all update from a central (private) source.
Cheers!
@Andrew, I’m assuming you are talking about the markdown in the ini file? That is to generate the HTML description and other relevant information about the plugin.
When the update notification about the plugin appears on WordPress dashboard, it generates a link to the details of new version. The HTML code generated out of markdown is what is shown there in the popup.
log_analytics is just a placeholder right now, which you can use to track some analytics about the plugin downloads etc. You can safely remove it, if you’re not using it.
Hi Ronak,
Thanks for this… it’s exactly what I needed.
What are we to do with the markdown and log_analytics code?
Andrew
Hi, I can’t get it to work…
Copy contents of this project (excluding test-plugin/) to a location on your website
OK
Rename test-plugin.ini to your-plugin-slug.ini Modify your-plugin-slug.ini file according the help instructions in the file
WHAT IS THE PLUGIN SLUG? FILE NAME?
Modify test-plugin/test-plugin.php file to reflect the location of index.php on your website
DO WE CHANGE api_url? WHERE DO WE POINT TO index.php??? api_url = “http://example.com” ???
Copy contents of test-plugin/test-plugin.php file to your plugin’s main file
OK
@sem101 Plugin slug is the identifier that is used by WordPress to identify your plugin. For example, URL for my plugin on WordPress is http://wordpress.org/extend/plugins/awesome-flickr-gallery-plugin/, where awesome-flickr-gallery-plugin is the slug.
If location of the index.php file is http://example.com/plugin_updates/index.php, api_url should be set to http://example.com/plugin_updates/
Hi, RonakG. Thank you for putting the time and effort into this tutorial and code. I’m stuck at the last step and I can’t figure it out. In your /test-plugin/test-plugin.php file I cannot figure out where to put the reference to the index.php file. To be quite honest, I’m not even sure what the code should look like. I’ve tried to insert:
$api_url = ‘http://update-site.com/plugin-directory/’;
on line 32 but that just causes an error. I’ve also tried the same code on line 40 but that doesn’t help either. I also put that same line of code in my main plugin file after the statement
include ‘test-plugin.php’;
but that doesn’t help either. I’m stuck. Can you help please?
Some notes…
— To keep the code a little cleaner, I left my plugin as-is and I’m including your code via an “include” statement near the top of my plugin (with two other includes).
— I have the plugin running on domain-x.com but it’s looking to domain-y.com for the updates. domain-y.com is where the other files are–index.php, markdown.php, and the .ini file.
— Both domain-x.com and domain-y.com are two separate independent WordPress network sites using the WordPress MU Domain Mapping plugin to dynamically map domains such that http://domain-x.com/domainz/ is actually shown as http://domain-z.com in the browser. The directory /domainz/ does not actually exist–it’s mapped virtually.
Any help you could provide would be most appreciated. Thank you very much.
Hi how to duplicate plugins?
Can you elaborate? What do you mean by duplicate plugins?
Thanks for sharing this on Github! I’d like to allow automatic updates only for users with a valid api key. My idea is to have the download link be something like this: http://mydomain.com/download.php?api=hash&file=wptheme.zip
I was thinking I could generate the api key as a user meta field. I should be able to do this, but I’m not certain what to put in the download.php to make it happen.
Do you have any examples of doing something like this?
Thanks for your feedback..
Jack
Well, I also want to do this sometime. Haven’t really thought it through yet. I’m also pretty new to PHP, so don’t really have an idea about how to do that.