This plugin disable Mautic features after extend limit of number of identified contacts. You can hide create new contact, new email, campaigns or editation too.
- Use last version
- Unzip files to plugins/MauticLimiterBundle
- Clear cache (app/cache/prod/)
- Go to /s/plugins/reload
Configure Limiter from config (app/config/local.php)
'limiter' => [
'limit' => 5000,
'routes' => [
'*campaigns/new',
'*campaigns',
'*contacts/new',
'*contacts/edit/*',
],
'message' => '<h3>Contacts limit: {numberOfContacts}/{actualLimit}</h3><p>You have reached the limit of contacts. <a href="bttps://mtcextendee.com/contact"><strong>contact support</strong></a></p>',
'style'=>'.alert-limiter-custom { background:red; color:#fff; }',
'api_secret_key' => 'some hash'
]
- limit = number for identified contacts to stop (0 means unlimited)
- message - your message (allow HTML)
- routes - array of url routes with wildcard
- style - css style for alert message (class .alert-limiter-custom)
- api_secret_key - add API secret key If you want use API. This key would be validate from request
Every change require clear cache (app/cache/prod/)
You can use in message these tokens
- {numberOfContacts}
- {actualLimit}
$api = new \Mautic\Api\Api($auth, $apiUrl);
$response = $api->makeRequest('limiter/get'); // get all settings
$response = $api->makeRequest('limiter/message/get'); // get message setting
$response = $api->makeRequest('limiter/limit/get'); // get limit setting
$response = $api->makeRequest('limiter/routes/get'); // get routes setting
$response = $api->makeRequest('limiter/routes/style'); // get style setting
Response
Array
(
[response] => Any response from your request
)
$api = new \Mautic\Api\Api($auth, $apiUrl);
$response = $api->makeRequest(
'limiter/message/update',
[
'message' => 'My custom message',
'api_secret_key' => 'somehash'
],
'POST'
);
$response = $api->makeRequest(
'limiter/style/update',
[
'style' => '.alert-limiter-custom { background:red } ',
'api_secret_key' => 'somehash'
],
'POST'
);
$response = $api->makeRequest(
'limiter/limit/update',
[
'limit' => 1000,
'api_secret_key' => 'somehash'
],
'POST'
);
$response = $api->makeRequest(
'limiter/routes/update',
[
'routes' => [
'*contacts/new',
'*contacts/edit*',
'*campaigns/edit*'
],
'api_secret_key' => 'somehash'
],
'POST'
);
Response
Array
(
[success] => 1
)
Icons made by Freepik