Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-11-05 11:48:00

nighthawk
Archived Plugin Author
From: Frankfurt, Germany
Registered: 2005-11-05
Posts: 87
Website

Creating a public and a private section on a textpattern-powered site

Hi,

I’m just setting up my first site powered by textpattern, and I love the concept and handling of it. However… I’m not in for the simple stuff. :)

What I want to do is this: I need to create a site which consists of an external part (publicly available to anyone) and an internal (private) part which requires a login (not htaccess-driven!) to access the content therein. Like a portal site with a members area, for example.

Now, I don’t have a problem coding all the PHP functions required for the login part. But how do I “hide” the content of the internal part unless someone logs in?

I’m afraid I’ll have to use two textpattern installations and hack them to share content, CSS and menus, but I’d rather find out if someone has tackled this problem already. Any hint you could give me is greatly appreciated.

Thanks & laters,

- Björn

Offline

#2 2005-11-05 13:18:11

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Creating a public and a private section on a textpattern-powered site

Now, I don’t have a problem coding all the PHP functions required for the login part. But how do I “hide” the content of the internal part unless someone logs in?

You will need to take a look inside Textpattern to understand how it works. There is a password-protect tag which takes fixed user/pass combination. You can probably build something similar, but query an external user/pass database.

My advice is to also get familiar with coding plugins, because if you encapsulate your modifications inside plugins (which is easily possible for your requirements) you’ll be able to upgrade within the 4.0.x branch easily.

Offline

#3 2005-11-06 11:15:18

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

Re: Creating a public and a private section on a textpattern-powered site

I’m using the Plugin ign_password_protect
You might use a section which you protect, so the content cannot be seen publicly.

Offline

#4 2005-11-06 13:11:35

nighthawk
Archived Plugin Author
From: Frankfurt, Germany
Registered: 2005-11-05
Posts: 87
Website

Re: Creating a public and a private section on a textpattern-powered site

The-Exit: As I mentioned, this is not an option - a simple password protection is not what I'm looking for. Thanks, anyway. :) Sencer: Thanks for your advice, too, but… this doesn’t help, either.

However, this problem seems solvable. I did a little programming yesterday, and this is the approach which seems to work:
  • Install 2 instances of TXP – one will be “public” (master), the other “private” (mirror)
  • Hack txplib_db.php to automatically execute inserts/updates/deletes on the mirror db (done that, works fine)
  • Write a plug-in that displays a login box (done that, too) and uses and external php script to authenticate users.
  • When a user has been authenticated successfully, forward him to the “private” area and save authentication flag in the PHP session.
  • Still to do: Write a plugin that gets included on all TXP pages to check if the authentication flag is present in the session. I have verified that it’s possible, but it was quick and dirty, so I’ll do it again.

If anyone’s interested in how the project progresses and looks like later, please let me know – otherwise I’ll better spare you with the boring details in this forum. ;)

Thanks for your help!
Cheers,

- Björn

Last edited by nighthawk (2005-11-06 13:13:08)

Offline

#5 2005-11-06 14:25:02

RussLipton
Member
From: Spokane, WA
Registered: 2005-02-17
Posts: 36

Re: Creating a public and a private section on a textpattern-powered site

This would be a wonderful plug-in to share with the entire community ….

Offline

#6 2005-11-09 23:01:42

nighthawk
Archived Plugin Author
From: Frankfurt, Germany
Registered: 2005-11-05
Posts: 87
Website

Re: Creating a public and a private section on a textpattern-powered site

It seems like the task is easier than I thought. I discovered that two linked db’s aren’t needed – with the right plugin, an additional section will suffice.
This means that the modification can be done just through plugins – no hacks needed. :) As soon as I’ve run a few tests, I’ll post a link to the plugins here. More exciting stuff to come. :)

Offline

#7 2005-11-09 23:16:54

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Creating a public and a private section on a textpattern-powered site

That’s what I was trying to communicate above. Take an existing function, put it inside a plugin, and change the authentication procedure. :)

Offline

#8 2005-12-23 21:00:39

marknumberm
Member
From: Minneapolis
Registered: 2005-11-29
Posts: 46

Re: Creating a public and a private section on a textpattern-powered site

I wonder if this plugin was ever completed. I’d be very interested in using it.

Offline

#9 2005-12-24 12:25:36

nighthawk
Archived Plugin Author
From: Frankfurt, Germany
Registered: 2005-11-05
Posts: 87
Website

Re: Creating a public and a private section on a textpattern-powered site

Yeah, it’s stll in the works, but I’ve been focusing in the wow_menu plugin as the public/private thingie seems to be easier than I thought. I hope to come up with some news before this year is out. :) Stay tuned!

Offline

#10 2006-01-11 16:42:34

ganges
New Member
Registered: 2005-12-24
Posts: 2

Re: Creating a public and a private section on a textpattern-powered site

Hm, Sessions…. I am find this googling “txp+php+sessions”
I have a site with private (login/password in db storage) and public area and a weblog in public (TXP)
My trouble – when trying to visit weblog from private area i loose all sessions data :( All of it

Any help, please? Any thinks are huge welcome.
Thanx

Offline

Board footer

Powered by FluxBB