BUG Security::permissionFailure() fixing permissionDenied hook inconsistency

permissionDenied only works if Security::permissionFailure() is called when
there's currently no logged in Member. This fixes it so failed attempts
with logged in Member also includes the permissionDenied hook.

In addition, fix an undefined $member variable
Merge pull request #1756 from halkyon/permission_denied_hook

BUG Security::permissionFailure() fixing permissionDenied hook inconsistency