In /includes/acp/acp_bbcodes.php upon trying to add a new custom BBCode you encounter this block of code:There are several issues with this:
- Why 1511 if the column datatype is (for MySQL) TINYINT(3) and thus could never go beyond 999?
- Why not having a datatype (for MySQL) of i.e. MEDIUMINT(8)? Because:
- Consider the user (or the installation of a MOD or several DB restorations) having inserted a couple of custom BBCodes and then delete them again: those IDs are lost and won't be re-used ever. Thus, once the user hits this 1511 limit he can't do anything about it anymore.
- This problem has risen in this phpBB Support topic and I think it can be solved only by changing the PHP file and augmenting the database table column datatype.
Since that did not really solve the problem (it's only a workaround and in a distant future the same problem will be encountered again), the PHP code needs to be modified. I think the best idea would be to:
- SELECT all BBCode IDs, so you have a list of existing ones
- Count from NUM_CORE_BBCODES+ 1 upwards until you have an ID which is not in that list
- Serve this ID when INSERTing the dataset.
That way native BBCodes aren't touched and the ID of existing custom BBCodes is not needed anymore for examining a questionable MAX() approach