Viewing 6 replies - 1 through 6 (of 6 total)
  • I’m not sure you can do that using the default widget, but it shouldn’t be hard to hack. Maybe I’m wrong. I don’t have the time to really look into it right now.

    You can also redirect to a particular URL using the ‘login_redirect’filter, if you wanted to do that.

    To override the default redirect after login use the ‘login_redirect’ filter. Just remember to make sure a valid URL is returned to keep things working smoothly.

    An example implementation is:

    function custom_redirect($redirect_to) {
      // $redirect_to is the current redirect URL
    
      // Let's return our own redirect URL
      return 'http://www.mysite.com';
    }
    add_filter('login_redirect','custom_redirect');

    dgwyer, I think that solmartin wants to redirect to whatever post/page the user is on at the time of login, not to redirect to some fixed location. I couldn’t get that to work using the ‘login_redirect’ filter, though I admittedly only tried for a few minutes tops.

    Yeah, the code I posted was how to redirect to ANY given URL using the ‘login_redirect’ filter. Redirecting to the current page is another matter.

    This is purely a PHP problem, nothing to do with WordPress really (unless there is a WP function I don’t know about to do this!). You can find loads of Google results on how to do it. I have found this on particularly useful in the past:

    http://www.learnphponline.com/php-basics/how-to-find-the-current-url-in-php

    MiaV

    (@miav)

    Solmartin – a friend of mine has a site and uses a plugin ‘login with ajax’ (NetWebLogic). When I’m on his main page and login, it keeps me right there.
    Hope this is a help 🙂

    I was halfway through explaining why you can’t do this when…

    function custom_redirect($redirect_to) {
      global $post;
      return '<a href="'.wp_login_url(get_permalink($post->ID)).'">Login</a>';
    }
    add_filter('loginout','custom_redirect');

    I think that should work, but but likely needs some switching for the ‘login’ vs. ‘logout’ cases and maybe some other things. UIts a good start anyway.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Meta Login help’ is closed to new replies.