Need help with a2p link code, WILL PAY

matt3

Member
Jun 15, 2009
660
9
18
Instead of deleting expired auctions with a2p, I want it to remove the purchase link so the indexed pages can marinate a bit longer and just run contextual in the sidebar or something.

I asked on the zixby forum and radio suggested how to get it done (see below), I just don't know how.

Can anyone help with this please?

I searched around a bit, but didn't see anything related to better ways to keep user experience besides 404 pages on expired auctions.

Is there a way to just make links inactive on expired auctions, so you keep the content and utilize contextual?

Anyone have any thoughts on a different idea?
radio said:
you get the date saved as a custom field. use php to parse the date, do a quick check to see if past the date, if not show the link code, if past don't show it. you'll do this in the a2p template and need to install one of the active php plugins.
johnnyp said:
I came up with this:

Code:
<?php
$currentdate
= date("Y-m-d");
$expirationdate = date("Y-m-d", strtotime("[endTime]"));

$current_date = strtotime($currentdate);
$expiration_date = strtotime($expirationdate);

if (
$current_date > $expiration_date) {
echo
"http://www.somealternatelinkhere.com";
} else
echo
"[link]"; {
}
?>



Seems to work when I manually add auctions, but whenever I try to post via automation or cron, it doesn't work. (it shows gibberish like ?>">)

I used a few PHP plugins for wordpress (Exec PHP, PHP execution) but no avail.

Does anyone know how to execute the php properly via automation?
radio said:
consider adding it to the theme instead of the post - get the date by grabbing the custom field. adding posts via automation uses the same process in a2p - but for some reason wp treats it differently. that's why it works adding manually, but not via automation.
 


A fairly involved way to do it is run a weekly or daily cron job that queries the database for your auction date and does a find/replace for any egay links when the current date is 2 weeks (or whatever) after the auction date. You're going to have to get pretty deep into some shit to get at it though.