Webmastersite.net
Register Log In

Wish List

Comments on Wish List

babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Aug 30, 2007 - 10:47 AM:

Would it be possible to have a "Default Days to Expiration" applicable to just one particular link type?

I want to have a classifieds section whereby they are only available for so long, but no default timing on the rest of the site.


Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Aug 30, 2007 - 12:15 PM:

You could make a beforeaddition.php file in your plugins directory with this content:
<?php
function beforeaddition(&$object)
{
if ($object->objecttype == 'link' && !$object->expire && $object->type == 'thattype') $object->expire = time() + 86400 * 10;
}
?>

Where 10 is changed to desired number of days and thattype is the type.


Alternatively it can be done from the template side (as 4.0 requires): in the suggest link template, remove
<tr>
<td class="labelscolumn"><span class="labels">{LANG_SUGGESTLINK_EXPIRE}:</span><br>{LANG_SUGGESTLINK_EXPIREHELP}</td>
<td class="optionscolumn"><input type="text" size="5" name="expire" value="{LINKEXPIRE}" /></td>
</tr>
and then insert
<IF {LINKTYPE} is thattype><input type="hidden" name="expiredays" value="10" /></IF>
at the top or bottom where it's not restricted to administrators.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.