Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-09-01 14:43:19

jonhicks
Member
From: Oxfordshire UK
Registered: 2004-03-22
Posts: 256
Website

EE style 'turn off site' function

One thing I’d love, which Expression Engine has, (and Symphony will do too) is the ability to ‘turn off your site’ so that only you can see it when you’re logged in to the admin section. It then puts up a holding page (which you can customize) while the site is ‘off’. This is great when you’re working on the site, esp. during upgrades etc.

Or has someone been able to to do this already?


Cheers,
Jon VC#9

Offline

#2 2005-09-01 15:40:47

Ray
Member
Registered: 2004-03-02
Posts: 154

Re: EE style 'turn off site' function

It’s ugly but it works to a certain extent.
I save the default page (txp interface) as default_orig then create a new default page that simply says back soon. The rest of the site is still there and people can access it IF they have the urls.

Not what you want (EE has some nice features) but it kinda does the trick… kinda.

Offline

#3 2005-09-01 15:42:50

jonhicks
Member
From: Oxfordshire UK
Registered: 2004-03-22
Posts: 256
Website

Re: EE style 'turn off site' function

That would do me if it only allowed me to see the rest of the site, but really I want to be able to turn off the whole site to anyone but me.


Cheers,
Jon VC#9

Offline

#4 2005-09-01 17:34:16

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: EE style 'turn off site' function

This would be a really simple if statement in publish.php—in pseudo-PHP it might look something like this:

<pre><code>
//If the site is closed AND the person requesting content isn’t already logged in to the admin-side,
//then deny them content.
if ($site_down && !$txp_user)
{ exit(echo(gTxt(“site_closed”)));
}
</code></pre>

Throw in a new row in txp_prefs, and it’s done. I’ll see if I can work up a patch.

-Kurt

Last edited by KurtRaschke (2005-09-01 17:37:27)


kurt@kurtraschke.com

Offline

#5 2005-09-01 17:36:13

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: EE style 'turn off site' function

Could easily be a plugin.

Offline

#6 2005-09-01 18:24:28

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

Re: EE style 'turn off site' function

The authentication cookie currently is only set for the /textpattern path. When you are viewing the public side, you are also “just a regular user”. A plugin could still be written to achieve this, by writing (and checking for) another cookie with path / (you wouldn’t need any authentication information in it, just some string to recognize the user).

Offline

#7 2005-09-01 19:10:41

jonhicks
Member
From: Oxfordshire UK
Registered: 2004-03-22
Posts: 256
Website

Re: EE style 'turn off site' function

Should this thread be moved to plugins do you think? If this is something achievable with plugins, maybe it should be in there, rather than feature requests?


Cheers,
Jon VC#9

Offline

#8 2005-09-01 19:18:00

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

Re: EE style 'turn off site' function

I think it’s a good feature request. It will probably some time before we get around to it, but I think it’s fine here.

If in the meantime someone decides to write a plugin for it (or if someone wants to make an explicit request) there is still the option of starting a new thread there.

Offline

#9 2005-09-01 19:35:40

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: EE style 'turn off site' function

> Sencer wrote:

> The authentication cookie currently is only set for the /textpattern path. When you are viewing the public side, you are also “just a regular user”. A plugin could still be written to achieve this, by writing (and checking for) another cookie with path / (you wouldn’t need any authentication information in it, just some string to recognize the user).

Good point; I hadn’t thought of that—I’m so used to writing admin-side code that I just assumed $txp_user would be available.


kurt@kurtraschke.com

Offline

#10 2005-09-01 22:38:16

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: EE style 'turn off site' function

One of the things I had in mind when I added the Production Status setting, was adding things like a Down For Maintenance mode.


Alex

Offline

#11 2005-09-02 00:41:56

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: EE style 'turn off site' function

> zem wrote:

> One of the things I had in mind when I added the Production Status setting, was adding things like a Down For Maintenance mode.

And what debug level would that set? I think they’re really two different settings—you may want to restrict the public side to logged-in users, but still keep error reporting off (like the ‘live’ level now), or you may want full debugging turned on.

-Kurt


kurt@kurtraschke.com

Offline

#12 2005-09-02 21:29:26

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: EE style 'turn off site' function

Don’t know if there’s any interest in this, but I’ve put together a patch which adds this functionality through a new preference option:

http://www.raschke.net/~kurt/software/textpattern/close_site.diff

It just adds a new cookie at the root level to identify logged in users and show them the site even if it’s closed.

Is there a formal process for patch submission?

-Kurt


kurt@kurtraschke.com

Offline

Board footer

Powered by FluxBB