Support » Fixing WordPress » Best way to add in a custom php page to wordpress?

  • Hi Guys,

    I am creating a booking system using wordpress.

    So once the user has completed the form it submits the data to the database and then I have built a custom php page to show the user their details – retrieved from the database. I just need to know how to integrate this into a wordpress page? Is there a way so I can make it only registered (signed in) users can view this page – how would I go about doing this?

Viewing 1 replies (of 1 total)
  • I’m assuming you have your own database for users, and people can register specifically for your site. If so did you make this?

    You can set a $_SESSION variable when a user successfully logs in such as $_SESSION[‘user_auth’]. When the user logs in set this to one, when the session ends (browser closes) or they logout (depending how the logout function is setup you may have to unset user_auth on log out.

    Then you set that page to only allow visitors if the $_SESSION[‘user_auth’] variable is set to one.

    if ($_SESSION['user_auth'] == 1){
        execute your custom page (wrap this if statement around your entire code)
    else {
        redirect to login page
Viewing 1 replies (of 1 total)
  • The topic ‘Best way to add in a custom php page to wordpress?’ is closed to new replies.