Results 1 to 6 of 6

Thread: Expiration Notification

  1. #1
    Join Date
    Nov 2004
    Posts
    14

    Default Expiration Notification

    I think I have seen some folks talk about it but I havent seen anything besides a cron job.

    Can we get a button on the admin page that you can hit to check the DB for upcoming expirations that then sends an email to the agent that has the listing that is getting ready to expire?

    It take more of an effort than running a cron job but seems easier to do as a Mod.

  2. #2
    Join Date
    Feb 2003
    Posts
    237

    Default

    Simply take the code from the CRON script, and execute it when the button is clicked.

    FL


    Quote Originally Posted by hightide13
    I think I have seen some folks talk about it but I havent seen anything besides a cron job.

    Can we get a button on the admin page that you can hit to check the DB for upcoming expirations that then sends an email to the agent that has the listing that is getting ready to expire?

    It take more of an effort than running a cron job but seems easier to do as a Mod.

  3. #3
    Join Date
    Nov 2004
    Posts
    14

    Default

    Well Lizard I think my problem is that there isnt a script to send an email to the agent to let them know that their listing is about to expire, be it for a Cron Job or not.

    Any chance anyone has worked on this issue? It has come up a few time on the forum with no responses.

  4. #4
    Join Date
    Jan 2003
    Posts
    201

    Default

    I have a script that I created that I'm no longer using that I'll be glad to share. Only issue is that I'm not using Ryan's version of OR, so some things may need to be modified. I'll post it here when I have time.

  5. #5
    Join Date
    Feb 2003
    Posts
    237

    Default

    Same situation as Andre .. I have it as CRON (to email agent/lister & tranfer listings etc), but it isn't for Ryan's/ORO, although it could be massaged to work.
    If you can't find anything and want to give it a go, let me know and I'll send it to you etc.

    Cheers,

    FL


    Quote Originally Posted by hightide13
    Well Lizard I think my problem is that there isnt a script to send an email to the agent to let them know that their listing is about to expire, be it for a Cron Job or not.

    Any chance anyone has worked on this issue? It has come up a few time on the forum with no responses.

  6. #6
    Join Date
    Jan 2003
    Posts
    201

    Default

    Here's the code I was using. It is set up to send emails at 10 and 5 and 1 days from expiration. Again, I'm not using Ryans version so you may have to modifiy it.
    Code:
    function listings_expiration() {  //email sellers about listings expiring
    global $conn, $lang, $config, $style;
    $sql="SELECT user_ID,a.ID,emailAddress,expiration,
    TO_DAYS(expiration)-TO_DAYS(NOW()) as Days 
    FROM listingsDB a, UserDB b  
    where (TO_DAYS(expiration)-TO_DAYS(NOW())=10 or TO_DAYS(expiration)-TO_DAYS(NOW())=5
    or TO_DAYS(expiration)-TO_DAYS(NOW())=1 or
    TO_DAYS(expiration)-TO_DAYS(NOW())<=0)
    and user_ID = b.ID";
    
    $recordSet = $conn->Execute($sql);
    if ($recordSet === false) log_error($sql);
    $num_recs = $recordSet->RecordCount();
    if ($num_recs > 0)
    {
    // return the email address
    while (!$recordSet->EOF)
    {
    $user_ID = make_db_unsafe ($recordSet->fields[user_ID]);
    $listingID = make_db_unsafe ($recordSet->fields[ID]);
    $email = make_db_unsafe($recordSet->fields[emailAddress]);
    $formatted_expiration = $recordSet->UserTimeStamp($recordSet->fields[expiration],'M j, Y');
    $days_expired = make_db_unsafe($recordSet->fields[Days]);
    
    if ($days_expired= 5 || $days_expired=10||$days_expired=1) {
    $message= "Your listing, Ad# $listingID, on Home 2 Sell is going to expire in $days_expired day(s) on $formatted_expiration.\r\n
    Click the following link to see the listing:\r\n$config[baseurl]/listingview/$listingID\r\n\r\n
    Click the following link to log-in and go to edit my listings to renew your listing:\r\n$config[baseurl]/index.php";
    } else {
    if ($days_expired <=0) {
    $message= "Your listing, Ad# $listingID, on Home 2 Sell has expired.\r\n
    If it is not renewed in 14 days, it will be deleted from our system.\r\n
    If your listing has sold, please update the status of your listing to sold.
    Click the following link and log-in and go to edit my listings to renew your listing or update the status:\r\n$config[baseurl]/index.php";
    }
    //}
    $message = stripslashes($message);
    $subject = "Listing Expiration on Home 2 Sell";
    
    $recordSet->MoveNext(); 
    mail("$email", "$subject", $message,"From: $config[admin_email]", "-f$config[admin_email]");
    
    // ta da! we're done...
    log_action ("$lang[log_mailed_listing] $listingID");
    }//end while
    }else {
    log_action("$lang[log_zero_mailed] $listingID");
    exit();
    } //end if
    }//end listing expiration
    Instead of using "if ($days_expired= 5 || $days_expired=10||$days_expired=1) ", you could also use "if ($days_expired >0)".
    Last edited by Andre; 01-08-2005 at 09:17 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •