A template hook has to be html, it doesn't get processed like a template. (I believe you would see the if tags unprocessed if you viewed the page source). And your vars didn't get processed because you have the string in single quotes.
So you could do this:
Code:
if (in_array($post[usergroupid], array( 1,2,3,4,5,6,7,8,9,10,11,12,13,14)) AND is_member_of($vbulletin->userinfo, array( 5,6,7)))
{
$template_hook[postbit_user_popup].= "<tr><td class=\"vbmenu_option\"><a href=\"iptest.php?domain=$post[ip]\">WhoisIP for $post[username]: $post[ip]</a></td></tr>";
}
assuming the values of $post are set at that point in the code.