A
A
anikitin352014-12-01 08:51:08
Drupal
anikitin35, 2014-12-01 08:51:08

How to redirect the user to the initial page after authentication in Drupal 7?

The user is on the page. Next, he clicks on authorization. After successful authorization, he should not go to the profile, but to the initial page from which he entered the authorization.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
UksusoFF, 2014-12-01
@anikitin35

https://www.drupal.org/node/683696

A
anikitin35, 2014-12-02
@anikitin35

I form such a link format for login. Using the token, the address of the page from which the authorization is going is substituted.
In Rules, I created a user redirect rule after login. I inserted the following php code into the URL of the rule. You need to enable php-filter.

<?php
 
  $path = $_SERVER['HTTP_REFERER'];
  if (isset($_GET['current'])) {            //if (isset($_GET['destination'])) {
    $path = $_GET['current'];             // $path = $_GET['destination'];
  }                                               // }
  echo $path;
 
?>

Below is a checkbox "Force redirect" - leave it.
The redirect works. Checked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question