WordPress.org

Ready to get started?Download WordPress

Forums

myCRED
[resolved] HOW TO SELL SITE UPLOAD SPACE (6 posts)

  1. ibridge_jp
    Member
    Posted 4 months ago #

    I write here, because my ID is missing from official site.
    Forum URL
    http://mycred.me/support/forums/topic/how-to-sell-site-upload-space/#post-5837

    IBRIDGE wrote:
    I have wp multisite.
    I want to user can buy ‘Site Upload Space’ by using myCRED point.
    Please help me.

    Gabriel wrote:
    Adjusting a site upload quota can be relatively easy. The question is how do you want to sell these “upgrades”. Is it sold via a store or you wan to sell it via a custom shortcode?
    Also, who can buy upgrades and are upgrades perm?

    IBRIDGE wrote:
    myCRED is awesome plugin.
    Thank you for your reply.
    Users that registered in multi-site,
    I want to be them pay from management screen.
    If possible, pay per month.

    Gabriel wrote:
    I need to know how you want users to buy these “upgrades”. Do you want to use a shop or you just want buttons? There are many ways this can be done, I need some guidance as to which direction to go.

    【Reply】
    I want to, user to buy 'upgrades' from dashboard (Admin Panel) of each child site.
    Thank you!

    https://wordpress.org/plugins/mycred/

  2. Gabriel
    Member
    Plugin Author

    Posted 4 months ago #

    Hi.

    First off, I am really sorry about your account on the myCRED website.
    The site got bombarded with spam registrations and in my "clean up" I might have removed a few innocent accounts.

    If you register again Ill make sure you regain the points you lost re-assign your post.

    As I previously asked, how do you wan to sell these updates? You want to use a store or sell via users profiles?

  3. ibridge_jp
    Member
    Posted 4 months ago #

    Hi,

    I want to sell via users profiles.
    If use the store, I want to use WooCoomerce.
    Thank you!

  4. Gabriel
    Member
    Plugin Author

    Posted 4 months ago #

    Ok.

    The first thing we need to do is to create a product in WooCommerce for the "Upgrade". You can create a product for each Mb package for example, so users can buy 10Mb space, 100 Mb space or 200 Mb space as an example.

    Next, for each project we set a custom field that we will call something unique like "disk-space". This custom field will hold the amount of space a user buys.

    Next we will need to hook into the myCRED Payment Gateway in WooCommerce and adjust the users site balance according to the product they purchased.

    We basically will loop though the order and check each product to see if they have the "disk-space" custom field. If they do, we add up the amount of space they purchased and adjust the site settings.

    Now, before we get to the code, I need to mention a few things:

    1. You will need to limit the store yourself to only allow site admins to purchase disk space. The example given here will allow anyone in the sites store to buy upgrades.

    2. You could optionally also use a Virtual Product with variations but this is a bit more tricky and complicated.

    3. You will need to setup the store on each site where purchases goes to that sites space. If you want to use a central store on your main site, you will need to adjust the code to also include which site the change should apply to. Either if the user selects the site or you collect that information based on the buyer.

    Ok so I have put together the code for you here. Copy the entire code and paste it into your themes functions.php file. Make sure the Gateway add-on is enabled on the myCRED > Add-ons page.

  5. ibridge_jp
    Member
    Posted 3 months ago #

    Dear Gabriel.

    Thank you for writing code.

    That code is fantastic!!

    I have a question.
    Do not need to switch user's blog id?

    ex)
     switch_to_blog( $user_blog_id );

     // Save this sites upload space setting.
     update_option( 'blog_upload_space', $new );

     restore_current_blog();

    and, myCRED Add-ons Defalt Gateway is error happen.

    Undefined variable: currency_symbol in /wp-content/plugins/mycred/addons/gateway/carts/mycred-woocommerce.php on line 427 Warning: array_unique() expects parameter 1 to be array, null given in /wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 209 Warning: Invalid argument supplied for foreach() in /wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-general.php on line 46

    WooCommerce 2.0.20 and 2.1.7
    myCRED1.4.1

    Best regards.

  6. Gabriel
    Member
    Plugin Author

    Posted 3 months ago #

    Hi.

    The error message you refer to has been fixed and will be included in 1.4.2 You can already now fix it by either:

    A. Download a fresh copy from the wordpress.org site and replace your current version or

    B. Open the mentioned file mycred-woocommerce.php and on line 427 change:

    $currency_symbol

    to:

    $currencies

    There is no need to switch blogs. All users on your website have a unique User ID and this ID is all that matters.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.