Thanks for your reply, actually the question was not perfect for my solution.
I would like to add 2 fields to the table "bans"
1. Banned username
2. Banned by username
How can I get that values in functions.php.
When banning someone, the stored data is not the username but the IP address:
ip | report_count | ban_time
You can get the banned IP addresses from the database using a MySQL query
The number of reports (report_count) needed to ban a user is found in config.php ($NUM_REPORTS_TO_BAN).
In config.php you also find the ban timeout ($BAN_TIMEOUT).
/* User filtering and ban*/
$FILTER_TIMEOUT = 30; // set the filter button, minutes (do not connect to filtered user for XX minutes)
$NUM_REPORTS_TO_BAN = 3; // set the report button (number of reports needed for a user to be banned)
$BAN_TIMEOUT = 180; // set the report button, minutes (ban reported user for XX minutes)
/* Maintenance settings */
$REMOVE_SESSIONS_OLDER_THAN = '180'; // set the amount of time, minutes, sessions to be cleared by the ?task=cleanAllOlder function
With a simple script, where $REPORT_COUNT is equal or higher than $NUM_REPORTS_TO_BAN and $BAN_TIMEOUT is not expired, you have the list of banned users.
Your website may also store the IP address of the users (when registering), you can make a comparison.
The problem with this method is that users are logging in from different locations …