I don't quite see what your problem is...
Code:
who -u | grep "user"
should tell you if a user is logged in or not - if it produces output, then that user is logged in. If there is no output, then that user isn't logged in.
Or am I misunderstanding you?