Support » Fixing WordPress » Restrict access to logged in users?

  • I want to be able to tie in the WordPress database with my own site database, so that logged in users are able to access additional pages or categories, in addition to the regular pages and categories that non-authenticated users can still access.

    Is this possible?

    Also, is there a guide somewhere that can explain how to integrate my site (custom PHP codebase) with WordPress, so that WordPress authenticates solely with my system?


Viewing 2 replies - 1 through 2 (of 2 total)
  • I found a plugin the other day that allows you to use an external means to authenticate users within WordPress: This might be what you’re looking for if you can get your external site to work with it properly.

    Restricting pages within WordPress to registered, signed-in users is actually quite simple.

    1. Create a new page template (by copying page.php, renaming it, and uploading it back to the server).
    2. Add the following to the top part of the page template:
    3. Find the line “<div class=”post-content”><?php the_content() ;?></div>” and change it to:
    4. <div class="post-content">
      <?php global $user_ID;
      <?php if($user_ID) {
            } else {
            echo '<p style="font-size: 36px;"><center><a href="' . get_settings('home') . '/wp-login.php?action=register">Please Register!</a></center></p>';
            echo '<p style="font-size: 11px; font-family: Arial, Helvetica, sans-serif;">You must be a registered user to view this page.</p>';

    This script checks to see if the user is logged in. If they are, then the page will display normally. If not, then they’ll see a message asking them to register.

    I found a module that does exactly what I want.

    I tell it what database, table and fields to look for when authenticating, then WordPress takes care of the rest for me. No more fussing, no fancy editing of anything.

    Thanks for the suggestion! It got me searching in the right direction 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Restrict access to logged in users?’ is closed to new replies.