]> git.mxchange.org Git - friendica.git/commitdiff
Redirect remote visitors to their own profile after logout
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 11 Jun 2019 23:41:11 +0000 (19:41 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 11 Jun 2019 23:41:11 +0000 (19:41 -0400)
src/Module/Logout.php

index 4ccba2d744f23188631b4626d817ea185fb17b78..1f60e6dc191ceda75990d76dc5878d7182841c29 100644 (file)
@@ -9,6 +9,8 @@ use Friendica\BaseModule;
 use Friendica\Core\Authentication;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
+use Friendica\Core\System;
+use Friendica\Model\Profile;
 
 /**
  * Logout module
@@ -22,9 +24,19 @@ class Logout extends BaseModule
         */
        public static function init()
        {
+               $visitor_home = null;
+               if (remote_user()) {
+                       $visitor_home = Profile::getMyURL();
+               }
+
                Hook::callAll("logging_out");
                Authentication::deleteSession();
-               info(L10n::t('Logged out.') . EOL);
-               self::getApp()->internalRedirect();
+
+               if ($visitor_home) {
+                       System::externalRedirect($visitor_home);
+               } else {
+                       info(L10n::t('Logged out.'));
+                       self::getApp()->internalRedirect();
+               }
        }
 }