Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Disabling Unlimited Quota "root access required"

Discussion in 'E-mail Discussions' started by gavcom, Jan 12, 2018.

  1. gavcom

    gavcom Member

    Joined:
    Mar 4, 2015
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    quota.png
    Long has it been that the horde of people have been crying for CPANEL to put in a dam email option TO REMOVE the dredded "UNLIMITED" option from the page... well i got sick and tired of looking at that word and decided to remove it MANUALLY...
    Barring some trail and error for 2 days i finally managed to remove it BUT also including limiting the MB to 2000MB regardless...
    Cpanel i mean REALLY now looking at it, its so dam simple "making sure you have root access, if you running an account outside of root access then sorry cant help you unless you point the person whom is hosting your email to this POST"
    I only did this for their new skin "Paper Lantern" i'm sure you can find the same line in the other skins but i couldn't be bothered because i only use "Paper Lantern - awesome skin btw not sure why you would use any other..."

    ** DISCLAIMER - you do this at your own risk, you use this at your own risk, i take no responsibility what so ever if you mess up by using this method... you have been warned...

    1. you must have root access to the server or hosting, hosting the cpanel/whm
    2. this edit applies to "Paper Lantern" only it MIGHT work for others
    3. you are going to edit root files of cpanel MAKE BACKUPS before attempting any edits of said files
    4. Mailbox Quota dont exceed 2048MB
    5. THIS IS ONLY FOR ENGLISH other languages should work but youll have to figure that out.

    ** LETS START **
    1. navigate to /usr/local/cpanel/base/frontend/paper_lantern/mail/pops/views
    2. find the file changeQuotaModule.ptt
    3. look for :
    email-max-quota="{{maxQuota}}"
    change to :
    email-max-quota="2000"
    can be what ever min/max amount you want just keep it below 2048
    4. look for :
    <li validation-item field-name="quota_number_input_{{$index}}" validation-name="emailMaxQuota" id="val-quota-max-quota">
    [%- LANG.mailbox_maxquota -%]
    change to :
    <li validation-item field-name="quota_number_input_{{$index}}" validation-name="emailMaxQuota" id="val-quota-max-quota">
    Quotas cannot exceed xxxxMB
    where xxxx is, is the amount you've chosen to limit too
    5. look for :
    <label class="form-inline">
    <input type="radio" id="quota_unlimited_{{$index}}" name="quotaType" value="unlimited" ng-model="quotaChange.quotaType"/>
    <span> [% LANG.unlimited %]</span>
    </label>
    and delete all of the above, this will remove the "UNLIMITED" option from the page "WOOOHOOO!!!"
    6. save and exit, reload page and check the magic of no unlimited... try setting a higher than 2000mb limit and youll see some more magic

    Cpanel so simple, i mean really... for the people that created this awesome product not to inlcuding something like this is beyond me...
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,693
    Likes Received:
    1,703
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. gavcom

    gavcom Member

    Joined:
    Mar 4, 2015
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    *bUMp* AND *Update*

    Just fair warning if cpanel does any updates it seems to always update all the paper_latern files there by overwriting the changes...
    No problem just repeat steps above and youll be back to normal again, suppose you need to keep track of cpanel/whm updates then
     
  4. LBJ

    LBJ Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    77
    Likes Received:
    2
    Trophy Points:
    158
    G'day gavcom,

    We do much same thing, but we set the max quota based on the user's hosting plan/package so different users have different max quota limits. We also install hooks on addpop/editquota. It gives us a lot of flexibility with our billing plans.

    If you first derive your own theme from the standard paper_lantern instead of changing paper_lantern directly, your changes won't be overwritten on cPanel updates. You still need to do a compare of the file changes on each update, and rebuild your own theme from the new paper_lantern base (we have quite a few extra modifications), but that usually only takes a few minutes unless there has been a major redesign.

    There's a feature request for plan-related max quotas somewhere aging away, but although it's fairly simple code changes that are required, it never seems to be added in.

    It's disappointing, and as you write, so simple, especially if you're adding it in from the development platform as the cPanel coders would be.

    Best regards,

    LBJ
     
  5. gavcom

    gavcom Member

    Joined:
    Mar 4, 2015
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator

    Ye already on that road and testing, never really dived into their code pages/themes, I just got tired of clients leaving the unlimited option on and forgetting about the box while spam builds up. Just recently removed boxes full of spam totalling near 20gig, crazy...
    and yes before you ask running CSF in "hard" mode else im sure that would have been 200gig worth of spam... LOL



    What code did you use to get this right was it part of the {{maxquote}} or some other code peice... ?



    Yes that been what YEARS now, looking at the code and thinking to my self how can they not just add a tick to HIDE it, it would honestly be so SIMPLE for them... beyond words, keeping the max quota aside, a simple tick... sheesh...
     
  6. LBJ

    LBJ Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    77
    Likes Received:
    2
    Trophy Points:
    158
    G'day gavcom,

    Take a look at...

    Template::Tutorial::Web
    ...and...
    Guide to Template Toolkit - API Calls from Template Toolkit - Software Development Kit - cPanel Documentation

    Use the template language to call the API to retrieve the hosting package for the user.
    Then limit the quota based on the plan settings you have in place.
    We also use hooks on on both addpop and editquota.
    Also, in addition to changeQuotaModule.ptt you (possibly more importantly) need to make similar mods to addEmailAccount.ptt/js/min.js

    Best regards,

    LBJ
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,693
    Likes Received:
    1,703
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I did want to note the following options are available under the "Mail" tab in "WHM >> Tweak Settings":

    Default user-defined quota value for new email accounts
    Default quota option for new email accounts

    While this doesn't prevent a cPanel user from using "unlimited" as a quota value for email accounts, it does allow you to set a default email quota that appears in the UI during the email creation process.

    Thank you.
     
  8. LBJ

    LBJ Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    77
    Likes Received:
    2
    Trophy Points:
    158
    G'day cPanelMichael,

    Thank you, but that really doesn't come near to what we needed and had to code for ourselves.

    We needed the ability to set a maximum quota size for mail accounts based on the account plan. This seemed to be a very reasonable extension of how we could already set a maximum number of email accounts, a maximum number of FTP accounts, a disk space quota, a data quota, and a limit on just about anything else associated with any specific hosting plan.

    It's a very simple thing to code, and would be truly trivial for cPanel developers to build into the code base. We modified the theme to do most of the work, but we also put hooks in place in case clients disable JavaScript or find other clever ways to post data.

    The end result is that we can be much more granular in our hosting plans. That makes it far easier for staff to solve clients' growth requirements with an easy upsell, and that drives profit growth.

    It's really an oddly missing feature of cPanel.

    Best regards,

    LBJ
     
Loading...

Share This Page