Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author thomstark

    (@thomstark)

    You can just use a standard JavaScript redirect inside an eyesonly shortcode, like so:

    [eyesonly logged="out"]
    <script>
    window.location = "https://www.yoururl.com";
    </script>
    [/eyesonly]

    Or you could show a message and redirect after a certain number of milliseconds, like so:

    [eyesonly logged="out"]You need to be logged in to view this. You will be redirected to the login page in 5 seconds.
    
    <script>
    setTimeout("location.href = 'https://www.yoursite.com';",5000);
    </script>
    [/eyesonly]

    I’m trying to prevent access to the page to users who are not logged in. This code (below) seems to do that, but rather than leaving them on a blank page I want to redirect them to the login/register page. My attempts to implement the above code suggestions have not worked.

    How can this be done?

    [eyesonly logged=”in”]

    Search
    Search our directory below:

    [ADVANCEDSEARCH home=yes]

    [/eyesonly]

    Plugin Author thomstark

    (@thomstark)

    Did you type the above code in the visual or the text editor?

    Plugin Author thomstark

    (@thomstark)

    [eyesonly logged="out"]
    <script>
    window.location = "https://www.yoururl.com/wp-login.php";
    </script>
    [/eyesonly]

    This needs to go in your Text Editor, not the Visual Editor.

    Surprised I missed that. Thanks.

    Unfortunately, now it redirects me logged in or not.
    Here’s how the page is coded (mydomain has the actual domain):
    [eyesonly logged=”out”]
    <script>
    window.location = “https://mydomain/wp-login.php&#8221;;
    </script>
    [/eyesonly]
     
    <h3><span style=”color: #0000ff;”>Search</span></h3>
    Search our directory?below:
    <div class=”row”>[ADVANCEDSEARCH home=yes]</div>
    <div class=”row”></div>
    <div class=”row”></div>
    <div class=”row”></div>
    <div class=”row”></div>
    <div class=”row”></div>
    <div class=”row”></div>
    <h3 class=”row”></h3>
    <div class=”row”></div>

    Plugin Author thomstark

    (@thomstark)

    Do you have administrator override enabled in your settings?

    Not sure. Where can I find that and what should it be?

    Plugin Author thomstark

    (@thomstark)

    Settings > Eyes Only Options

    Not checked.

    That did it!
    Thanks!!

    Plugin Author thomstark

    (@thomstark)

    Good deal. No problema.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘redirect to login’ is closed to new replies.