Your quoted code will kick the person, but won't set a ban.
If you're seeing a ban being set (as you show with the time stamped entry), then that's a different code.

You're going to have to figure out which code (or part of code) is actually setting the ban, and show us that, before we can help any further.