• Resolved islp

    (@islp)


    Hi.

    I have WP installed in the root of my website.
    In the same directory there’s a completely independent application.

    What I want to do is the following.

    When the user accesses the page containing the application:

    1. if he is in NOT logged into WP, the application must redirect him to the traditional wp-login page;
    2. if he IS logged into WP, he can use the application;

    Is there any way to get/read WP user data from an independent PHP page? If not, can you suggest different solutions to avoid users having to authenticate multiple times on the same website?

    Any help is appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    You can do this by checking user role default functionality of WordPress.

    After checking user role you can safely redirect them to your desired page.

    Use login redirect filter for redirection .

    Please have a look to this post.

    https://gist.github.com/wpscholar/4665879

    • This reply was modified 6 years, 6 months ago by Deepak Kumar.
    Thread Starter islp

    (@islp)

    There’s a little misunderstanding here: WP is completely separated from the app and the app has its own public address (so, anyone can navigate to this page, even when not logged in). The logic you’re suggesting should reside in the app.

    Yes, This is also possible.

    First you should have a separate login for your app.

    Then When some one login to wp then login them to app if they are user in your app.

    When wp session over then redirect to Login page.

    Thread Starter islp

    (@islp)

    I don’t want to have a separate login: that’s the problem. There must be only ONE login page (wp-login)

    @islp
    This is also possible dear.

    You have to include wp-load.php in your external script and use wordpress function to check user logged in or not.

    If user logged in then allow to access page else do redirect.

    Thread Starter islp

    (@islp)

    Ok, thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Use WP user status (logged_in) to manage access to independent application’ is closed to new replies.