You don't need any php to do that, assuming you can put conditions in the template to control when the ads show. You just need to create a custom profile field, like maybe a radio button field with 2 options Yes and No, then in the template:
Code:
<vb:if condition="!is_member_of($bbuserinfo,x,y,z) AND $bbuserinfo[fieldX] != 'No'">
Ad code
</vb:if>
You would need to change the X (in red above) to the actual field number of the profile field you create.