4
If a user is logged in, $xoopsUser will be a XoopsUser object. If he is not, the object will be null. Therefore the test
if (!$xoopsUser)
(note the exclamation mark before the variable) will return true as it asks "IF the $xoopsUser variable does NOT hold a value (or a value equal to zero) THEN do this"
The second approach is a bit more complicated (especially to an unskilled PHP programmer) and has changed from News 1.0 (the one shipped with the XOOPS package) to News 1.2 version. I don't have a copy of the 1.0 version with me, so I wouldn't be able to say exactly where to put the code.