X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Enable/Disable Profile Modified Email from Admin (https://forum.x-cart.com/showthread.php?t=2642)

adpboss 05-10-2003 09:31 PM

Enable/Disable Profile Modified Email from Admin
 
This is a mod beyond the reach of my current abilites with X-Cart and could really use some assistance.

I would like to be able to have a check box in the admin side of the Modify User profile. The box would be checked by default to notify the customer of changes to their profile.

I need the option to uncheck the box so that when I do annoying little modifications, like capitalising Street Names or correcting Phone Numbers the customer is not bombarded with emails.

I'm sure a lot of people would find this to be a useful mod. If it already exists please tell me. I searched and searched but was unable to turn anything up.

TIA :)

funkydunk 05-12-2003 09:01 AM

Patch for the database to make the option appear in the general settings:

Code:

INSERT INTO xcart_config VALUES ('modify_emails', 'Modification emails sent', 'Y', 'General', 1000, 'Checkbox');

Then amend include/register.php (version 3.3.5 - line 146
change:

Code:

func_send_mail($newuser_info["email"], "mail/profile_modified_subj.tpl", "mail/profile_modified.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        func_send_mail($config["Company"]["users_department"], "mail/profile_admin_modified_subj.tpl", "mail/profile_admin_modified.tpl", $newuser_info["email"], true);


to:
Code:

if ($config["General"]["modify_emails"]=="Y"){

func_send_mail($newuser_info["email"], "mail/profile_modified_subj.tpl", "mail/profile_modified.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
func_send_mail($config["Company"]["users_department"], "mail/profile_admin_modified_subj.tpl", "mail/profile_admin_modified.tpl", $newuser_info["email"], true);
}


howzat?

adpboss 05-12-2003 09:06 AM

Funky Dunk.

INSERT INTO xcart_config VALUES ('modify_emails', 'Modification emails sent', 'Y', 'General', 1000, 'Checkbox');

General should be in commas. :)

I do believe I owe you a beer or two.

Drop me an email the next time you are in Canada.

:)

cotc2001 06-05-2003 02:47 AM

And then edit the template to include another checkbox???

hopefully coz I can't see anything appear at the bottom of the general settings page :(

adpboss 06-05-2003 03:15 AM

If you ran the insert statement on your dbase, the checkbox should automatically appear.

cotc2001 06-05-2003 03:55 AM

Ahhh just tried it on a different version (3.3.5) and it worked but in 3.3.3 it doesn't which was the one I wanted to do it on (v.heavy mods so not safe to upgrade).

Anyone know how to do it in 3.3.3 ????

BoomBoomBap 12-14-2003 03:27 PM

I've got this working in 3.4.10
Here are the changes:

Patch for the database to make the option appear in the general settings:
Code:

INSERT INTO xcart_config VALUES ('modify_emails', 'Modification emails sent', 'Y', 'General', 1000, 'Checkbox');

Then amend include/register.php (version 3.4.10 - line 198)

Original
Code:

#
# Send mail to registered user (do not send to anonymous)
#
        if(!$anonymous_user)
                if ($usertype=="B")
                        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_partner_notif.tpl", $config["Company"]["users_department"], false);
                else
                        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_notification.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        if(!$anonymous_user)
        func_send_mail($config["Company"]["users_department"], "mail/signin_admin_notif_subj.tpl", "mail/signin_admin_notification.tpl", $email, true);


New
Code:

#
# Send mail to registered user (do not send to anonymous)
#
if ($config["General"]["modify_emails"]=="Y"){
        if(!$anonymous_user)
                if ($usertype=="B")
                        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_partner_notif.tpl", $config["Company"]["users_department"], false);
                else
                        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_notification.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        if(!$anonymous_user)
        func_send_mail($config["Company"]["users_department"], "mail/signin_admin_notif_subj.tpl", "mail/signin_admin_notification.tpl", $email, true);
}


Once this mod is implemented, you will find a new checkbox at the bottom of General Settings in the Admin area. Check the box to enable notifications, leave empty to disable them.

Note: the change to register.php is just adding the "if" statement.

What an amazingly simple and effective mod. Thanks !
:D

nerd luv 05-30-2004 11:34 AM

3.4.14
 
I've got a fresh install of 3.4.14 and neither version of the mod worked for me. The checkbox shows up, but unchecking (or checking) it still results in me receiving e-mails everytime a profile is modified.

Has anyone found a way to use this for 3.4.14? Thank you!

adpboss 05-31-2004 05:03 AM

Nerd Luv,

Works fine on my 3.4.14 site. Perhapsyou should post your code so we can see what the problem is.

This is certainly one for Custom Mods (moderators, hint hint)!

nerd luv 05-31-2004 11:48 AM

OK, here's the entire code for include/register.php
It's all in 1 piece, but I divided it into 3 sections here to indicate the section that I changed. (1st piece of original code removed by request)

Here's the bit I changed:
Code:

#
# Send mail to registered user (do not send to anonymous)
#
if ($config["General"]["modify_emails"]=="Y"){
  if(!$anonymous_user)
      if ($usertype=="B")
        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_partner_notif.tpl", $config["Company"]["users_department"], false);
      else
        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_notification.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
  if(!$anonymous_user)
  func_send_mail($config["Company"]["users_department"], "mail/signin_admin_notif_subj.tpl", "mail/signin_admin_notification.tpl", $email, true);
}


This is original code at the end
Code:

#
# Auto-log in
#
        #if($anonymous_user && $usertype=="C") {
        if($usertype=="C" or ($usertype=="B" and $login=="")) {
                $auto_login = true;
                $login = $uname;
                $login_type = $usertype;
                $logged = "";
        }

}
        } else {
#
# Fields filled with errors
#
        if ($fillerror) $reg_error="F";
        if ($eerror) $reg_error="E";
        if ($uerror) $reg_error="U";
        }
if($anonymous_user) {
        $uname="";
        $passwd1="";
        $passwd2="";
}
#
# Fill $userinfo array if error occured
#
$userinfo=$HTTP_POST_VARS;
$userinfo["login"] = $uname;
$userinfo["newsletter"] = ($newsletter=="on"?"Y":"");

}
else {
#
# REQUEST_METHOD = GET
#
if ($mode=="update") {
        $userinfo = func_userinfo($login,$login_type);
}
elseif ($mode=="delete" && $confirmed=="Y") {

        $olduser_info = func_userinfo($login,$login_type);

        $customer_language = func_get_language ($olduser_info);

        func_delete_profile($login,$login_type);
        $login="";
        $login_type="";
        $smarty->clear_assign("login");
#
# Send mail notifications to customer department and signed customer
#
        $mail_smarty->assign("userinfo",$olduser_info);

#
# Send mail to registered user
#
        if (strstr($olduser_info["login"], $anonymous_username_prefix) )  $anonymous_user=true;
        else $anonymous_user=false;
        if(!$anonymous_user)
        func_send_mail($olduser_info["email"], "mail/profile_deleted_subj.tpl", "mail/profile_deleted.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        if(!$anonymous_user)
        func_send_mail($config["Company"]["users_department"], "mail/profile_admin_deleted_subj.tpl", "mail/profile_admin_deleted.tpl", $olduser_info["email"], true);

}
}

#require "../include/countries.php";
#require "../include/states.php";

#$smarty->assign("current_category",$current_category);
if ($uerror || $eerror || $fillerror || $error) {
        $userinfo[firstname]=stripslashes($firstname);
        $userinfo[lastname]=stripslashes($lastname);
        $userinfo[company]=stripslashes($company);
        $userinfo[ssn]=stripslashes($ssn);
        $userinfo[b_address]=stripslashes($b_address);
        $userinfo[b_city]=stripslashes($b_city);
        $userinfo[b_state]=stripslashes($b_state);
        $userinfo[b_zipcode]=stripslashes($b_zipcode);
        $userinfo[s_address]=stripslashes($s_address);
        $userinfo[s_city]=stripslashes($s_city);
        $userinfo[s_state]=stripslashes($s_state);
        $userinfo[s_zipcode]=stripslashes($s_zipcode);
        $userinfo[phone]=stripslashes($phone);
        $userinfo[fax]=stripslashes($fax);
        $userinfo[uname]=stripslashes($uname);
        $userinfo[login]=stripslashes($uname);
        $userinfo[passwd1]=stripslashes($passwd1);
        $userinfo[passwd2]=stripslashes($passwd2);
        $userinfo[password_hint]=stripslashes($password_hint);
        $userinfo[password_hint_answer]=stripslashes($password_hint_answer);
        }

if ($userinfo)
foreach ($userinfo as $key=>$value){
        if (is_string($value))
                $userinfo[$key]=htmlspecialchars($value);
}
$smarty->assign("userinfo",$userinfo);
$smarty->assign("registered",$registered);
$smarty->assign("reg_error",$reg_error);

if($mode=="delete") {
        $smarty->assign("main","profile_delete");
}
elseif($mode=="notdelete") {
        $smarty->assign("main","profile_notdelete");
}
else
        $smarty->assign("main","register");

x_session_save();       
?>


Thoughts, anyone? Is there something else I need to modify?


All times are GMT -8. The time now is 02:04 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.