Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-12-22 09:33:59

wii
Member
Registered: 2005-05-08
Posts: 77

Hide pages from non members?

My client needs a website with hidden section for non members, I have never done this before and I always use Textpattern, is there a way to have this functionality using Textpattern?

Thanks

Offline

#2 2010-12-22 09:44:18

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,000
Website GitHub

Re: Hide pages from non members?

You have a number of alternatives:

  1. Use txp:password_protect if you just want to hide a section behind a single password. Advantage: simple to setup. Disadvantage: single password for all members. If someone stops being a member, you need to change the password for everyone. Also it only works at an article level.
  2. Use ign_password_protect (possibly in combination with mem_self_register) to set up separate accounts and logins for each member. You can use a separate user database. Advantage: full-blown solution. Disadvantage: it can be a bit tricky to get set up.
  3. Use rvm_if_privileged for users who have an account for the backend. Disadvantage: no separate user database. Users have to log in via the backend. Advantage: rock solid!

See also this article for further explanations.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2010-12-22 09:45:29

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Hide pages from non members?

Hi,
probably rvm_privileged will help you.

edit. Jakob was faster

Last edited by redbot (2010-12-22 09:46:55)

Offline

#4 2010-12-22 10:23:12

wii
Member
Registered: 2005-05-08
Posts: 77

Re: Hide pages from non members?

Thanks, I will ask my client, I think the simple txp:password protect could be enough.

Offline

#5 2010-12-22 17:41:07

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Hide pages from non members?

jakob wrote:

Also it only works at an article level.

What exactly do you mean, Jakob? As far as I know you can use it inside if_section tags (or any conditionals for that matter) to password protect a specific part of a site.

Offline

#6 2010-12-22 22:49:38

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,000
Website GitHub

Re: Hide pages from non members?

Sorry, I didn’t word that very well. I was referring to what jeremy wrote in the article linked to above:

TXP provides the built-in tag <txp:password_protect /> and I wrote a more flexible variation … However, these tag-based solutions have some shortcomings when applied anywhere except directly in an article. From a practical perspective, this means that one cannot easily password protect an entire section merely by including a password protect tag in the page template.

There’s a note to similar effect on the tag description page (also linked above), but I must admit I’ve not tested out whether this is still valid for more recent txp versions.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2010-12-22 23:52:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Hide pages from non members?

Thanks Jakob, I wasn’t aware of that. Would a solution like this be too simple?

<txp:if_section name="section1">
   <txp:password_protect login="login" pass="pass" />
<txp:else />
   <txp:if_individual_article>
      <txp:if_article_section name="section1">
         <txp:password_protect login="login" pass="pass" />
      </txp:if_article_section>
   </txp:if_individual_article>
</txp:if_section>

Last edited by els (2010-12-22 23:52:53)

Offline

#8 2010-12-23 01:42:15

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: Hide pages from non members?

Wouldn’t it be better to implement ign_password_protect using just a single user_id?

At least it would make it easier to change a password if you needed to (eg. if the password escaped into the ‘wild’). And it would also make it easier to scale up to multiple users if required.

Offline

Board footer

Powered by FluxBB