Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-09 17:38:43

arkham
Member
Registered: 2005-03-27
Posts: 102
Website

How do I expire file download links based on date?

I assume I’ll be using PHP for this one. I want my file downloads to show as expired and no longer be active links after the article they’re associated with are a month old.

Offline

#2 2006-01-09 21:35:54

arkham
Member
Registered: 2005-03-27
Posts: 102
Website

Re: How do I expire file download links based on date?

anyone? or even some instruction as to how to access the date posted of an article via php so i can do some comparing….

Offline

#3 2006-01-10 08:06:40

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: How do I expire file download links based on date?

Select id and posting time of articles posted after a certain date:

$mydate = [...];
$rs = safe_row ('id','textpattern', 'posted >' . doSlash($mydate) );

or

$mydate = [...];
$rs = safe_rows_start ('id, posted','textpattern', ' posted >' . doSlash($mydate) ;
if ($rs) {
 while ($r = nextRow($rs)) {
[...]

See lib/txp_db.php for other db related stuff.

hth,
Robert

Last edited by wet (2006-01-10 08:07:26)

Offline

#4 2006-01-10 08:58:09

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: How do I expire file download links based on date?

would be interested in this one, arkham, for an mp3 blog … I assume you’re using upm_file_packets to associate files with an article?

Offline

#5 2006-01-11 05:42:40

arkham
Member
Registered: 2005-03-27
Posts: 102
Website

Re: How do I expire file download links based on date?

Hey wet, thanks for the suggestions. Nardo, yes I’m using upm_file_packets

I found a plugin that for some reason I don’t think ever made it to the plugin forum which can handle this situation. You’ll probably find it useful for your mp3’s. I just got it working perfectly for my needs.

http://forum.textpattern.com/viewtopic.php?id=12087

In that thread is a textfile for the plugin ras_if_expired. It takes a parameter for number of days.

You can put this in an article form but since I wanted to show the names of the expired MP3’s i put it right in my files form and this worked perfectly:

<code>
<txp:ras_if_expired offset=“30”>
<txp:file_download_description /> (Link Expired)
<br />
<txp:else />
<a href=“http://www.ohword.com.nyud.net:8090/files/<txp:file_download_name />”><txp:file_download_description /></a> [<txp:file_download_size format=“auto” decimals=“2” />]
<br />
</txp:ras_if_expired>
</code>

Last edited by arkham (2006-01-11 05:43:19)

Offline

#6 2006-01-11 06:04:33

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: How do I expire file download links based on date?

good one

Offline

Board footer

Powered by FluxBB