Password Module for Expression Engine?

ぐ巨炮叔叔 提交于 2019-12-01 14:40:15

There are several ways to password-protect pages in an ExpressionEngine site:

  • Template Preferences Manager
  • Conditional Global Variables
  • Third-Party Add-Ons

By far the easiest solution is to use the built-in Template Preferences Manager in the ExpressionEngine Control Panel.

1). Using the Template Access Restrictions feature, you can restrict an entire page/template to one or more defined groups (Banned, Guests, Members, Pending and Custom Groups).

When a restricted page is accessed, you can configure what should happen:

  • Show a Specific Template (e.g. a Login or Error Page)
  • Enable HTTP Authentication

2). If you need to conditionally show part of a page to a specific member or group, you can use Conditional Global Variables.

Conditional Variables are pair type variables, which allow you to conditionally show or hide information on your pages based on criteria being met. For example, a basic conditional variable will look like this:

{if username == "joe"}
    Hi Joe!
{/if}

More advanced conditionals can use logical operators (ex: OR, AND) to compare multiple variables to multiple values. Consider this example:

{if username == "joe" OR username == "bob"}
    Hey, Guys!
{/if}

There are many Global Conditionals you can use. See the Global Variables section of the ExpressionEngine User Guide for more information.

3). Finally, if you need more advanced or granular control for password-protecting content in ExpressionEngine, a Third-Party Add-On may give you what you need.

One such popular add-on is the Solspace User Module. It gives you a robust set of front-end member management tools and adds flexibility to the way your member management behaves.

Using other third-party add-ons, you can password protect files, certain channel entries for certain members or member groups and more! All of this is possible due to the ExpressionEngine Developer API.

You can leverage any number of the third-party Developer Add-Ons at Devot-ee -- the official community partner devoted to ExpressionEngine Add-Ons.

Any content in EE can be wrapped in a conditional statement using the logged_in_group_id global variable, so a module isn't really needed.

So you can have your users fill out a member registration form (I'd recommend the Solspace User module for this), setup to register them into your chosen member group.

Then, wrap your members-only content like this (use the appropriate ID for your member group):

{if logged_in_group_id == 6}
    Members-only content here.
{/if}

Alternately, you could use something like this: http://devot-ee.com/add-ons/entry-access/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!