move if statements to outside section in template

per @cvan

Quick fix to profile page that I didn't do before I merged.