Forum categories

Исключаем указанные экстраполя из видимости при сортировке пользователей

Как в Cotonti, в списках пользователей скрыть определенные экстраполя для сортировки в списках пользователей


webitproff
webitproff • 2025-07-06 18:10 #1

Задача, в списке пользователей, добавить возможность исключать имена экстраполей для фильтрации/сортировки, например такие поля как телефон, телеграм, и т.д.

в файл локализации users.ru.lang.php добавить

$L['cfg_filterFieldsDenied'] = 'Экстраполя, которые исключаем из фильтра';

в файл локализации users.en.lang.php добавить

$L['cfg_filterFieldsDenied'] = 'ExtraFields that are excluded from the filter';  

в файл конфигурации users.setup.php добавить

filterFieldsDenied=06:string:::

в файл логики списка пользователей users.main.php
после массива

$usersSortFieldsBlacklist = [
  'banexpire',
  'password',
  'passfunc',
  'passsalt',
  'email',
  'lastip',
  'sid',
  'sidtime',
  'lostpass',
  'auth',
  'token'
];

 


добавить

if (!empty(Cot::$cfg['users']['filterFieldsDenied'])) {
  $deniedFields = array_map('trim', explode(',', Cot::$cfg['users']['filterFieldsDenied']));
  $usersSortFieldsBlacklist = array_merge($usersSortFieldsBlacklist, $deniedFields);
}

 

всё. готово. проверил сам. работает.

🗿

🧙‍♂️ Well met, good traveler! Fate has guided your steps to our humble realm. Here, wise sages and masters of the coding craft ⚒️📜 gather to unravel the mysteries of the code ✨⚙️, share their knowledge, and add new chapters to our chronicles.
⬅️ To the left lie ancient scrolls 📚 filled with forgotten wisdom. ⬆️ Straight ahead, friendly folk offer counsel 💬 to those in need. ➡️ To the right, you may become a chronicler ✍️ yourself, sharing your craft and leaving words of wisdom for those yet to come.
📝 Delay no longer—tell us the name by which you are known, complete the rite of registration 🛡️, and join our fellowship!
🏰 Our brotherhood holds no secret initiation, yet many halls remain closed to wandering guests, for some knowledge 💎 is reserved for those who choose to walk this path beside us.