diff --git a/editcache.php b/editcache.php
index ebd97c90b4..7cb51614ad 100644
--- a/editcache.php
+++ b/editcache.php
@@ -737,32 +737,73 @@ function build_drop_seq($item_row, $selected_seq, $max_drop, $thisid, $drop_type
$cacheLimitByTypePerUser = GeoCache::getUserActiveCachesCountByType($usr['userid']);
- //build typeoptions
+ //build type options
$types = '';
- foreach (GeoCacheCommons::CacheTypesArray() as $type) {
- // blockforbidden cache types
- if (($type != $cache_type) && in_array($type, OcConfig::getNoNewCacheOfTypesArray()) && !$usr['admin']) {
- continue;
- }
- if (isset($config['cacheLimitByTypePerUser'][$cache_type]) &&
- $cacheLimitByTypePerUser[$cache_type] >= $config['cacheLimitByTypePerUser'][$cache_type] &&
- !$usr['admin']) {
- continue;
- }
- if (isset($cacheLimitByTypePerUser[$type]) &&
- isset($config['cacheLimitByTypePerUser'][$type]) &&
- $cacheLimitByTypePerUser[$type] >= $config['cacheLimitByTypePerUser'][$type] &&
- !$usr['admin']) {
- continue;
- }
-
- if ($type == $cache_type) {
- $types .= '';
- } else {
- $types .= '';
+ // do not provide change cache type options
+ // if config limit for current type is exceeded
+ if (
+ !$usr['admin']
+ && isset($cacheLimitByTypePerUser[$cache_type])
+ && isset($config['cacheLimitByTypePerUser'][$cache_type])
+ && $cacheLimitByTypePerUser[$cache_type]
+ >= $config['cacheLimitByTypePerUser'][$cache_type]
+ ) {
+ } else {
+ foreach (GeoCacheCommons::CacheTypesArray() as $type) {
+
+ if (!$usr['admin']) {
+ // block forbidden cache types
+ if (
+ ($type != $cache_type)
+ && in_array(
+ $type, OcConfig::getNoNewCacheOfTypesArray()
+ )
+ ) {
+ continue;
+ }
+ // do not include types where limit is exceeded
+ if (
+ isset($cacheLimitByTypePerUser[$type])
+ && isset(
+ $config['cacheLimitByTypePerUser'][$type]
+ )
+ && $cacheLimitByTypePerUser[$type]
+ >= $config['cacheLimitByTypePerUser'][$type]
+ ) {
+ continue;
+ }
+ }
+ if ($type == $cache_type) {
+ $types .=
+ '';
+ } else {
+ $types .=
+ '';
+ }
}
}
tpl_set_var('typeoptions', $types);