How to update WP plugin / theme from external host

by xrvel
6 replies
For example i host a wordpress plugin / theme on my own host, and i want my plugin / theme users to update the plugin / theme, what code should i add on my plugin / theme.

I've known code to download file & unzip it manually, but i guess it won't be convenient because it won't use the normal and friendly wordpress update interface.

Thanks for the help
#external #host #plugin #theme #update #wordpress
  • Profile picture of the author egrovesystems
    Dear Friend,

    I cannot get your question clearly
    {{ DiscussionBoard.errors[3877217].message }}
  • Profile picture of the author SteveJohnson
    Originally Posted by xrvel View Post

    For example i host a wordpress plugin / theme on my own host, and i want my plugin / theme users to update the plugin / theme, what code should i add on my plugin / theme.

    I've known code to download file & unzip it manually, but i guess it won't be convenient because it won't use the normal and friendly wordpress update interface.

    Thanks for the help
    With all of the issues that WP itself has experienced with automatic upgrading, it might be good to just leave well-enough alone and display a notice to your users when the plugin is out of date.

    Dig into the WP code, specifically wp-includes/http.php, and wp-includes/class.http.php to see how WP does it. You can probably use some or most of the same code.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[3878229].message }}
    • Profile picture of the author iwantmore
      i needed an answer to this recently, and agree with the above post. its best to do it yourself.


      the way i have done it is to:

      1. check credencials (with my api)
      2. request latetest version
      3. download file
      4. unzip and place in plugins folder.


      i tried a few ways to deactivate old version and activate new one (problems when calling from the same script).

      so i simply display a message asking the user to deactivate the old and activate the new.

      the proccess is quite simple, and wordpress has some hidden gem functions for this:


      download_url();

      give it the url and it downloads the response to a temp file.

      unzip_file();

      unzips the temp file, and sends to destination




      the great thing about the above functions is that they do all the leg work (unzip checks if zip extension installed, if not uses plczip)(download checks i it needs to use curl or other)





      that should be enough to get up and running, hope it helps
      Signature
      No Half Pixels
      Creative Web Development and Design, NOT A FIXED PRICE SERVICE, if you want the best don't settle for an off the shelf solution.

      We provide cutting edge design, web development with WordPress, WHMCS, PHP, HTML, CSS, jQuery, and personalised hosting solutions to suit any needs.
      {{ DiscussionBoard.errors[3992551].message }}
  • Profile picture of the author DominicF
    Do you mean that you want the plugin users to be notified in their admin that the plugin has a new version and they can download and activate from the plugins page in admin?

    If so, I think you need to submit your plugin to WordPress here : WordPress › Requests « WordPress Plugins

    It's a pretty good resource for plugin developers because you get quite a lot of traffic from people browsing the wordpress plugin repository. You also get download stats for your plugin too.
    {{ DiscussionBoard.errors[3993344].message }}
    • Profile picture of the author xrvel
      Originally Posted by iwantmore View Post

      i needed an answer to this recently, and agree with the above post. its best to do it yourself.


      the way i have done it is to:

      1. check credencials (with my api)
      2. request latetest version
      3. download file
      4. unzip and place in plugins folder.


      i tried a few ways to deactivate old version and activate new one (problems when calling from the same script).

      so i simply display a message asking the user to deactivate the old and activate the new.

      the proccess is quite simple, and wordpress has some hidden gem functions for this:


      download_url();

      give it the url and it downloads the response to a temp file.

      unzip_file();

      unzips the temp file, and sends to destination




      the great thing about the above functions is that they do all the leg work (unzip checks if zip extension installed, if not uses plczip)(download checks i it needs to use curl or other)





      that should be enough to get up and running, hope it helps
      Thanks i guess this is what i need, no more pain on curl etc

      Originally Posted by DominicF View Post

      Do you mean that you want the plugin users to be notified in their admin that the plugin has a new version and they can download and activate from the plugins page in admin?

      If so, I think you need to submit your plugin to WordPress here : WordPress › Requests « WordPress Plugins

      It's a pretty good resource for plugin developers because you get quite a lot of traffic from people browsing the wordpress plugin repository. You also get download stats for your plugin too.
      Thanks, but i mean paid plugins which can't be hosted on wp.org
      {{ DiscussionBoard.errors[4022924].message }}
      • Profile picture of the author xrvel
        i've found the solution here

        Code:
        http://clark-technet.com/2010/12/wordpress-self-hosted-plugin-update-api
        {{ DiscussionBoard.errors[4030527].message }}

Trending Topics