A generic solution is nearly impossible. Why? Every user's temporary folder is per-process value. Furthermore, admin can't rely on $HOME/tmp
to be user's temporary folder as user may change it, and fact is, we (users) do that quite often by setting $TMP to something else. On top of all that, every process can have different setting that can't be controlled by the user at all...
Assuming you care only about the users' initial values of the $TMP environment variable you could write a script which would go through the list of users, get their default shell (this is yet another complication), find their default setting for $TMP and finally empty those folders. Second alternative is to write a program that logs-in as specific user, reads users's $TMP, and empties the folder...
However, I presume that all you want is to empty temporary files in those folders some web-application uses to store uploaded files. The easiest thing to do is to maintain your own list of those directories in a simple, plain-text file, and write a small script that will go through that list, and delete files that are older than N days...
I would rather rethink the overall structure of directories, and configure lighttpd, or whatever web-server you use, php, and the rest to store temporary files at KNOWN place so you can do cleanup easily. I would configure all of them to store temporary files in, say, /tmp/<domain>/<service>
so for example.com you would have: /tmp/example.com/phpbb, /tmp/example.com/redmine, /tmp/example.com/php-sessions . Of course, you have to be careful to set ownership and permissions well.