diff --git a/controllers/matrix_chat.php b/controllers/matrix_chat.php
index 9b56f1219e8e108137755d41bc5ed6626a2826df..da0c589b281b125d8e19062f7fe124c5092ccfe9 100644
--- a/controllers/matrix_chat.php
+++ b/controllers/matrix_chat.php
@@ -40,40 +40,66 @@ class MatrixChatController extends AuthenticatedController
     {
         Navigation::activateItem('/course/matrix/matrix_chat');
 
-        if (!Config::get()->MATRIX_AUTO_CREATE_ACCOUNTS) {
-            PageLayout::postInfo(
-                sprintf(
-                    dgettext('matrix', 'Sollten Sie sich noch nie beim Chat angemeldet haben, ' .
-                        'tun Sie dies bitte jetzt und %sladen danach die Seite neu%s.'),
-                    '<a href="" title="' . dgettext('matrix', 'Seite neu laden') . '">',
-                    '</a>'
-                )
-            );
-        }
+        $this->noChat = false;
+
+        $member = CourseMember::find([$this->course->id, User::findCurrent()->id]);
+
+        // Chat can only be used if user is visible (Matrix has no privacy settings in chat)
+        if ($member->visible == 'yes' || $member->visible == 'unknown' && Config::get()->USER_VISIBILITY_UNKNOWN) {
+
+            if (!Config::get()->MATRIX_AUTO_CREATE_ACCOUNTS) {
+                PageLayout::postInfo(
+                    sprintf(
+                        dgettext('matrix', 'Sollten Sie sich noch nie beim Chat angemeldet haben, ' .
+                            'tun Sie dies bitte jetzt und %sladen danach die Seite neu%s.'),
+                        '<a href="" title="' . dgettext('matrix', 'Seite neu laden') . '">',
+                        '</a>'
+                    )
+                );
+            }
 
-        // Check if current user has a Matrix account.
-        $this->account = MatrixAccount::find(User::findCurrent()->id);
+            // Check if current user has a Matrix account.
+            $this->account = MatrixAccount::find(User::findCurrent()->id);
 
-        $this->no_account_wanted = UserConfig::get(User::findCurrent()->id)->MATRIX_NO_ACCOUNT_WANTED;
+            if ($this->no_account_wanted = UserConfig::get(User::findCurrent()->id)->MATRIX_NO_ACCOUNT_WANTED) {
+                $this->noChat = true;
+            }
 
-        if (!$this->account && !Config::get()->MATRIX_AUTO_CREATE_ACCOUNTS) {
-            $this->account = new MatrixAccount();
-            $this->account->user_id = User::findCurrent()->id;
-            $this->account->matrix_account_id = '@' . User::findCurrent()->username . ':' . Config::get()->MATRIX_SERVER_HOSTNAME;
-            $this->account->matrix_password = '';
-            $this->account->store();
-        }
+            if (!$this->account && !Config::get()->MATRIX_AUTO_CREATE_ACCOUNTS) {
+                $this->account = new MatrixAccount();
+                $this->account->user_id = User::findCurrent()->id;
+                $this->account->matrix_account_id = '@' . User::findCurrent()->username . ':' .
+                    Config::get()->MATRIX_ACCOUNTS_LOCAL_PART;
+                $this->account->matrix_password = '';
+                $this->account->store();
+            }
 
-        $this->hasToCreate = false;
-        if ($this->account || !Config::get()->MATRIX_AUTO_CREATE_ACCOUNTS) {
-            if (!($room = MatrixRoom::findOneByRange_id(Course::findCurrent()->id))) {
-                $this->hasToCreate = true;
-            } else {
-                $this->hasToCreate = false;
+            $this->hasToCreate = false;
+            if ($this->account || !Config::get()->MATRIX_AUTO_CREATE_ACCOUNTS) {
+                if (!($room = MatrixRoom::findOneByRange_id(Course::findCurrent()->id))) {
+                    $this->hasToCreate = true;
+                } else {
+                    $this->hasToCreate = false;
 
-                //$room->requireMembership($this->account->getLinkedAccount());
-                $room->requireInvitation($this->account->getLinkedAccount());
+                    //$room->requireMembership($this->account->getLinkedAccount());
+                    $room->requireInvitation($this->account->getLinkedAccount());
+                }
             }
+
+        } else {
+
+            PageLayout::postInfo(sprintf(
+                dgettext('matrix', 'Sie sind nicht in der Teilnehmendenliste der ' .
+                    'Veranstaltung sichtbar. Da dies im Matrixchat nicht abgebildet werden kann, müssen Sie sich ' .
+                    'erst %ssichtbar schalten%s, bevor Sie am Chat teilnehmen können.'),
+                '<a href="' . URLHelper::getURL(
+                    'dispatch.php/course/members/change_visibility/make_visible/participant',
+                    ['cid' => $this->course->id]) . '">',
+                    '</a>'
+                )
+            );
+            $this->noChat = true;
+
         }
 
     }
diff --git a/migrations/20210519_init_matrix_chat.php b/migrations/01_init_matrix_chat.php
similarity index 85%
rename from migrations/20210519_init_matrix_chat.php
rename to migrations/01_init_matrix_chat.php
index bd34aa421b158d104bf804a7c4935d2fb4aae3d8..f4b3d3b0cc716b0a9b8252420b07b8174e587547 100644
--- a/migrations/20210519_init_matrix_chat.php
+++ b/migrations/01_init_matrix_chat.php
@@ -49,12 +49,13 @@ class InitMatrixChat extends Migration
 
         // Create global config entries
         $entries = [
-            'MATRIX_SERVER_HOSTNAME' => [
+            'MATRIX_SERVER' => [
                 'value' => '',
                 'type' => 'string',
                 'range' => 'global',
                 'section' => 'matrix',
-                'description' => 'Unter welchem Hostnamen ist der Matrixserver erreichbar?'
+                'description' => 'Hostname oder URL des Matrixservers (falls die Konfiguration über einen ' .
+                    '.well-known-Eintrag erfolgt, reicht der Hostname aus)'
             ],
             'MATRIX_SYSTEM_ACCOUNT_USERNAME' => [
                 'value' => '',
@@ -84,7 +85,15 @@ class InitMatrixChat extends Migration
                 'section' => 'matrix',
                 'description' => 'Soll automatisch versucht werden, Matrixaccounts anzulegen? Andernfalls wird ' .
                     'ein Link zum Chatserver angezeigt.'
-            ]
+            ],
+            'MATRIX_ACCOUNTS_LOCAL_PART' => [
+                'value' => '',
+                'type' => 'string',
+                'range' => 'global',
+                'section' => 'matrix',
+                'description' => 'Local part der verwendeten Matrixkennungen. Wird nur verwendet, wenn ' .
+                    'MATRIX_AUTO_CREATE_ACCOUNTS auf false steht.'
+            ],
         ];
 
         foreach ($entries as $name => $data) {
@@ -102,7 +111,7 @@ class InitMatrixChat extends Migration
         DBManager::get()->execute("DROP TABLE IF EXISTS `matrix_accounts`");
         DBManager::get()->execute("DROP TABLE IF EXISTS `matrix_rooms`");
         // Remove config entries.
-        Config::get()->delete('MATRIX_SERVER_HOSTNAME');
+        Config::get()->delete('MATRIX_SERVER');
         Config::get()->delete('MATRIX_SYSTEM_ACCOUNT_USERNAME');
         Config::get()->delete('MATRIX_SYSTEM_ACCOUNT_PASSWORD');
         Config::get()->delete('MATRIX_CHATSERVER_URL');
diff --git a/models/MatrixClient.php b/models/MatrixClient.php
index e0ceee4a8bca4587b0becc621a5e2dc5e32bb234..a7faa04a3c942bcc5ddaec84d1801438251d2ef2 100644
--- a/models/MatrixClient.php
+++ b/models/MatrixClient.php
@@ -29,8 +29,13 @@ class MatrixClient
     public static function get()
     {
         if (is_null(MatrixClient::$client)) {
+
+            // Check if the global config entry is just a hostname or a full URL
+            $parsed = parse_url(Config::get()->MATRIX_SERVER);
+
             MatrixClient::$client = new Patrix\MatrixClient(
-                Config::get()->MATRIX_SERVER_HOSTNAME
+                $parsed['scheme'] ? $parsed['host'] : $parsed['path'],
+                $parsed['scheme'] ? Config::get()->MATRIX_SERVER : ''
             );
         }
 
diff --git a/plugin.manifest b/plugin.manifest
index 0d884a3dbed8c7062e4a5e36153ece2e12bdba6a..43de2ca86e881555b93f173a357011e177cf2362 100644
--- a/plugin.manifest
+++ b/plugin.manifest
@@ -1,7 +1,7 @@
 pluginname=Matrix-Chat
 pluginclassname=MatrixPlugin
 origin=data-quest
-version=0.95
+version=0.96
 screenshot=assets/images/matrix_logo.png
 description=Matrix chat for Stud.IP courses
 studipMinVersion=4.5
diff --git a/vendor/libpatrix b/vendor/libpatrix
index 19fd4fcb03af057641cd7f7e30264957ce3b2378..403ac1cf84c817250e8b2757feb07d85dabdad7f 160000
--- a/vendor/libpatrix
+++ b/vendor/libpatrix
@@ -1 +1 @@
-Subproject commit 19fd4fcb03af057641cd7f7e30264957ce3b2378
+Subproject commit 403ac1cf84c817250e8b2757feb07d85dabdad7f
diff --git a/views/matrix_chat/index.php b/views/matrix_chat/index.php
index f074c064922872c22e7dc7833dc937af85a828a2..22e333a3dd44592fc116692c9668a935d08375b4 100644
--- a/views/matrix_chat/index.php
+++ b/views/matrix_chat/index.php
@@ -20,6 +20,6 @@
     <div class="matrix-loading" data-endpoint="<?= htmlReady($controller->link_for('matrix_chat/require_room')) ?>">
         <?= Assets::img('ajax-indicator-black.svg') ?>
     </div>
-<? else : ?>
+<? elseif (!$noChat) : ?>
     <iframe src="<?php echo htmlReady(Config::get()->MATRIX_CHATSERVER_URL) ?>" width="100%" height="100%"></iframe>
 <? endif;