[ticket/15667] Fix first char keys in MemberList
Fixing memberlist to get first_char keys from Users table. So it will support any language, and it will show only used characters.
Edit in last commit:
- Adding first characters to cache to avoid reduce performance.
- Change
includes/functions_user.phpto destroy the cache if new user is added or current user name is changed. - Limit first characters to 50 characters for the most 50 characters used in users table.
- When
users first charactersreaches the limit wordotherwill be added. - Change
otherquery for more performance and shorter SQL statement.
Checklist:
- [ ] Correct branch: master for new features; 3.2.x for fixes
- [ ] Tests pass
- [ ] Code follows coding guidelines: master and 3.2.x
- [ ] Commit follows commit message format
Tracker ticket (set the ticket ID to your ticket ID):
https://tracker.phpbb.com/browse/PHPBB3-15667
@hubaishan thanks for your contribution! In order for Travis to pass, just remove two tabs at the end of line from memberlist.php, line 1335.
This does not work the way you think it will nor in a way that I think we would like it to work. When I run this query against phpBB.com's database I get back 181 rows:
SELECT DISTINCT substring(username_clean, 1, 1) first_char
FROM phpbb_users
WHERE user_type IN (0, 1, 3)
ORDER BY first_char;
Plus it's pretty inefficient taking almost an entire second just to run this query.
This PR tested in also in oracle and mssql odbc