Custom Re-directing (3 posts)

  1. wisconjon
    Posted 8 years ago #

    I'm trying to use wordpress as an intranet for my small organization. I'd like to have the users login to give comments. However, I don't want it to re-direct to their admin page, but to the last page they were at.

    I set session variables, one includind $_SERVER['PHP_SELF']. So I'd like to replace some of the code in wp-login to re-direct to the session variable that was set to PHP_SELF on the previous page...when I try to do it in the wp-login it won't re-direct. Do I have to change settings in another file to get it to do so? Why doesn't it automatically re-direct to the page they were trying to comment on in the first place...

  2. Kafkaesqui

    Posted 8 years ago #

    'PHP_SELF' is bad here because it refers to the current PHP document, which in this case would be wp-login.php.

    Instead of editing wp-login, here's an example of the login link I have in my sidebar (only I use it to logout):

    <li><a href="<?php echo get_settings('siteurl') . '/wp-login.php?redirect_to=' . $_SERVER['REQUEST_URI']; ?>">Log Out</a></li>
  3. wisconjon
    Posted 8 years ago #

    Thanks for this...I think this is a good workaround.

    However, is there a problem with updating wp-login?

    I'd like to be able to use the "meta" widget instead of custom creating this login feature.

    Also, as a clarification, I used PHP_SELF on the previous page, not on wp-login.

    So the session variable $_SESSION['variable'] is set to the previous page not wp-login.

    The question is if I can simply update wp-login to go to the previous page using this session variable. Is this possible?

Topic Closed

This topic has been closed to new replies.

About this Topic