add if function for creating post as logged in user