You can replace
PHP Code:
$bbuserinfo[userid] != 0
With
PHP Code:
in_array($bbuserinfo[usergroupid], array(X,Y,Z))
Change the x, the y and the z to the usergroupids that are allowed to view the links.
You can add more usergroups to the list, like this: array(W,X,Y,Z)
If you's like to enter a list of usergroups that are NOT allowed, please a little ! in from of the in_array, like this:
PHP Code:
!in_array($bbuserinfo[usergroupid],....
And change the x, the y and the z to usergroups that are not allowed to view the links.
Hope that helps

.