Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • dwood726

    (@dwood726)

    Been looking for that one forever! Thanks PiggyGirl! That’s the ticket!

    dwood726

    (@dwood726)

    Michael,
    Thanks for the quick response!

    I believe that is the snippet that Eyephoto was using in his example above, but I can’t actually get it to redirect to the login page. I’m sure its syntax, but here is what I’m trying to insert (fro Eyephoto’s example above):

    <?php if ( is_page('45') && !$user_ID ) : ?>
      <p> You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to view this page. </p>
      <?php endif; ?>

    If I try to access the hidden page directly by the url, what I’m getting is the “hidden” page itself (the one I’m trying to redirect away from if the user is not logged in).

    should my redirect be something other than "<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>"

    dwood726

    (@dwood726)

    I am trying to add this code to my 2.7 installation. The first piece works perfectly, but I cannot get page.php to redirect to my login or registration page or return the “Need to be logged in” message. I would like a guest (anyone not logged in) to be taken directly to my registration page if they attempt to access a “hidden” page directly by url.

    Am I missing something (and keep in mind I am a coding idiot ?? and new to relatively WP.

    Thanks,

    David

Viewing 3 replies - 1 through 3 (of 3 total)