WordPress.org

Forums

WP-Members
[resolved] Login Page Redirect (4 posts)

  1. pastoradeola
    Member
    Posted 2 years ago #

    Please I need help redirecting my login page in Wp-members. My website is http://www.christembassyarlington.org. I have a link for people to click to watch live church service but I want them to login or register first before being able to do so and then redirected to the live-service page after login is successful.
    Thanks

    http://wordpress.org/extend/plugins/wp-members/

  2. pastoradeola
    Member
    Posted 2 years ago #

    I was able to resolve the issue from Chad's previous post using,

    add_filter( 'wpmem_login_redirect', 'my_login_redirect' );

    function my_login_redirect()
    {
    // return the url that the login should redirect to
    return 'http://yourdomain.com/your-page';
    }

    But now I want the link
    'http://christembassyarlington.org/login/'
    always redirected to
    'http://christembassyarlington.org/live-service/'
    when a member is already logged in.
    Thanks

  3. Chad Butler
    Member
    Plugin Author

    Posted 2 years ago #

    You could use a combination of is_page('login') and is_user_logged_in. If both return true, redirect.

    if( is_page( 'login' ) && is_user_logged_in() ) {
      wp_redirect( 'http://christembassyarlington.org/live-service/' );
      exit();
    }

    You could work that in in a number of ways; the easiest probably being directly in the page template. But with redirection being part of that process, you should probably put it into a hook that occurs before headers are sent, such as 'init'

  4. pastoradeola
    Member
    Posted 2 years ago #

    Wow.....Thanks man. Worked like a charm. I appreciate it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Members
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags