WordPress.org

Ready to get started?Download WordPress

Forums

Password protected category (5 posts)

  1. moshu
    Member
    Posted 8 years ago #

    I've found some older posts and requests
    http://wordpress.org/support/search.php?q=password+protected+categories
    but I couldn't figure out how to make it work.
    Basically what I'd need:
    - a category that can be accessed only with pw
    - if a single post from this category is accessed directly the visitor would be sent back/redirected to the pw input page for the cat

    Is it possible at all?

  2. Joshua Sigar
    Member
    Posted 8 years ago #

    It certainly is possible, though it entails a lot work.

    A plugin will have to maintain table as follows.

    cat_id | password
    ----------------------
    1 | lkjakne
    2 | opi23kn

    The plugin has to provide an interface in admin panel to allow admin to maintain the table above.

    The plugin then registers the following set of procedures to template_redirect hook
    1. Check if current page is Category page or Singe Post page.
    2. If condition 1 is true, check the table if password is assigned for current Post's category (Single Post page) or active category (Category page).
    3. If condition 2 is true, check cookies if password is not previously entered.
    4. If condition 3 is true, redirect the page to password form.
    5. Once valid password is entered, record that to cookies and redirect to previous page (Single Post or Category page).

  3. moshu
    Member
    Posted 8 years ago #

    Thank you! At least I know it's possible which is great. Now I just have to wait until a PHP guru writes a plugin like that :)

  4. moshu
    Member
    Posted 8 years ago #

    Update. Actually the request is modified: the category page listings the excerpts should be freely available, only the full view of the posts in that category should be password protected.
    Does that make it easier?

  5. Illys
    Member
    Posted 7 years ago #

    Publically viewable and accessable category, but password-required, and with cookie generation to remember the user's password submission. A customizeable failure message, and a text field on the category page to describe the contents of the category and requirements for access. (email form/comment requesting password).

    Much appreciated, and much needed for family homepages and other such materials!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags