Move the general is user not logged in check into a function hooked onto...

... a filter