You needed:
```
if (($vsite = vsite_get_vsite()) && $vsite->id != $gid)
```
$vsite = vsite_get_vsite() by itself will always return true since it is returning the result of the assignment operation not ($vsite)