Two different situations, similar answers:
"So if I am talking to different people in a forum and want to use their posts, then I need each one of them to sign a consent form?"
Yes. You need to explain the nature of the study, discuss how the data will be used, how it will be protected, whether they can be quoted or want to be anonymous (e.g. "participant A", first name only), voluntary participation and right to discontinue without penalty, etc..
"Also, what if I'm talking to an avatar and that person does not want his/her true identity exposed? " Two possible pathe: don't want to expose identity to you, as a researcher? That is tricky. How do you know the person is over 18 and can legally sign the agreement? (If under 18, parent/guardian must sign.) If they will expose identity to you as researcher, you can mask identity in the data analysis and report (again, "participant A").
If you are looking at the book, follow the Researchers' Notebook story of Jon Cabiria. He got his proposal through the IRB with avatars signing the consent agreement. It took six months-- and required a research design with multiple interactions/interviews so he could cross check and verify data.
There are other issues that must be considered in 2nd Life, related to observation, viewing the information included in the profile, etc that must be negotiated with the participant as part of the agreement.