Looking for an easy way to trade a site tour or extended preview for email addresses and visitor loyalty? WordPress’ “membership” functionality offers an intriguing option.
Using this method, blog comments, content ratings and other interactive features can be restricted to registered and logged in users only. Likewise, blog post previews may be shown to all users, while those that login will see the full post. Depending upon the site’s billing and gateway environment, this may be a secondary access level requiring its own username and password, enabling tiered membership offers, among other strategies.
Blog comments, content ratings and other interactive features can be restricted to registered and logged in users only.
There are several ways in which a webmaster could approach this task, including by building upon WordPress’ native login system; altering your theme files to suit the task.
Start with wp_register(); (codex.wordpress.org/Function_Reference/wp_register). This call will display either a link to the site’s dashboard, or a “Register” link, depending upon whether or not the user is logged in, as long as the “Anyone can register” option is enabled in Administration - Settings - General - Membership.
The various Codex resources will guide you from there. Of course, you may want to hide your dashboard or other sensitive links from users with newfound access rights, but this is the gateway to allowing post commenting and unfettered preview content viewing.
For many site owners, employing one of the many plugins listed in the Codex that are made for this purpose will be the best bet.
Plugins such as Member Access (wordpress.org/extend/plugins/member-access/) allow administrators to require that users log in before viewing specified posts and pages. Likewise, Custom Post Type Privacy (wordpress.org/extend/plugins/custom-post-type-privacy/) is said by its publisher to allow registered users to be members of multiple groups.