Mass Update Reseller Account Creation Limit

Naila

Member
Jun 20, 2017
13
0
1
Indonesia
cPanel Access Level
Root Administrator
The latest price update model of cPanel without making solutions for whm features and without studies makes me dizzy and gives endless work. I need to set account limits that can be made by resellers one by one.

Please provide solutions for mass updates for existing resellers "Limit the total number of accounts reseller-user can create Number of accounts"

For example, resellers in package A have a limit of 10 accounts, package B has a limit of 15 accounts. If anyone can help make a command that can bulk update the options I mean. I really don't have time for this that requires at least 5 days.
 
Last edited:

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
797
151
168
New Jersey
cPanel Access Level
DataCenter Provider
You can use this, just replace plan1 plan2 plan3 with the plan names.

Bash Script:

Code:
#!/bin/bash

for CPUSER in $(whmapi1 listresellers |grep - |grep [a-Z] | awk '{print $2}') ; do

RSPLAN=$(grep PLAN= /var/cpanel/users/"${CPUSER}" | sed 's/PLAN=//g')

if [ "${RSPLAN}" = plan1 ]; then
PLANLIMIT=5
fi

if [ "${RSPLAN}" = plan2 ]; then
PLANLIMIT=10
fi

if [ "${RSPLAN}" = plan3 ]; then
PLANLIMIT=15
fi

echo whmapi1 setresellerlimits user="${CPUSER}" enable_account_limit=1 account_limit="${PLANLIMIT}"

done
Its going to echo out the results so it will not actually change anything, this is just so you can ensure its going to set what you want properly, but your output should look something like

Code:
whmapi1 setresellerlimits user=user1 enable_account_limit=1 account_limit=5
whmapi1 setresellerlimits user=user2 enable_account_limit=1 account_limit=10
whmapi1 setresellerlimits user=user3 enable_account_limit=1 account_limit=15
If it looks good, then remove 'echo' from the last line so its just

Code:
whmapi1 setresellerlimits user="${CPUSER}" enable_account_limit=1 account_limit="{$PLANLIMIT}"
and it will set each reseller to the limit you set for each plan depending on which plan is set for the reseller its checking.

You can also check: https://documentation.cpanel.net/display/DD/WHM+API+1+Functions+-+setresellerlimits

for other parameters that you can set.
 
  • Like
Reactions: ebuka