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.
- Version: 1.0 beta 1
- Compatible with: WordPress 1.2
- Date: 23 January 2005
- Download: wp-gatekeeper-12.zip
DIY Installation
- 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.
- Put wp-gatekeeper-setup.php in your blog's root directory.
- Load wp-gatekeeper-setup.php into your Web browser and use it to set up the WP-Gatekeeper table(s).
- Place wp-gatekeeper.php into the plugins directory.
- In your administrative interface, activate the WP-Gatekeeper plugin.
- Place gatekeeper.php into the wp-admin directory.
- Replace wp-admin/menu.php with the new copy. If you've already modified it, then do the following instead:
- Find the "Gatekeeper" link creator in the new copy.
- 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.
- Save your modified menu.php.
- 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.
- Replace wp-comments.php with the new copy. If you have already modified it, then do the following instead:
- 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. - Save your modified wp-comments.php.
- Wherever you want the challenge to appear, place the following:
- Replace wp-comments-post.php with the new copy. If you have already modified it, then do the following instead:
- Find the
// WP-Gatekeeper challenge/response handling
comment in the new copy. - Copy the section of the code into your wp-comments-post.php right after the flood-protection section.
- Save your modified wp-comments-post.php.
- Find the
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
andhtml
. The former will cause empty elements to be returned with trailing slashes; the latter will leave off the trailing slashes. The default isxhtml
. stripslashes
(string)-
Accepts one of two values:
Y
andN
. IfY
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 isY
.
<?php run_gauntlet($key,$answer) ?>
This routine is only used in wp-comments-post.php
. Authors should never need to use it.