Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-05-24 21:42:09

molly
Member
From: Virginia
Registered: 2004-08-15
Posts: 44
Website

Update section when Posted=now

Anyone know of a plugin that does this? I have a site with daily posts. Posts dated in the future are available to paid members only, present and past posts, as well as other content, are publicly available. Because of the way the membership system works, I’m pretty sure the members-only content needs to be in a different section than the archives. Seems like the simplest way to do this would be to update the section for each article as it becomes current. But heck if I’m going to log on and switch it every day. Is there a plugin that does this? If not, can you write it? I will pay.

The site is (temporarily) at mollycliborne.com if you want to have a look.

Best,
Molly

Last edited by molly (2005-05-24 21:45:53)

Offline

#2 2005-05-27 01:12:51

molly
Member
From: Virginia
Registered: 2004-08-15
Posts: 44
Website

Re: Update section when Posted=now

(sound of crickets chirping)

What’s wrong? Why no answers? I only know enough about PHP and programming to be dangerous.. so will someone let me know if I’m asking for the impossible with the above? Please feel free to set me straight here. How complicated would it be to write a plugin that does what I want?

Last edited by molly (2005-05-27 01:56:13)

Offline

#3 2005-05-27 13:51:10

tranquillo
Archived Plugin Author
Registered: 2005-03-07
Posts: 127
Website

Re: Update section when Posted=now

Insert into /textpattern/publish.php after the include block (around line 33 in txp 1.0rc3) the following code:
<code>$time = time();
$change = safe_update(“textpattern”, “Section = ‘article’”, “Section LIKE ‘member’ AND Posted < FROM_UNIXTIME($time)”);</code>

Exchange “article” with your public section name and “member” with your member section name.
This updates your database everytime someone visits your website. If you prefer to do the update from your admin area, let me know, I’ll change it into an admin side plugin (perhaps with error messages and number of changes).

However, try it first in a safe environment.

Offline

#4 2005-05-27 15:30:20

molly
Member
From: Virginia
Registered: 2004-08-15
Posts: 44
Website

Re: Update section when Posted=now

That worked perfectly! Thank you.

Offline

Board footer

Powered by FluxBB