Jump to content
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Редирект со страницы регистрации и входа

Здравствуйте, подскажите, пожалуйста, как сделать, чтобы зарегистрированных пользователей редиректило со страницы регистрации, входа и восстановления пароля, если они туда случайно зашли по ссылке?

 

Сейчас, если перейти по этим ссылкам

 

форум.ru/index.php?app=core&module=global&section=login

форум.ru/index.php?app=core&module=global&section=register

форум.ru/index.php?app=core&module=global&section=lostpass

 

авторизованным пользователем, он попадает на эти страницы. Хотелось бы, чтобы его редиректило на главную.

 

Т.е. чтобы эти страницы были доступны только гостям.

Edited by Strategius

Featured Replies

  • Author

Получилось добавить редирект на главную страницу.

 

Для регистрации admin\applications\core\modules_public\global\register.php

 

После:

 

IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0", 'last_activity' => IPS_UNIX_TIME_NOW ) ) );

Добавил:

 

/* Редирект авторизованного пользователя на главную страницу */
$this->registry->getClass('output')->redirectScreen( $return[0], $this->registry->output->formatUrl( $this->settings['board_url'] ) );

 

Для входа admin\applications\core\modules_public\global\login.php

 

После

 

$template .= $this->registry->getClass('output')->getTemplate('login')->errors($message);
	}

Добавил

 

/* Редирект авторизованного пользователя на главную страницу */
if ($this->memberData['member_id'])
  {
  $this->registry->getClass('output')->redirectScreen( $return[0], $this->registry->output->formatUrl( $this->settings['board_url'] ) );
  }

Но насколько ли правильное это решение, и разумное ли оно вообще?

 

Для восстановления пароля admin\applications\core\modules_public\global\lostpass.php составил такую функцию:

 

protected function _avMemberRed()
{
  /* Редирект авторизованного пользователя на главную страницу */
    if ($this->memberData['member_id'])
       {
       $this->registry->getClass('output')->redirectScreen( $return[0], $this->registry->output->formatUrl( $this->settings['board_url'] ) );
       }
}

Но она почему-то не работает...

Edited by Strategius

  • Author

Кстати, чем отличается $this->registry->getClass('output')->silentRedirect от $this->registry->getClass('output')->redirectScreen?

Кстати, чем отличается $this->registry->getClass('output')->silentRedirect от $this->registry->getClass('output')->redirectScreen?

Во втором случае после редиректа появляется сообщение.

  • Author

@newbie, понял, спасибо!

 

Для добавления редиректа на страницу восстановления пароля в файле admin\applications\core\modules_public\global\lostpass.php

 

После

 

if ( $this->settings['bot_antispam_type'] != 'none' )
	{
		$this->output = str_replace( "<!--{REG.ANTISPAM}-->", $captchaHTML, $this->output );
	}

Добавляем

 

/* Редирект авторизованного пользователя на главную страницу */
       if ($this->memberData['member_id'])
       {
          $this->registry->getClass('output')->silentRedirect( $this->registry->output->formatUrl( $this->settings['board_url'] ) );
       }

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.