PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Capture Lead Info, Allow to Bypass Next Time, No Access to Dashboard

  1. noxbane

    I have the skills necessary to work with PHP and hooks and such. I just need a basic breakdown of the logic/implementation required to do this:

    So I make real estate websites and this is a common request. Some useful information (buying tips, selling tips, etc) is available to the user only after they submit their contact info. (Yes, I know its not good practice, but some people insist).

    I DON'T want people to actually register with Wordpress itself, or at least I dont want them to have access to a dashboard, nor do they have a profile to edit. They simply enter their contact info, and then they can see the information they want.

    If they come back a few days later, they should be able to enter their email or password or both (it doesnt matter, whichever is easiest) and then view the content without submitting info again.

    Also, if there are five protected articles, they only have to register for one, not all five.

    Whats the basic logic for this setup? Thank you very much in advance for any assistance.

    Posted 7 years ago on Tuesday October 11, 2011 | Permalink
  2. Hi Noxbane,

    It sounds like signing them up as users is still the most ideal way to tackle this. If you'd like to prevent them from ever visiting any admin screens, just set up some simple redirect logic along the lines of:


    This way you can still use standard WordPress functions to handle the user logging in to access content and you could use the User Registration Add-on to handle registering the new users.

    Does that help?

    Posted 7 years ago on Tuesday October 11, 2011 | Permalink
  3. noxbane

    Hi David,

    Thanks for your reply. Do you have any advice on how to make the registration form appear for certain pages? There's only a handful of pages that will be protected. But where or how do I mark these specific pages as protected so that when a user goes to the URL, they are presented with the registration form?

    Posted 7 years ago on Tuesday October 18, 2011 | Permalink
  4. noxbane

    Bumping this thread to see if there is an answer to my followup question.

    Posted 7 years ago on Monday October 24, 2011 | Permalink
  5. I would use a page template, call it "Logged In" or something, then use that template on the pages for which you must be logged in to view. Then, put this at the top of the page template:

    Template Name: Must log in
    if(!is_user_logged_in()) {
        $siteurl = get_bloginfo('url');
        $request = $_SERVER['REQUEST_URI'];
        $redirect = urlencode($request);
        header("Location: $siteurl/wp-login.php?redirect_to=$redirect");
    // continue with rest of page template
    // maybe starting with get_header();

    There's probably room in there for a 301 or 302 header, but this code has worked for me in the past. If the user is not logged in, they will be redirected to the wp-login.php page, with the additional benefit of being redirected to the original page AFTER they log in.

    Let me know if that works for you.

    Posted 7 years ago on Tuesday October 25, 2011 | Permalink
  6. noxbane

    Thanks Chris. I think that definitely gives me the logic of what I need, if not the exact code.

    Posted 7 years ago on Tuesday October 25, 2011 | Permalink