Upgrades plugin. A few questions.

Hello again

Guys, I started using your Upgrades plugin a while ago.
I'm happy with it so long, but I want to add a few more features (plugins) that users have to pay for.

For example I have a forum plugin from http://simplepressforum.com/ and ecommerce plugin from http://www.instinct.co.nz/e-commerce/
Also I have Donncha's domain mapping plugin.

I want to make these features paid.
So a question - how do I do this?
Is there a piece of code I need to add into each plugin, like for example WPMU plugin filter requires (http://wpmudev.org/project/Wordpress-MU-Plugin-Filter)?
In other words - how do I 'mark' a plugin that I want to make paid and how do I set the amount of credits and 'billing periods' for it?

Thanks in advance.

  • Andrew

    Hiya,

    There's some code you have to add into each plugin. Look at the ads plugin for an example.

    Basically you add this:

    upgrades_register_feature('UNIQUE_PHRASE', 'PLUGIN_NAME', 'PLUGIN_DESCRIPTION');
    
    UNIQUE_PHRASE - just a unique string. I usually us an md5 hash of the name
    PLUGIN_NAME - self explanatory
    PLUGIN_DESCRIPTION - self explanatory

    Then you add the upgrades check to the plugin:

    if (upgrades_active_feature('UNIQUE_PHRASE') == 'active'){
    //feature enabled
    } else {
    //feature disabled
    }

    how do I set the amount of credits and 'billing periods' for it?

    After you've done the above and have the plugin uploaded you just add the plugin to a package.

    Thanks,
    Andrew

  • idealizer

    O-o-h, I should have guessed this :slight_smile:

    So basically I need to edit main php file (file that loads the plugin) of each plugin I want to make paid, right?

    I find a file that loads the plugin - usually this is a file that contains plugin name, description, author, version and other info.

    After first <?php I add this code (of course I fill the data as you instructed):

    upgrades_register_feature('UNIQUE_PHRASE', 'PLUGIN_NAME', 'PLUGIN_DESCRIPTION');

    Right after the above line I add this code:

    if (upgrades_active_feature('UNIQUE_PHRASE') == 'active'){

    } else {
    die
    }

    [... here goes the rest of plugin code ...]

    Do I understand it right?

    Thanks a lot.

  • idealizer

    Hey,

    So all plugins I want to make premium have to be placed into /wp-content/mu-plugins/upgrade-plugins/

    This pertains 'common' plugins that I usually put into /wp-content/plugins/ and those I put into /wp-content/mu-plugins/ (for example domain mapping).
    Do I get it right?

    Also I know that if I put a plugin into /wp-content/plugins/ it can be in its own directory, but if I want the same plugin in /wp-content/mu-plugins/ then it's 'main' file has to be copied into /wp-content/mu-plugins/

    What about /wp-content/mu-plugins/upgrade-plugins/?
    Can my paid plugins have their own directories inside /wp-content/mu-plugins/upgrade-plugins/ or should their 'main' file be copied to /wp-content/mu-plugins/upgrade-plugins/ ?

    I think this is my last question :slight_smile:
    I'm learning a lot from you guys.

  • Andrew

    Hiya,

    So all plugins I want to make premium have to be placed into /wp-content/mu-plugins/upgrade-plugins/

    It's not required but some plugins may not work if they aren't in that directory.

    This pertains 'common' plugins that I usually put into /wp-content/plugins/ and those I put into /wp-content/mu-plugins/ (for example domain mapping).
    Do I get it right?

    Correct. Note that some regular wp plugins don't work well outside of /plugins/ and there's not much you can do except open up the plugin and hack it to work.

    Also I know that if I put a plugin into /wp-content/plugins/ it can be in its own directory, but if I want the same plugin in /wp-content/mu-plugins/ then it's 'main' file has to be copied into /wp-content/mu-plugins/

    Yep. Again some regular wp plugins don't run well outside of /plugins/.

    What about /wp-content/mu-plugins/upgrade-plugins/?
    Can my paid plugins have their own directories inside /wp-content/mu-plugins/upgrade-plugins/ or should their 'main' file be copied to /wp-content/mu-plugins/upgrade-plugins/ ?

    Main file :slight_smile:

    Thanks,
    Andrew

  • akares

    I am also struggling with this a bit. Initially I assumed this plugin would define any plugin in the /plugins or /mu-plugins directories could be made either a paid for feature, or available for free.

    Is there really no better way than hacking the existing plugins to work?

    I hope I dont seem too forward, but it seems like when I initially saw the Upgrades plugin that this functionality was implied, when really you only get the 4 it comes with, otherwise you are on your own to hack other plugins to show as an upgrade option.

    Please correct me if I am wrong.

    Or is there another place to get compatible plugins?

  • idealizer

    Andrew,

    I have 4 files which came with Upgrades plugin in /wp-content/mu-plugins/upgrade-plugins/ directory.
    In other words it look like this:

    /mu-plugins/upgrade-plugins/ad_removal.php
    /mu-plugins/upgrade-plugins/privacy.php
    /mu-plugins/upgrade-plugins/quota.php
    /mu-plugins/upgrade-plugins/widget_upgrades_badge.php

    Now when I go to my WPMU backend then Site Admin then Upgrades then create a package (wp-admin/wpmu-admin.php?page=upgrades&action=new_package) I don't see any plugins in 15 drop-downs...

    I feel I'm missing something obvious but still don't know what it is.

  • Newclear

    Is there a an example (snippet) of a external plugin (not one that comes with the install) that works with this plugin?

    I've read all topics on this Plugin and still baffled. The custom plugins I create don't appear in WP-Admin backend (http://www.somewebsite.com/wp-admin/plugins.php)

    My sample plugin, named sampleplugin.php, has the following code:
    <?php
    /*
    Plugin Name: MyPluginName
    Version: 1.0
    Plugin URI:
    Author URI:
    Description: Lorem Ipsum.
    */

    class MyClass {
    function MyFunction() {
    //some code here
    }
    }

    $MyClass = new MyClass();
    ?>

    Where in the world does this go:

    if (upgrades_active_feature('UNIQUE_PHRASE') == 'active'){
    add_action('blah', 'blah_function');
    //other plugin actions filters go here
    }

    And then where exactly to I place sampleplugin.php?

  • Andrew

    Hiya,

    it doesn't appear in the Plugins listing

    It shouldn't be listed on that page. Only plugins installed in /plugins/ will be listed on the plugins page.

    it automatically activates the custom plugin

    Make sure you've placed the plugin in the mu-plugins/upgrade-plugins directory as indicated in the instructions.

    I was with the impression that it would only "simply make certain plugins available".

    You have to modify plugins to work with the Upgrades plugin.

    Thanks,
    Andrew