WordPress.org

Ready to get started?Download WordPress

Forums

Theme My Login
[resolved] Redirect on Login (6 posts)

  1. Wierdbeard65
    Member
    Posted 10 months ago #

    Hi,

    I'm using TML (Great plugin, BTW)

    My only issue is that, no matter how I set it up, my users always seem to be directed to their profile page on login!

    I want them to be directed to the referring page or, if this can't be done, the main website homepage.

    Similarly, on logout, I want them to go to the homepage, not the login screen.

    Not sure what is happening, I have set up the redirects (I think) as per the instructions.

    Thanks in advance for any help!

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

  2. Wierdbeard65
    Member
    Posted 10 months ago #

    Ok, after a LOT of digging around and randowm playing, I think I have found the problem...

    I am using the function wp_loginout() to generate the URL which I am adding to my menu bar through my theme's functions.php (I don't want a sidebar.)

    Anyway, I was using it as wp_loginout('index.php',false) since I wanted to go back to the index page. I have changed the call to wp_loginout('',false) and it now seems to follow the settings made through TML :-)

    Just posting here in case anyone else stumbles across this problem....

  3. marvmckay66
    Member
    Posted 10 months ago #

    This might be affecting me - where do you find the function wp_loginout() to edit this?

  4. mrsplat06
    Member
    Posted 10 months ago #

    I am having the same issue and would like to know where you modified the code. I have not had any success finding it.

  5. marvmckay66
    Member
    Posted 10 months ago #

    mrsplat06, if you're using TML on its own, just click on the TML link on the left side of your Dashboard, and on the general settings, make sure to check "Enable custom redirection." Then a "redirection" link will appear, click on that to set your redirects. But make sure to notice that there are redirect settings for every level, in my case, I scrolled down to the bottom because I only wanted to redirect subscribers.

    I'm also using TML in conjunction with Paid Membership Pro, so I also had to hand-code redirect on login based on membership level, which went into the functions.php file ... if you need assistance with something like that, let me know.

  6. Wierdbeard65
    Member
    Posted 10 months ago #

    Sorry for not replying sooner!

    As marvmckay said, you can set up the redirection directly in TML. My problem was that it was ignoring those redirections.

    My default, the login link is part of the sidebar and you don't need to worry about it (THAT one works). My theme modifies this though as I don't have a sidebar at all. I add the login / logout link to my main menu with the following code (in the functions.php of my theme):

    add_filter('wp_page_menu', 'add_login_logout_link', 10, 2);
    function add_login_logout_link($items, $args) {
        $loginoutlink = wp_loginout('',false);
    	$pos=strrpos($items,'</ul>');
    	if($pos ===false){
            $items .= '<li>'. $loginoutlink .'</li>';
    	}else{
    	   $items = substr($items,0,$pos).'<li>'. $loginoutlink .'</li>'.substr($items,$pos);
    	}
        return $items;
    }

    You can see the call to wp_loginout() there on the first line of the function and it was this that I changed from my original attempt where the first parameter was 'index.php' instead of ''

    HTH

Reply

You must log in to post.

About this Plugin

About this Topic