• Resolved lesfeescolorees

    (@lesfeescolorees)


    Bonjour,
    Je cherche à ne pas restreindre des pages pour la page mot de passe perdu.
    Cependant, wordpress envoi à l’utilisateur un lien unique contenant une clé (exemple : https://mywebsite.com/account/lost-password/?key=ywXzbCh59GJk6TDHb8jT&id=4916)

    J’ai ce code dans le functions.php du thème :
    add_filter( ‘restricted_site_access_is_restricted’, function( $is_restricted, $wp ) {
    $actual_link = (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] === ‘on’ ? “https” : “http”) . “://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
    if( $actual_link == site_url().’/’ ) {
    return false;
    } elseif ( $actual_link == site_url().’/account/lost-password/’ ){
    return false;
    return $is_restricted;
    }, 10, 2 );

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Darin Kotter

    (@dkotter)

    @lesfeescolorees It looks like you have a custom page for your recover password functionality (and not the default WordPress URL of wp-login.php?action=lostpassword).

    This may help you: https://github.com/10up/restricted-site-access/issues/87#issuecomment-502199119

    This user had the same issue and that is the code they used to get this to work.

    Thread Starter lesfeescolorees

    (@lesfeescolorees)

    I tried that but it doesn’t work, I must be making a mistake somewhere…

    add_filter( ‘restricted_site_access_is_restricted’, function( $is_restricted, $wp ) {
    $actual_link = (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] === ‘on’ ? “https” : “http”) . “://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
    if( $actual_link == site_url().’/’ ) {
    return false;
    } elseif ( $actual_link == site_url().’/sidentifier/’ ){
    return false;
    } elseif ( $actual_link == site_url().’/mon-compte/mot-passe-perdu/’ ){
    return false;
    } elseif ( wp_doing_ajax() ){
    return false;
    }
    return $is_restricted;
    }, 10, 2 );

    add_filter( ‘restricted_site_access_is_restricted’, ‘my_restricted_check’ );
    function my_restricted_check( $is_restricted ) {
    global $wp;
    if (
    $wp->query_vars[site_url().’/mon-compte/mot-passe-perdu/’] == ‘recover’
    )
    $is_restricted = false;
    return $is_restricted;
    }

    Here is the link sent by wordpress :
    https://eurobijoux.fr/mon-compte/mot-passe-perdu/?key=4JA8f9Q23p6QHjOsxa7R&id=4916

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Do not restrict for keys’ is closed to new replies.