meyerweb.com

Skip to: site navigation/presentation
Skip to: Thoughts From Eric

WordPress Tools: WP-Gatekeeper [beta]

This package is not yet completely finished! It does work as advertised, and can be deployed as-is, but will likely see some improvements and optimizations in the future. It is currently being provided for the primary purpose of allowing more experienced PHP (and WordPress) hackers to examine the code, optimize and modularize it, and hopefully make it easier to install.

This version of WP-Gatekeeper was developed in WP 1.2, and no compatibility information is available for other versions. There is a much easier-to-use version available for WordPress 1.5. In either case, use at your own risk.

DIY Installation

  1. Back up your WP files! There's nothing here that should cause major problems, but if you have trouble or decide you want to back out WP-Gatekeeper, you'll want your original files.
  2. Put wp-gatekeeper-setup.php in your blog's root directory.
  3. Load wp-gatekeeper-setup.php into your Web browser and use it to set up the WP-Gatekeeper table(s).
  4. Place wp-gatekeeper.php into the plugins directory.
  5. In your administrative interface, activate the WP-Gatekeeper plugin.
  6. Place gatekeeper.php into the wp-admin directory.
  7. Replace wp-admin/menu.php with the new copy. If you've already modified it, then do the following instead:
    1. Find the "Gatekeeper" link creator in the new copy.
    2. Copy it into your menu.php wherever you want it to appear in the administrative menu. You can also alter the minimum user level, if you like.
    3. Save your modified menu.php.
  8. In the administrative interface, open up the "Gatekeeper" page. Either activate the default challenge, or input some of your own (recommended). Be sure to do this before you go any further! Once you complete the rest of the installation, there needs to be at least one activated challenge. If there isn't, then nobody will be able to post any comments.
  9. Replace wp-comments.php with the new copy. If you have already modified it, then do the following instead:
    1. Wherever you want the challenge to appear, place the following: <?php pose_challenge() ?>. This will return a challenge question, an input field, and a hidden "key" field. See the Functional Reference, below, for more details and options.
    2. Save your modified wp-comments.php.
  10. Replace wp-comments-post.php with the new copy. If you have already modified it, then do the following instead:
    1. Find the // WP-Gatekeeper challenge/response handling comment in the new copy.
    2. Copy the section of the code into your wp-comments-post.php right after the flood-protection section.
    3. Save your modified wp-comments-post.php.

That's all.

Functional Reference

<?php pose_challenge('format', 'doctype', 'stripslashes') ?>
format (string)
Format string for the link. Markup can be included in the format string, and will be returned unaltered. Defaults to field label key.
doctype (string)
Accepts one of two values: xhtml and html. The former will cause empty elements to be returned with trailing slashes; the latter will leave off the trailing slashes. The default is xhtml.
stripslashes (string)
Accepts one of two values: Y and N. If Y is passed, then the result will have escape-slashes stripped from any displayed text. N will leave the slashes in place, which is useful if the result will be placed within JavaScript. The default is Y.
<?php run_gauntlet($key,$answer) ?>

This routine is only used in wp-comments-post.php. Authors should never need to use it.

Identity Archipelago

Projects Elsewhere

Redesign Watch

archive

Extras