• I’m currently using the plug in PHPBB Single Sign On to have the two sites integrated together, but I would like all my registrations, log ins, and log outs to run through the PHPBB side. I’ve searched and searched for a plugin or hack to do this without going through and changing every link and writing a script to pull the correct sessions id “?sid=” for the log out. If anyone can help with this that’d be great! The site is https://darintheurer.com if you wanna take a look.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can make a simple plugin that just adds filters to the loginout and register hooks.

    Something like:

    add_filter( 'loginout', 'bb_loginout_link' );
    add_filter( 'register', 'bb_register_link' );
    
    function bb_loginout_link ( $original_link ) {
    	if ( is_user_logged_in() )
                    /* pull in data from $original_link and transform it if you need to*/
    		$link = "https://yoursite.com/bb-logOUT-link";
    	else
    		$link = "https://yoursite.com/bb-logIN-link";
    	return $link;
    }
    
    function bb_register_link ( $orignal_link ) {
    	return "https://yoursite.com/bb-register-link";
    }

    Note: I have NOT tested this exact code, this is just a guide. Please test. Hope this helps.

    Thread Starter meek2100

    (@meek2100)

    That changed the links in the meta area, but how do I change it so that when someone needs to login/register through the comment area it goes to my custom link as well.

    Hmm, I’m not sure. Is it overridden by your template somehow? Sorry I can’t be more help.

    The additional hacky thing you could do, maybe, is add actions onto the authentication system hooks. This way, if someone managed to activate the action through a default link, they’d still be redirected… (I’m not sure if this would result in every single person being logged in to WP or other undesirable things, though… maybe try it out and see what happens? )

    hooks:

    add_action('wp_authenticate', 'authenticate_redirect',);
    	add_action('wp_logout', 'logout_redirect');
    	add_action('lost_password', 'disable_function');
    	add_action('retrieve_password', 'disable_function');
    	add_action('password_reset', 'disable_function');

    example function:

    function authenticate_redirect() {
    	wp_redirect("https://your-site/login-page");
    }

    I don’t know how you’d pass through the WP session id for the logout this way, but there might be some kind of wp_get_session_id function, so you could do something like:
    $sessid = wp_get_session_id();
    wp_redirect(“https://your-site/logout-page?session=$sessid”);

    Good luck, hope that helps some.

    Thread Starter meek2100

    (@meek2100)

    Thanks for all the help I ended up just leaving the logout part out so my logout will still work correctly. I went with:

    add_action('wp_authenticate', 'authenticate_redirect');
           add_action('lost_password', 'disable_function');
           add_action('retrieve_password', 'disable_function');
           add_action('password_reset', 'disable_function');
    function authenticate_redirect() {
           wp_redirect("https://darintheurer.com/login.html");
    }

    And then used the login/logout plugin and just edited the plugin file directly to get what I wanted. But thanks to the code above if any old users try to access the old login area (wp-login.php). They are redirected to my new login page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Login/Register Custom URLs , Need help!’ is closed to new replies.