upgrades plugin + supporter plugin working in harmony with quota

How tough would it be to get these working together?

My goal is similar to the following example:

User signs up for a trial period period blog with a 5MG quota.
(Set sitewide in WP options)

Trial period ends and/or they become supporter and now get a 50MG quota.
(Set in Supporter Quota Settings)

User wants more space and buys it via Upgrades for 100MG quota.
(Set in Upgrades Settings by creating a new package with the file - quota.php)

My thoughts are, I can write some logic in supporter-quota.php to check if the proper functions in 'upgrade-plugins/quota.php' are active and set in place. Then, if so, let the Upgrades plugin take precedence. This way I can still have the displays in the Dashboard when needed for Supporter and have that option of "Upgrades takes precedence" (if it exists).

Would this be the logic I need to use to get these to work together nicely?

I'm looking to launch in a couple of weeks. Would a new Supporter version be likely to have this ability or Should I roll up my sleeves and go ahead and customize these 2 plugins to work together?

Thanks in advance!

  • Brayne

    I've installed all the latest versions, Supporter, and Upgrades. Using the lastest of WP multi-site. Supporter works, Upgrades works. Except for quota. When a user buys more storage space, the new amount of space doesn't reflect on the user's blog's dashboard. It only shows the storage space reflected from Supporter's plugin, not the Upgrade's plugin. It's seems there is a conflict somewhere.

  • Brayne

    The Supporter plugin uses pre_option_blog_upload_space and then get_site_option.
    The Upgrades plugin uses blog_upload_space and then get_option.

    There is a bit of a conflict in the sense that Supporter's blog_upload_space, get_site_option("supporter_quota"), takes precedence and thus doesn't reflect any of Upgrades blog_upload_space, get_option("blog_upload_space"), because of the use of the 'pre_option' filter in the Supporter plugin.

    I had to write a custom if statement for the upload space before the add_filters (supporter_quota_filter) are activated inside of the file supporter-quota.php.

    This did the trick.

  • Brayne

    Use this at your own risk..... I don't work for incsub.... :wink:

    Inside the file - mu-plugins -> supporter-quota.php
    I changed the "Hook" section to look like this....


    add_action('supporter_settings', 'supporter_quota_setting');
    add_action('supporter_settings_process', 'supporter_quota_setting_process');

    // check for upgraded quota, if they have more, they MUST have purchased it.
    // avoid filter if they have purchased more space.
    //Change 11-08-10

    $tmp_current_quota = get_option("blog_upload_space");
    $supporter_quota = get_site_option("supporter_quota");

    if($supporter_quota > $tmp_current_quota) {
    //filter blog and site options
    add_filter('pre_option_blog_upload_space', 'supporter_quota_filter');
    add_filter('pre_site_option_blog_upload_space', 'supporter_quota_filter');

    //add supporter messages
    add_action('activity_box_end', 'dashboard_supporter_quota_message', 11);
    add_action('pre-upload-ui', 'dashboard_supporter_quota_message', 11);

    I advise using comments to block code when testing something.

    Hope this helps.