refactored control flow to determine if/which buttons to display in user profile