control the view access permissions by field.tpl.php in D7
Never put any business logic into tpl files. They can be cached. So unless it's the &quot;if odd, add class odd&quot; type of logic, it may fail you miserably.
If you need more elaborate rules than Field Permissions give you, you need to implement hook_field_access($op, $field, $entity_type, $entity, $account) in your custom module.

Return value
TRUE if the operation is allowed, and FALSE if the operation is denied.

Field Permissions module is open source. You can see it's source to learn how this hook is supposed to be used. Same with User role field module. Both are pretty well commented in code, and can serve as good examples how to write your own custom logic. Just make sure you are not forking one, this may lead to more complications than it's worth - if they are not sufficient, inspire and even copy parts of code, but use your own name and info file.