Get Home Directory for Users in Login Hook Script

I'm writing a script to use as a LoginHook for my Mac users. As part of this script, I need to write to a location in their home directory, but I can't seem to access the path - at this point in the login process, $HOME is empty and ~ gives the path to root's home. Unfortunately, I can't just do /Users/$1 (first arg is the user's name), since these are network accounts, with homes grouped into different directories based on their roles. Is there another way I can see the home directory path?

Thanks!

Maybe this:

getUserHome ()
{
	userName="${1}"
	egrep '^'"${userName}"':' /etc/passwd | awk -F":" '{print $6}'
}

# getUserHome testUser
/home/testUser