WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Theme My Login: redirect edit (5 posts)

  1. Doodlebee
    Member
    Posted 2 years ago #

    I just had a question. I know Theme My Login is set up to allow filters for certain things (I've already used such filters like tml_title_filters with great success), but I need to sort one out for a custom redirect.

    I, of course, have the redirects set up on the site, no problem. I want to redirect the end user - once they log in - to their profile. However, I'm trying to keep them out of the back end, and I have a custom function written so when the end user clicks the "View Profile" link I have set up, it takes them to a profile front-end Page. The profile they see is edited by adding in "?username" at the end of the URL.

    I can't really do this type of redirect with the plugin, so I was hoping to use a filter that would allow me to redirect the end user to this page: http://whatever.com/profile?username. So far, all I can do is redirect them to http://whatever.com/profile - which doesn't retrieve the proper information.

    Can you help me sort out what filter call I need to make? I was thinking it was tml_request(), but that's apparently for actions. I can't seem to find the filter I need to pull this off.

    Thanks!

  2. Doodlebee
    Member
    Posted 2 years ago #

    forgot to link to the plugin in question:

    http://wordpress.org/extend/plugins/theme-my-login/

  3. Doodlebee
    Member
    Posted 2 years ago #

    Okay, I got it sorted. I just removed the redirection module from the plugin and used a WordPress function:

    function redirect_to_profile() {
    	$who = strtolower(sanitize_user($_POST['log']));
    	$redirect_to = get_option('home') . '/profile?' . $who;
    	return $redirect_to;
    }
    add_filter('login_redirect', 'redirect_to_profile', 10, 2);

    Hope that helps someone else!

  4. Jeff Farthing
    Member
    Posted 2 years ago #

    That works - but as of TML 6.2, you can use the variable %username% within the Custom Redirection module URL fields.

  5. Doodlebee
    Member
    Posted 2 years ago #

    Well, that's even better! Awesome! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic