Redirect WP login to xenForo

Discussion in '[bd] API' started by John Stone, Apr 28, 2016.

  1. John Stone

    John Stone New Member

    Everything seems to be working really well, great plugin!

    One issue. How do I change the links to "Login to Reply or Rate" under WP posts to point to xenForo?

    I've got code in functions.php to redirect from WP to xF for lost password and registration, for example:

    Code:
    // Redirect to forum registration system
    add_action('init','registration_redirect');
    function registration_redirect(){
    global $pagenow;
        if( 'wp-login.php' == $pagenow && $_GET['action'] == 'register') {
            wp_redirect('http://forums.johnstonefitness.com/register/');
      exit();
    }
    }
    But I'm not sure how to do this for logins.

    Also, is there anyway to redirect the user back to the post they were looking at once they login on xF from a WP link?

    Thanks!
     
  2. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    For that you may need to customize your template and/or change some action/filter to output the link correctly.
    For redirection, that probably won't work because XenForo only redirect to one of its page...
     
  3. John Stone

    John Stone New Member

    I got it working like this. Figured I post it in case anyone else is trying to do this.

    Code:
    add_filter( 'login_url', 'my_login_url' );
    function my_login_url( $url ) {
        return 'http://forums.johnstonefitness.com/login/';
    }
    Like you said, I don't think it's possible to automatically redirect back to the Wordpress site after logging in on xF, but if anyone knows a way please let me know.
     
    xfrocks likes this.
Loading...