After forced login, return to first entered login I have situation where i redirect user programatically on condition. After condition is met:

drupal_goto('http://www.mydomain.com/user/login');


But what it does, it forgets path that was initially entered by user.

Is there a way to redirect user to login (programatically), but to remember url ?
(as it works when you try to login to admin area).

BTW, i have Login Tobbogan also installed. (Drupal 7)

Thanks!
I believe the correct way to do this is:
drupal_goto('user/login', array('query' =&gt; drupal_get_destination()));

The documentation for drupal_get_destination() states:

Prepares a 'destination' URL query parameter for use with drupal_goto().
Used to direct the user back to the referring page after completing a form. By default the current URL is returned. If a destination exists in the previous request, that destination is returned. As such, a destination can persist across multiple pages.

Update: You could try putting the URL in directly:
$path = 'path-to-redirect-to'; // or $GET['q']
drupal_goto('user/login', 'query' =&gt; array('destination' =&gt; $path)));