Marketpress w/ Prosites: limit amount of product listings for differnet prosites levels?

My config: WP Multisite, Marketpress, Prosites (other little plugins). Etsy style shop where users create their own store and post products. Global cart, no chained payments.

How can I limit products for different levels. Ex. Free level - 5 products. Pro 1 - 10 products. Pro 2 - 15 products. Pro 3 - 20 products.
I have been researching this topic heavily and the closest thing I have found is this link: here and here

The first link is right on with what I want, but I want to take it a step further and add more than just two levels as in the example I described above.

The second link - I am not sure that this is intended to limit the amount of products that a user is able to post to their shop using marketpress. Can someone clarify this please? And if it is, it seems as if you can only limit one level, than all levels above will have the same amount or unlimited. Is this correct?

Also I plant to have a blog and community/forum section too for the paying members. So I don't know if anything I am trying to do conflicts with this. I don't want to limit how much they can post, both new threads and comments/replies. And just to clarify, the free people wouldn't have access to this

Can someone help me out with this?

From my understanding is that it is a custom coding thing, which I am fine with (but I need guidance in this), but is a desired ability for many marketpress and prosites users.

+1 If you want these features too

  • DavidM

    Hi @josh,

    Hope your project's going well so far! :slight_smile:

    The second thread (as follows) you referenced actually gives more specifics, even the needed code, to get that all working.
    https://premium.wpmudev.org/forums/topic/limit-pages-but-not-products

    Aaron gives all the information needed to make that happen, though it's still a bit of a complex task. Having it so that users are able to create a certain number of products based on their level would add a layer of complexity.

    It can be done, it's just more complex and would require some extensive work, all of which Aaron provides excellent guidance on in that thread.

    Does that make sense?

    Also, I hope you won't mind my moving this to the feature request forum. We can then have a look at feedback and votes from others as well.

    I myself think your scenario is the logical extension to the initial ability to limit product creation. Once you're able to limit product creation, of course you'll want to have multiple levels of limits. Makes great sense, I think. A great suggestion.

    Any other thoughts on this?

    Thanks,
    David

  • josh

    Hi @David,

    Thank you for your reply. So I tried to follow the directions from Aaron, but can't get it to work.

    I have added the following code with the plugin "code snippet"

    add_filter( 'mp_register_post_type', 'add_mp_custom_fields' );
    function add_mp_custom_fields($args) {
         $args['capability_type'] = 'products';
         return $args;
    }

    This successfully allowed me to edit the "products quota" in prosites.
    I then used the plugin "User role editor" and added the custom capabilities: edit_products, publish_products, and edit_published_products to the subscriber role as Aaron explained. (I think this is where one issue is, continue reading)

    I currently have this whole thing configured with multi site user management and users are able to create a site or "shop" on my network. Their role is automatically a "subscriber" Few problems however.

    1. The users are now not able to add products using marketpress. This was mentioned by Aaron, but that's why we had to add capabilities. I must have done something wrong here or didn't add capabilities correctly.
    Any insight on this?

    2. I also noticed that with the "pay to blog" feature enabled in prosites, users were no longer allowed a free level. This is important because, as from my understanding, this is what allows user accounts to be deactivated if payment is not received. In my case, their shop wouldn't appear on my network anymore nor would their products. But the free level is also important so I can allow people to use my service for free (with limitations enforced with prosites).

    To clarify what I am trying to do:
    Free level - 5 products max
    Basic level - 10 products max
    Pro level - 20 products max
    Ultimate - 100 products max

    Something along those lines with prosites also restricting themes and plugins to different levels.

    I apologize for the book I wrote here, just want to be clear so I don't waste your time

  • DavidM

    Hi @josh,

    I believe that 'products' needs to be singular. Could you give the following a try?

    add_filter( 'mp_register_post_type', 'add_mp_custom_fields' );
    function add_mp_custom_fields($args) {
         $args['capability_type'] = 'product';
         return $args;
    }

    Regarding the "pay to blog" feature, as you've seen, it wouldn't work with a free level. You could only have one or the other, by design. Otherwise, your paying users would revert to something less than even free levels if they stopped paying, in that their site would get deactivated.

    Could you let me know how that product limit adjustment goes for you before going further though?

    Just wanna be sure that's sorted first off. :slight_smile:

    Thanks,
    David

  • josh

    Hi @DavidM

    thanks for that correction.

    So now users can enter products.

    I set up Pro Sites to limit products to 1 and to remove this quota you have to have the most basic paying level. (the one directly above free)

    So after one product the user can click on "add a new product"
    BUT, the "publish" button has turned into " submit for review" and when they click on this the product does not publish. When they view their list of products the second products shows "Pending" next to it.

    Thank you for this!

    One step closer, but I was hoping that when they try to publish the second product it would say something like "Please Upgrade to the next level or something like that"

    Also it only allows me to separate all my levels into two categories Ones that have limited products and ones that have unlimited.

    How can I get it to where
    Free has a limit of 1 product
    Basic - has a limit of 5 products
    Pro - has a limit of 20 products
    Ultimate has a limit of 100 products.

    Not sure I want to offer unlimited products

  • DavidM

    Hi @josh,

    That's correct, as you're seeing there's not a built-in way to provide those multiple levels of quotas. The add-on for Pro Sites isn't designed to work in that way.

    That's what I was referring to in my initial response about having an added layer of complexity. It's quite a largely complex matter that's beyond the scope of direct support. But the initial items we just went through help to see how it can be done.

    Something i think helps to note here though, something Aaron also referenced in another thread is that the "all or nothing", "pay to blog" approach works incredibly well in practice. That is, over and against pay per feature setups.

    Here's a great article that touches on that, regarding our sister site Edublogs.org.
    https://premium.wpmudev.org/blog/making-money-with-wordpress-mu-the-edublogs-story-so-far/

    Hope that helps explain a bit. :slight_smile:

    Cheers,
    David

  • josh

    Hi @ David

    Thanks for the help!

    Regarding the whole multiple levels of quotas.
    Can you explain what @Aaron was talking about regarding adding capabilities to user roles in this post. https://premium.wpmudev.org/forums/topic/limit-pages-but-not-products
    What does this achieve? I reread all the posts, and it does seem like Aaron is saying that multiple levels can be done by inserting the code (I did that) and then adding capabilities???

    You guys won't give up, will you?

    add_filter( 'mp_register_post_type', 'add_mp_custom_fields' );
    function add_mp_custom_fields($args) {
         $args['capability_type'] = 'products';
         return $args;
    }

    will change the capabilities. That will let you set quotas on them in pro sites.

    You will then have to give the appropriate capabilities to selected roles to all sites running MP though with a plugin like: http://wordpress.org/extend/plugins/user-role-editor/

    There are a whole lot of them, see http://codex.wordpress.org/Roles_and_Capabilities#Editor

    Examples are edit_products, publish_products, edit_published_products, etc.

    Good luck

    Also, that was a good article, thanks for sharing!
    I agree with it entirely, however I still have to stand by the different product quotas for different levels.

    For what I am trying to do, it requires different product quotas for different levels, because my users will have different needs and this dictates the pricing points.

    I really hope you guys can help me out

  • DavidM

    Hi @Josh,

    Sorry for the delay here, I've been taking a good look into this one to see how feasible it might be to throw something together, but basically, at the moment, quotas are not on a per-level basis in Pro Sites, as discussed in the following thread.

    https://premium.wpmudev.org/forums/topic/pro-sites-postpageproduct-quotas-module-can-be-set-per-level-where-can-i-verify-the-settings

    I'm still taking a look at the matter myself, it seems it'd be best done by creating a new module from Pro Site's current posting-quota.php, as Aaron alludes to in that thread, and that in order to not conflict with the current module.

    Basically, looking at the foreach occurrences in the standard quota.php module, which does provide per-level settings, helps see how it'd be done.

    That said, hopefully others have some feedback or votes to share here as well. I'll post back any further updates in my looking into it. :slight_smile:

    Cheers,
    David

  • DavidM

    Hi Josh,

    Just letting you know, I didn't forget about this one, just trying to get a good free moment to get this all sorted.

    To start with though, I'd like to describe the process of extracting the bit of code we'll need from the quotas module in Pro Sites, so that we can use that in our new Per Level Posting Quota module.

    On line 74 of \pro-sites\pro-sites-files\modules\quota.php, you'll see this:
    $levels = (array)get_site_option( 'psts_levels' );

    That gets the various Pro Sites levels. Then on line 91, you'll see the following:
    foreach ($levels as $level => $data) {

    That iterates over all the levels. During that iteration, you can see it references another function that's defined on line 117 as follows:
    function quota_select($level, $selected) {

    That function displays the level details.

    Also during that above iteration (the foreach loop), you see this on line 93:
    $quota = isset($data['quota']) ? $data['quota'] : get_site_option('blog_upload_space');

    That's getting the options from the database, or setting the option as the default setting for upload space if the option doesn't yet exist.

    All of that represents the bit of logic we'll need for getting the levels from the database and then displaying those options for the user to set. Hopefully that helps you see partly what Aaron was referring to in that previous thread.

    I'll try and get the next bit up about creating a new module using the existing Posting Quota module as soon as possible.

    Cheers,
    David

  • Tyler Postle

    Hey @HamRadioDude,

    You can use the Pro Sites "Post/Page Quotas" module it will allow you to set a limit for the Products post type.

    You can still only set the level to unlock the limit though. So if you want only free level to have the restriction then it will work because you set the limit to be unlocked once anyone has your first Pro level or higher.

    You aren't able to set per level quota restrictions which is what the above conversation looks to be relating too.

    Sorry for such a delay on this reply, in the future create a new ticket: https://premium.wpmudev.org/forums/#question

    Then you can still reference old threads like this one if needed. Sometimes these old ones are no longer linked to a staff so you end up with a big delay like this.

    Hope that helps! Cheers

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.