Support » Plugins » Hacks » password protect site until url variables passed?

  • Hi, is it possible to do the following?

    1. the site is locked until a url with variables is passed to it.

    2. inside the url variables, it should have new userdata (so wordpress will register the user and the user will not need to login again).

    e.g URL to pass:

    wordpress would then automatically input the data and show the site.

    really hope someone can help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    Yes! There’s even different ways to go about this. One is to create a special page template that basically does all this and redirects to the actual content if the user is logged in. Add a page based on this template. Then use the Rewrite API to send all requests to this page.

    thanks, great to know this is possible, can you supply any help on how to do this?
    Im ok at theme creation but i think i may need to help with this integration.

    Moderator bcworkz


    Just go ahead and dive in! Work in small attainable segments, ensuring each works properly before building on that. If you get stuck somewhere, someone here should be able to help you out.

    Perhaps start with a simple custom page template that just redirects to the home page. Then add a rewrite rule to your theme’s functions.php (or .htaccess if you prefer) that sends any requests with username etc. parameters to a page based on this template.

    The next step is ensure the template can correctly get the URL parameters from $_GET. Then assemble a user data array from these values. The last step is to pass this array to wp_insert_user() and you should be in business.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘password protect site until url variables passed?’ is closed to new replies.