---
title: "Show a Form Only to Logged-In Users - Convert Forms"
description: "Sometimes you only want logged-in users to see a form — for example, when collecting private data or offering something exclusive. In this guide, we"
url: "https://www.tassos.gr/docs/convert-forms/functionality/show-a-form-only-to-logged-in-users"
date: "2026-04-30T16:18:19+00:00"
language: "en-GB"
---

[ Home ](https://www.tassos.gr/index.php?option=com_content&view=category&layout=blog&id=24&Itemid=1088) / [ Convert Forms ](https://www.tassos.gr/index.php?option=com_content&view=category&id=43) / [ Functionality ](https://www.tassos.gr/index.php?option=com_content&view=category&id=60)

#  Show a Form Only to Logged-In Users

Sometimes you only want logged-in users to see a form — for example, when collecting private data or offering something exclusive. In this guide, we’ll walk you through how to hide a form from guests and show a helpful message instead, including a link to the login page.

## [Hide the Form From Guests](#hide-the-form-from-guests)

To hide the form from guests, edit your form, go to Behavior &gt; [PHP Scripts](https://www.tassos.gr/docs/engagebox/developers/php-scripts) &gt; Form Display, and add:

 ```
if ($user->guest)
{
     $formLayout = '';
}
```

## [Show a Message to Guests with a Login Link](#show-a-message-to-guests-with-a-login-link)

To inform your guests that this form is only accessible to logged-in users, you can display a helpful message that includes a login link, notifying them that they must log in first.

To add this helpful message, edit your form, go to Behavior &gt; [PHP Scripts](https://www.tassos.gr/docs/engagebox/developers/php-scripts) &gt; Form Display, and add:

 ```
if ($user->guest)
{
     $loginUrl = \Joomla\CMS\Router\Route::_('index.php?option=com_users&view=login');
     $formLayout = sprintf('You must <a href="%s">log in</a> first before you can view this form.', $loginUrl);
}
```

 Last updated on Jun 3rd 2025 17:06

## Schema

```json
{
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [
        {
            "@type": "ListItem",
            "position": 1,
            "name": "Home",
            "item": "https://www.tassos.gr"
        },
        {
            "@type": "ListItem",
            "position": 2,
            "name": "Home",
            "item": "https://www.tassos.gr/docs"
        },
        {
            "@type": "ListItem",
            "position": 3,
            "name": "Convert Forms",
            "item": "https://www.tassos.gr/docs/convert-forms"
        },
        {
            "@type": "ListItem",
            "position": 4,
            "name": "Functionality",
            "item": "https://www.tassos.gr/docs/convert-forms/functionality"
        },
        {
            "@type": "ListItem",
            "position": 5,
            "name": "Show a Form Only to Logged-In Users",
            "item": "https://www.tassos.gr/docs/convert-forms/functionality/show-a-form-only-to-logged-in-users"
        }
    ]
}
```

```json
{
    "@context": "https://schema.org",
    "@type": "Article",
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://www.tassos.gr/docs/convert-forms/functionality/show-a-form-only-to-logged-in-users"
    },
    "headline": "Show a Form Only to Logged-In Users",
    "image": {
        "@type": "ImageObject",
        "url": "https://www.tassos.gr/"
    },
    "publisher": {
        "@type": "Organization",
        "name": "Tassos",
        "logo": {
            "@type": "ImageObject",
            "url": "https://www.tassos.gr/https://www.tassos.gr/media/brand/logo-text.png"
        }
    },
    "author": {
        "@type": "Person",
        "name": "Stergos Zamagias",
        "url": "https://www.tassos.gr/docs/convert-forms/functionality/show-a-form-only-to-logged-in-users"
    },
    "datePublished": "2025-06-03T17:17:48+03:00",
    "dateCreated": "2025-06-03T17:17:48+03:00",
    "dateModified": "2025-06-03T17:19:16+03:00"
}
```
