I'd suggest you start over with the plugin because you've totally messed up the structure of the submenu.
The reason why you are ending up with the condition showing up in the code is because you are putting it there. Look again at the code I wrote. You need to *end* your writing to the variable $tablinks, then do the condition and add to $tablinks if the condition is true, and then continue writing to it later on. But, you need to break out of writing to it in order to do the condition - you just put the condition right in the middle of it! Basically:
PHP Code:
$tablinks = 'a bunch of stuff';
if (is_member_of($vbulletin->userinfo, 5, 6, 13, 14))
{
$tablinks .= 'more stuff if condition is true';
}
$tablinks .= 'and more stuff';