Loading a different page, based on an answer to a question..?

[ad_1]

I am just wondering if there’s a plugin out there that does anything like this. Have had no joy so far.

1. Site admin creates a list of secret words, each one associated with a hidden page.
2. Site user clicks on an “access hidden content” page and is prompted to enter a secret word.
3. If the entered word matches a word on the list, its associated hidden page will be displayed to them.

There are lots of simple “password-protect” plugins, but I haven’t found one with the ability to load a different page depending on what password is entered.

There are also some very fully-featured site membership plugins which could probably be twisted into doing something like this but seem like overkill.

All suggestions very gratefully received.

[ad_2]
1 Comment
  1. The right solution would be a php function linked to a simple text-entry. Store the secret words in the database, optional to store as pairs with id/url of target page. Then something like:

    `<div>`
    `<form name=”secretThings” method=”post” action=”/wp-admin/admin-post.php”>`
    `<input type=”hidden” name=”action” value=”my_funtion_name” class=”form-control”/>`
    `<input type=”text” placeholder=”password” id=”pw_check” name=”pw_check”>`
    `<input type=”submit” name=”sendSecret” class=”form-control”>`
    `</form>`
    `</div>`
    `function check_secret_thing() {`
    `$pw_entered = $_POST[‘pw_check’]; // get the word they entered`
    `// get the array from e.g. wp_options and check if their word is in it, if so go to X page`
    `}`
    `add_action( ‘admin_post_my_funtion_name’, ‘check_secret_thing’ );`

    This form lets you submit one word, which is passed to the function.

    A slight hack would be to have a redirect plugin… simply add a template redirect in the above function:

    wp_safe_redirect(‘/’ . $pw_entered . ‘/’);

    And a redirect plugin to send each request to the right page – any ‘invalid’ entries – the redirect can send all of them to a ‘nope – wrong password’ page or whatever.

    But if this is too much, you can get a form plugin which allows conditional notifications. Then a LOT of ‘if form entry X = “thisWord” redirect to page Y’

    Gravity / fluent forms / ninja / wpforms / formidable can do this, but you need a paid version. I don’t think you’ll get it free – or in a plugin.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer