I’m not sure I understand your question, but I think you’re asking how do you create a post from a form thats submitted by a user?
These tutorials might help: http://wp.tutsplus.com/tutorials/allow-users-to-submit-images-your-site/ or http://wp.tutsplus.com/tutorials/allow-users-to-submit-to-your-wordpress-site-a-quotes-plugin/
It shows how to create post from a forms input.
For the conditional part, if you want them to be logged in use this:
if(!is_user_logged_in()) {
return '<p>You need to be logged in to do whatever this is....</p>';
}