68 Classifieds Forums

68 Classifieds Forums (http://www.68classifieds.com/forums/index.php)
-   v3.0 Modifications (http://www.68classifieds.com/forums/forumdisplay.php?f=6)
-   -   Email Admin When Listings Change (http://www.68classifieds.com/forums/showthread.php?t=1729)

DVM 10-10-2006 07:31 PM

Email Admin When Listings Change
 
I would like to know if it's possible to email the Admin when the listing was changed.

Reason:
I need to know when the user makes a change to one of the Extra fields
let say " fID=16 " for example. If this is option drop down menu is changed when user modifies listing, I would like to be Emailed this change.

Is this possible? Or something similar?

suzkaw 10-11-2006 10:14 AM

I don't believe this is possible however you could change the setting to change the listing status when they modify a listing which would allow you to double check the ad and make sure it is correct.

juven14 10-11-2006 11:04 AM

You could do this with a module, there are already hooks in place when the listing is modified.

You'd just need to add in to that hooks function to email if this field is changed. On the template you'd need a new hidden field to record the inital value and then compare that field's input against it, if it is different send email otherwise do nothing.

Edit: Sorry, I didn't see that this was in the 3.0 forum, my above statement only applies to 3.1 versions.

suzkaw 10-11-2006 11:16 AM

I didn't relize that either. ;) But I think what I described will work with v3.0

DVM 10-11-2006 02:18 PM

Modify Email
 
I knew I could set it up that when the listing is changed I could have the program set to Admin approval. Which would work, but I didn't want to disrupt the ads from being online.

I know in thanks.php it setups and mails the admin when the listing is made.
Is there a way to have this code implimented in usermodifylisting.php?

PHP Code:

//now display the template
    
if($continue == true)
    {
        
//should mail the admin?
        
if($emailnotify != "N")
        {
            
$sSQL="SELECT checkoutNotification FROM ".PREFIX."checkout_settings WHERE checkoutID=1";
            
$result=$db->query($sSQL);
            
$rs=$result->fetch();
            if(
$rs['checkoutNotification']=="Y")
            {
                
//get the mail template
                
$sSQL="SELECT eID, eName, eSubject, eHTML, eText FROM ".PREFIX."email_templates WHERE eID=6";
                    
$result=$db->query($sSQL);
                    
$rs=$result->fetch();
                    
$subject=$rs['eSubject'];
                    
$htmlContent=$rs['eHTML'];
                    
$textContent=$rs['eText'];
                    
$sSQL="SELECT title,price FROM ".PREFIX."products WHERE id=".$lid;
                    
$result=$db->query($sSQL);
                    
$rs=$result->fetch();
                    
$emailmessage.= $htmlContent.'<br>'. LANG_TITLE.": ".safeStripSlashes($rs['title'])."<br>\n";
                    
$emailmessage.= LANG_PRICE .": ".FormatCurrency($rs['price'])."<br>\n";
                    
$emailmessage.= "<a href='".URL."/viewlisting.php?view=".$lid."'>".URL."/viewlisting.php?view=".$lid."</a><br>\n";
                    
$emailmessage.= "<a href='".URL."/administration/listinginfo.php?view=".trim($lid)."'>".URL."/administration/listinginfo.php?view=".trim($lid)."</a>";
                
// Instantiate mail class
                
$mail = new PHPMailer();
                
$mail->From     = ADMIN_EMAIL;
                
$mail->FromName = 'Admin';
                
$mail->Mailer   = "mail";
                
$mail->IsHTML(true);
                
$mail->Subject = $subject;
                
$mail->Body    = $emailmessage;
                
$mail->AltBody = strip_tags($emailmessage);
                
$mail->AddAddress(ADMIN_EMAIL);
                    if(!
$mail->Send())
                    {
                        
$class_tpl->assign('title',LANG_ERROR);
                        
$class_tpl->assign('pPageContent',LANG_ERROR_MAIL .' '. $mail->ErrorInfo);
                        
$class_tpl->assign('body','content.tpl.php');
                    }
            }
        }



All times are GMT -4. The time now is 04:01 PM.

Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2006, Jelsoft Enterprises Ltd.