Abby
Abby

Reputation: 217

Joomla plugin or module display for non logged-in user

How would I display a module or use a plugin in Joomla to only load if a user is not logged in? I understand how to do the opposite by only displaying modules to users that are logged in, but not if they are not.

Here is an example,

I have some html and flash that I want to display in modules to advertise the benefits of joining a club. This content will be displayed on the homepage. However, if a user is logged in, I do not want him to see this content.

Upvotes: 0

Views: 695

Answers (1)

linux4me
linux4me

Reputation: 875

Have you tried including the following in your code?

$user = &JFactory::getUser();
if ($user->guest) {
  // The code to display to the guests here...
} else {
  return;
}

Upvotes: 3

Related Questions