Ordering fields in template.php file
Firstly, why template.php for reordering the fields of an entity edit form? You should put this logic in a module and not a theme, look up hook_fomr_alter and hook_form_FORM_ID_alter.

Secondly, if the profile is the default user profile in D7 or you have created one using profile2, you can go to the manage fields section of the entity and reorder the fields just by dragging them. That should change the order on both view page and edit page of the entity, no?

Can you try it out and see if it works! You might not need to write code at all!