• Resolved aleyvic

    (@aleyvic)


    Hi Kevin,
    I′m trying to configure the plugin but it is not working. It seems that I′m not following the correct steps. Currently the site is in maintenance mode (I deactivate it when I try the plugin).
    My site have a theme with it′s own login and register forms with its unique urls (https://satreks.com/login/ and https://satreks.com/register/).

    What are the steps that I need to follow to make it work? Shall I need to specify these urls?

    Thanks

    Ale

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Kevin Vess

    (@kevinvess)

    Hi– thanks for using Force Login!

    I believe I’ve answered your question on another post, check out these threads:

    https://www.ads-software.com/support/topic/custom-registration-page-6/

    https://www.ads-software.com/support/topic/custom-login-page-15/

    Thread Starter aleyvic

    (@aleyvic)

    Thanks Kevin. I will try.

    I have the “too many trial error” in Chrone. Is that because of the custom registration page or because itherbplugins getting conflict with forcelogin plugin?

    Thanks

    Ale

    Plugin Author Kevin Vess

    (@kevinvess)

    I think the “too many redirects” error is caused by your theme’s own login URL using an established WordPress login URL that redirects to the login page.

    I believe you need to create a unique URL for your custom login page or replace that WordPress function with your own to remove the redirect for that URL.

    Thread Starter aleyvic

    (@aleyvic)

    Hi Kevin,
    I used both alternatives and do not work. I changed the login url and also use the code you gave me. For this second alternative I have a question: Do I need to introduce anything within the code?

    Any suggestion?

    thanks

    Ale

    Thread Starter aleyvic

    (@aleyvic)

    Hi Kevin, I′m progressing with the configurations of the plugin in my theme. I need your help to finish it.
    When I try to log in, it redirects to login page and so on. It looks like this: https://satreks.com/login/?redirect_to=https://satreks.com/login

    I added to following code:

    // Custom Login URL
    function my_login_page( $login_url, $redirect ) {
    return site_url( ‘/login/?redirect_to=’ . $redirect );
    }
    add_filter( ‘login_url’, ‘my_login_page’, 10, 2 );

    // Custom Registration URL
    function my_registration_page( $register_url ) {
    return site_url( ‘/register/’, ‘login’ );
    }
    add_filter( ‘register_url’, ‘my_registration_page’, 10, 1 );

    /**
    * Filter Force Login to allow exceptions for specific URLs.
    *
    * @return array An array of URLs. Must be absolute.
    */
    function my_forcelogin_whitelist( $whitelist ) {
    $whitelist[] = site_url( ‘/’ );
    $whitelist[] = site_url( ‘/login/’ );
    $whitelist[] = site_url( ‘/register/’ );
    return $whitelist;
    }
    add_filter(‘v_forcelogin_whitelist’, ‘my_forcelogin_whitelist’, 10, 1);

    function custom_wp_redirect_admin_locations() {
    global $wp_rewrite;
    if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) )
    return;

    $admins = array(
    home_url( ‘wp-admin’, ‘relative’ ),
    home_url( ‘dashboard’, ‘relative’ ),
    home_url( ‘admin’, ‘relative’ ),
    site_url( ‘dashboard’, ‘relative’ ),
    site_url( ‘admin’, ‘relative’ ),
    );
    if ( in_array( untrailingslashit( $_SERVER[‘REQUEST_URI’] ), $admins ) ) {
    wp_redirect( admin_url() );
    exit;
    }

    $logins = array(
    home_url( ‘wp-login.php’, ‘relative’ )
    );
    if ( in_array( untrailingslashit( $_SERVER[‘REQUEST_URI’] ), $logins ) ) {
    wp_redirect( site_url( ‘wp-login.php’, ‘login’ ) );
    exit;
    }
    }

    function remove_default_login_redirect() {
    remove_action(‘template_redirect’, ‘wp_redirect_admin_locations’, 1000);
    add_action( ‘template_redirect’, ‘custom_wp_redirect_admin_locations’, 1000 );
    }

    add_action(‘init’,’remove_default_login_redirect’);

    Do you know What is missing?

    thanks

    Ale

    Plugin Author Kevin Vess

    (@kevinvess)

    If you disable Force Login, does your custom login url and registration url work?

    Must your custom login URL use /login/ as the URL? Could it be /my-account/ or /signin/ instead? Then you won’t need the code to replace the default WordPress admin redirects.

    Unfortunately, I won’t be able to help troubleshoot this issue in this forum–?I recommend you hire a web developer to help you diagnose, test, and fix this issue.

    Good luck; Thanks for using Force Login!

    Thread Starter aleyvic

    (@aleyvic)

    Kevin, Thanks for your respond. Just to complete the case I want to add an important info: My theme has a custom login and registration pages that override default WP login. They work fine when I deactivate the plugin. It also has “redirect after login” option where I have to choose the page to redirect to.

    I just having problems with the redirection that gets stuck in the login page. It allows me to login only in the form but not in the login page (/login/).

    Base on this, do you have any suggestion?

    regards

    Alejandro

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Steps to set specific Login & Register pages’ is closed to new replies.