How to disable a block for guest or not logged

Re: How to disable a block for guest or not logged

by Red Morris -
Number of replies: 0

Use something like this and it should work:

if (isloggedin() && !isguest()) {
   $this->content->text = 'fgdfgdgdgdfgdfg';
} else {
   $this->content->text = '';
}

If the content is blank Moodle won't show the block