Run PHP when node and/or profile is updated?
Theming functions are the wrong place for something like that. To run some PHP code after an node or profile (thus entity) is updated you should use the Rules module or use the following hooks, hook_entity_insert, hook_entity_update