Pro Sites Suggestion

Pro Sites Plugin should have the option to limit "the number of blogs a user can create" for different levels.

  • James Morris

    Hello silvio

    I hope you are well today!

    This is a great suggestion! I see this suggestion has been added to our Features & Feedback forum. Our Team will take a look at this and consider it for future versions of the plugin. Please keep in mind that features are added on a popularity basis. The more members asking for it, the more likely it will make production.

    Thanks again for the feedback! :slight_smile:

    Best regards,

    James Morris

  • James Morris

    Hello silvio

    There's already currently the ability to limit signups to a single blog/subsite, or allow multiple blog signups in Pro Sites. What we're missing at this point is setting a limit to a specific number of signups. So, this would definitely be a useful feature for sure. But please note it could still easily be circumvented by a determined enough user.

    That being said, doing some digging around and it seems our SLS Team has already come up with a potential workaround while this feature is being considered for future releases.

    Please see the following comment and subsequent comments for more information. https://premium.wpmudev.org/forums/topic/pro-sites-limit-sites-per-user-per-level#post-1237421

    I hope this helps in your situation. :slight_smile:

    Best regards,

    James Morris

  • Lindeni Mahlalela

    Hello silvio

    I hope you are doing great today, I am sorry for the delayed response from our side and sorry for any inconvenience caused.

    I have double checked the code provided on the other thread and verified its behaviour, basically all it does is take the limits set in the settings screen and check if the user has not reached those limits, if the limits have been reached then it simply displays an error message instead of the pricing table which means the user will not be allowed to even select a level on the pricing table if they have reached the limit.

    After implementing the code as suggested above forum URL, pricing table not displaying getting message "Sorry", on this URL http://localhost/wpmu/pro-site/?action=new_blog

    The "Sorry" came from the code provided and it will be printed if the limit for creating blogs has been reached. I saw that there was a small mistake on the code which caused the code not to append additional information to the sorry to let the user know why they have been denied to create a blog.

    So I have modified the code so that it displays the relevant error message to the user if they have reached the limit. You will find the code attached in this post, just extract and upload the "limitblogs.php" file to replace the one in: wp-content/plugins/pro-sites/pro-sites-files/modules/limitblogs.php. Once that is done you can set the limits on the page "ProSites > Settings > Limit Blogs and Levels" and here is how it works:

    Number of blogs per user - is the total number of blogs a user can have in the Network across all levels
    Blogs per Level - is the limit for each level, this means if you set a number on this like 3 then the user will be allowed to create 3 blogs per level and the some of these will be further limited by the "Number of blogs per user" set above.
    Limit of free blogs - is the number of free blogs a user can have in the network. This is not limited by the limit per level, but will be limited by the number of blogs per user.

    Once you have set this up, you should test to see how it works. You should see messages like the following if a limit has been reached.

    The way it is set up right now, is that it will display only the message on the page instead of the pricing table. If you prefer to show it below or above the pricing table instead of of replacing it entirely then you should consider editing the file to comment out the line that has the 'template_redirect' hook so it looks like this:

    //add_action( 'template_redirect', array( &$this, 'set_blog_creation_limit' ) );

    and then remove the forward slashes on the line at the bottonm of the __construct function to make them look like this:

    add_action('signup_header', array($this, 'set_blog_creation_limit') );
    add_action('signup_blogform', array(&$this, 'set_blog_creation_limit') );

    One of these two lines will do, so consider commenting the other one out while testing the other to see the difference. If you choose these two hooks you might have to do some additional coding to make sure the users are not able to signup because this code will only display the error message without any restrictions.

    If you wish to set a different limit for each level, you will have to add in the logic to achieve that but the settings part has been taken care of already, you just have to comment out the last part of the table at the bottom of the 'settings()' function.

    I hope this helps, please let us know if you need any further assistance. Please note that the provided code is not a final solution for this you still have to improve it to achieve exactly what you need to achieve.

    Have a nice day.
    Lindeni

  • Lindeni Mahlalela

    Hello silvio

    Please check my last post above, it seems we were both posting almost at the same time. The code has been modified to give more meaningful error messages. It should work as it is but as it stands you can only set one limit that will apply to all levels but there is already a foundation from which you can develop if you need to control the limits separately for each level.

    Please let us know if you need any further assistance.

    Have a nice day.
    Lindeni

  • Lindeni Mahlalela

    Hello silvio

    I hope you are doing great today. I am sorry for the delayed response from our side, things have been real busy but I haven't forgotten about you.

    I have modified the limitblogs.php file previous shared so that it accommodates various levels as set on your Pro Sites dashboard. Please find the attached limitblogs.zip file, download, extract and upload the limitblogs.php file to your website in the location:

    pro-sites/pro-sites-files/modules/limitblogs.php

    Everything else stays the same as in the previous fix. Once you have done that you should notice the settings page now includes the Pro Sites Levels and now you can set a limit for each of them separately. It should look like this:

    How this will work is that on the Pro Sites pricing table, if someone chooses a level it will automatically submit the level and other data to check for if the currently logged in user has reached a limit for the selected level, if they have reached the limit it will hide the form and show the error message like so:

    All this happens immediately after the user selects a level, if they switch a level it will check that level and display the error message. It leaves the form as is if they there is no limit reached.

    Please note that while this works, it may not be the perfect solution for you, in which case you should consider changing the code yourself or consulting our Jobs Board and hire a professional developer as this solution already exceeds the scope of this support forum. Please note that this is not a final solution and is not yet scheduled for inclusion in the next release so make sure to backup before updating Pro Sites and reapply this fix as required.

    I hope this helps. Please let us know if you have any queries or concerns.

    Have a nice day.
    Lindeni

  • Lindeni Mahlalela

    Hi silvio

    I hope you are doing great today. Thanks for your feedback and for the additional questions.

    ...but second time its again asking for payment, I think limits not working there.

    Yes this is expected and its basically the main functionality of Pro Sites. Each new blog will have to be paid for. One user can have multiple paid blogs on the same level.

    ...I think limits not working there.

    The limits work to restrict the user from registering a certain number of blogs of the same level, so as you have set the number to 5 for the "Premium" level it means any user can not have more than 5 blogs the Premium level so they will be allowed to register 5 blogs but once they attempt to register the 6th blog it won't allow them, it will show the message saying "Sorry you have reached blog limit" with the appropriate description for the limit reached.

    The solution on this thread does not allow them to pay once for each level but it only says they cannot have more than the set limit. I am sorry if you have expected anything else but that is what I got from the description of this thread, it doesn't say anything about payment, I created this solution based on this:

    Pro Sites Plugin should have the option to limit "the number of blogs a user can create" for different levels.

    And this does not say anything about allowing one payment per level so I am sorry I missed anything here. Unfortunately, I have checked Pro Sites and do not see any hooks to achieve this so I am afraid you will have to hire a developer to do this for you as it will require more than the solution on this thread and there are small chances you can do this without modifying the Pro Sites core. Such a solution is beyond the scope of this support platform and we can not do custom development here so you will have to go to our Jobs & Pros section and hire an independent developer.

    I am sorry for any misunderstandings and inconveniences. Please let me know if there is anything else I should look into.

    Have a nice day.
    Lindeni

  • Lindeni Mahlalela

    Hello silvio

    I hope you are doing great today. Thanks for the feedback.

    Unfortunately what you require here is more than what we offer on this support forum and this is not an issue with Pro Sites or the code provided, what you require is completely new functionality currently not built into Pro Sites. When we provide code on a support ticket, we do so to guide you or to give you information and examples on what you should do to accomplish your goals. We do not do custom solutions on the forums, for that you will have to visit our Jobs & Pros page where you can post your project and hire a professional independent developer to add the custom functionality for you.

    With regards to the request of requiring one payment per level, I must say this is way too complex for the scope of this support forum and even if you had to hire a developer there is a lot of word that needs to be done to make it work the way you want it to work.

    But for the sake of helping you launch your website, I have come up with a workaround to at least get the basics done but it is NOT a permanent solution for this. This is how the workaround works.

    1. Activate the Manual Payment gateway in ProSites to allow signups without requiring payment
    2. Keep the existing payment gateways they are
    3. Download the attached 'limitblogs.zip' , extract it and replace the file pro-sites/pro-sites-files/modules/limitblogs.php with the one from the zip file.

    What this will do is check if you the user has at least one blog paid on the selected level, if they do it will hide the payment gateways that require payment and only leave the manual gateway visible so they can submit without going through payment. If they do not have a paid blog for the selected level then it will hide the manual payment option and leave the other two gateways visible so they will not be able to proceed without going through payment. This is just a workaround and should be changed immediately once you have managed to get your site up.

    I can express how important it is that you take this as a temporal workaround and consider hiring a developer to make a permanent solution. Please note that this is not in the plans to be included in Pro Sites soon so it will be to your advantage to get a permanent solution and unfortunately that is beyond the scope of this support forum.

    If you believe this should be included in Pro Sites then consider creating a feature request , note that there was already a requested feature for only limiting the number of blogs per level per user and I will submit the code here to developer for review (Without the payment part for now) and if developer approves it it will be included in future releases but you will still have to add the part that requires one payment per level.

    I hope this helps.

    Have a nice day.
    Lindeni