[ticket/12426] Rework of user search

Rework of all concerns found in the audit of the code
Rework on some parts for better code comapatability

PHPBB3-12426