Another PR for #816

Fixed conflicts from here: https://github.com/mybb/mybb/pull/817

https://github.com/mybb/mybb/issues/816