[ticket/12493] Fix sql query for selection of users that have disabled PM

This fixes a bug where a user A could not send a PM to user B when both users
allowed other users to send them a PM. More precisely, it fixes the selection
of users that either are inactive or have disabled private messages.

PHPBB3-12493

[ticket/12493] Add functional test

Added a functional test.

PHPBB3-12493
[ticket/12493] Add functional test

Added a functional test.

PHPBB3-12493