Jump to content

[Module] Send email to client after (manual) account activation


Recommended Posts

Hi,

Here's a module that sends the user an email after you activate their account from backoffice. Please note that it works if you change client status from the edit page and then save it. My next task is to notify client when their account is activated from the user list.

Normally it should work, i've conducted the necessary tests (for prestashop 1.5.3), but if you see a problem please do not hesitate to contact me.

Aany

 

customerupdatenotification.zip

 

EDIT: the module works with Prestashop 1.5.4.

 

EDIT:

The module has been tested and works on Prestashop 1.5.3-1.5.6.

 

UPDATE:

Here's the latest version of my module! You can now edit the customer status from the Customers page, no need to go to the detail page to do so!

 

customerupdatenotification.zip

 

Please follow these instructions to install:

1. As we are overriding a controller we need to delete cache/class_index.php

​2. Download and install the module.

        - copy account_activated.html and account_activated.txt from the mails.zip in mails/

        - open controllers/admin/AdminCustomersController.php and modify the following line

'align' => 'center',
'active' => 'status', //around line 116
'type' => 'bool',

to 

'align' => 'center',
'callback' => 'printStatusIcon', //around line 116
'type' => 'bool',

NOTE: The override for this function wasn't working so I left this manual modification for now.

        

3. Deactivate automatic activation on account creation.

    To do so you need to modify a little code. In controllers/front/AuthController.php you need to change:

$customer->active = 1; //around line 435

 to

$customer->active = 0;

Once you've done this your customers will have a deactivated account when the registration is complete.

3. Modify email templates in mails/{lang_code}/account to include the message that the account is not active yet.

 

Please do not hesitate to contact me if you see any problem with the module. And if you have any problem installing the module I can help you install it. 

 

NOTE: Please use the module with the mentioned prestashop versions. I've stopped further development on the module (at least for now) so test it before using on your production site. 

Edited by AnilaN (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites
  • 5 weeks later...

Hi,

 

Here's a module that sends the user an email after you activate their account from backoffice. Please note that it works if you change client status from the edit page and then save it. My next task is to notify client when their account is activated from the user list.

 

Normally it should work, i've conducted the necessary tests (for prestashop 1.5.3), but if you see a problem please do not hesitate to contact me.

 

Aany

 

Thanks!, Works Perfect!

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hello, I just tried to install your module in my 1.5.4.1 but I didn't managed to make it works... :(

 

I've installed it and activated, but when I try to deactivate and then reactivate an account, no email is sent. As you said, I make the activation from the edit page and then save the changes; I see no error messages, but I don't receive email.

 

Please note that I'm running prestashop for the first time, but I have already received other emails from this test installation, so I'm sure it's not a problem with the email itself. Have you ideas?

 

Please help me if you can, your module is exactly what I need for my shop!!

 

Thanks in advance

 

Alex

 

BTW: how can I disable the automatic validation of new user? I want to activate accounts manually... but I don't find the way! Can you help me?

Share this post


Link to post
Share on other sites

Hello, I just tried to install your module in my 1.5.4.1 but I didn't managed to make it works... :(

 

I've installed it and activated, but when I try to deactivate and then reactivate an account, no email is sent. As you said, I make the activation from the edit page and then save the changes; I see no error messages, but I don't receive email.

 

Please note that I'm running prestashop for the first time, but I have already received other emails from this test installation, so I'm sure it's not a problem with the email itself. Have you ideas?

 

Please help me if you can, your module is exactly what I need for my shop!!

 

Thanks in advance

 

Alex

 

BTW: how can I disable the automatic validation of new user? I want to activate accounts manually... but I don't find the way! Can you help me?

 

Hi Alex,

 

I'm not sure what the problem can be as it never bugged before but I can try :). Are you sending email in english or french, or some other language? Because I don't have translation for other languages.

 

Secondly to deactivate account on creation do the following: In you AuthController.php swicth $customer->active = 1; to $customer->active = 0; (~ line 399). This way when the account is created it is deactivated by default.

 

Aany

  • Like 1

Share this post


Link to post
Share on other sites

Hello Aany

 

Thanks a lot for your reply, and for explaining where to deactivate accounts on creation.

 

My shop is indeed in german and italian, but I thought that the standard email (english) would have worked. I'm very new to prestashop and I'm doing my best to complete a b2b website in few time.

 

If you tell me where to look for translations inside your module I will try to add languages by myself. I'm sorry to ask you for further informations; probably I could find the answer by myself, but I'm actively working on many duties about this new website and every help to shorten my work would be appreciated! :-)

 

Thanks a lot and kind regards

 

Alex

Share this post


Link to post
Share on other sites

Hi Alex,

 

You are welcome :).

 

To add translations for mails, you can add language folder (named after the language iso code: for example fr for french).

You can also:

- copy the fr or en folder in mails

- rename folder to your language

- open each mail file and translate Strings

 

If you need further help, please do not hesitate.

 

Aany

Share this post


Link to post
Share on other sites

Hi Aany

 

I just followed your instructions; created new folder, mad a new zip file, deleted old module and installed the new one... but unfortunately I still don't receive any email.

 

My version of PS is 1.5.4.1 and as I told you I've already received emails from the website, so it's not a problem of email itself. How could I make some sort of debug?

 

I found in customerupdatenotification.php the following code commented;

 

echo '<script type="text/javascript">';

echo 'console.log(Name:'.dirname(__FILE__).'/mails/)';

echo '</script>';

 

I've substituted it with this, and then uploadad the file via ftp in the modules folder:

 

 

echo '<script type="text/javascript">';

echo 'console.log(Name:'.dirname(__FILE__).'/mails/)';

echo 'alert(\'hi\');';

echo '</script>';

 

Unfortunately I get no alert... BTW can I upload changes directly via ftp or have I to create a zip file every time and upload it from modules administration?!?

 

I'm sorry to bother you, I'm just trying to improve my knowledges over PS :-)

 

Thanks a lot

 

Alex

Share this post


Link to post
Share on other sites

Hi Alex,

 

You just needed to add mail folders without deleting the old module and uploading it. I just rechecked and it's working fine.

Once a module is updated and you are just changing files, you can upload modifications by ftp.

As for the debugging: add the following to your customerupdatenotification.php:

echo '<script type="text/javascript">';
echo 'console.log("Hi")';
echo '</script>';

You can see the message in your browser console.

 

And no problem at all :)

 

Aany

Share this post


Link to post
Share on other sites

Hi Aany

 

I was wrong; as soon as I provided translations for the email, the module works fine! My bad!

 

Thanks a lot for helping me, and kind regards

 

Alex

Share this post


Link to post
Share on other sites
  • 3 weeks later...

hello Aany

 

I installed on module can help but do not send the mail, in Spanish

I can indicate how to modify the files thanks

 

Hi,

To be able to send emails in spanish, you need to add spanish translation in mails folder. To do that:

- create a folder named 'es' in mails folder

- copy + paste mail files from 'en' or 'fr' folder;

- open these files and translate strings into spanish

 

Regards,

Aany

Edited by aany (see edit history)

Share this post


Link to post
Share on other sites
  • 3 months later...
  • 3 weeks later...

Hi!

 

I installed the module, and previously changed the mails for translation, but don't work... No send any emails... :(

 

I'm using Prestahsop  1.5.4.1. 

 

hi,

do you have translation folder for the language your want to send email in? (for example fr for french and en for english)

Share this post


Link to post
Share on other sites

Yes, i have 3 folders, en / fr and / es 

 

module.jpg

Ok, in this case can you please try the following:

- backup your current module with spanish translation

- download and install a fresh copy of the module and test it

What results do you get?

Share this post


Link to post
Share on other sites

don't work... :(

 

ok, just to be sure, you change client status in the detail page (which opens when you click on edit in clients list)  and not directly in the list right?

Share this post


Link to post
Share on other sites
  • 1 month later...

 

If all the steps, I give and disable and uninstall as usual, goes all white customers.
Version 1.5.5

 

Ok so you mean you followed all the steps and dit didn't work and even when you uninstall the module the page stays blank? if it is so and you want to delete the module you also have to reset the Controller file to it's initial state. 

Share this post


Link to post
Share on other sites

How do I change that?

 

if you haven't made any other changes to the controller file the best thing will be to download prestashop 1.5.5 zip. then take the controller file from the zip and replace yours with the new one. 

Share this post


Link to post
Share on other sites

That controller should be replaced?

I'm sorry i don't understand what you are trying to say. If you are asking me which controller should be replaced then it's controllers/admin/AdminCustomersController.php. Because we made changes in this one.

Share this post


Link to post
Share on other sites

Hi

 

I just tried to install the last version of your module but i didn't success. Here is the error message :

  • - customerupdatenotification : 
    Impossible d'installer la surcharge : Class AdminCustomersControllerOverrideOriginal52a6de3a37b43 does not exist

Do you have an idea of the problem?

Is someone have the same issue?

 

Thanks in advance...

Share this post


Link to post
Share on other sites

Hi

 

I just tried to install the last version of your module but i didn't success. Here is the error message :

  • - customerupdatenotification : 
    Impossible d'installer la surcharge : Class AdminCustomersControllerOverrideOriginal52a6de3a37b43 does not exist

Do you have an idea of the problem?

Is someone have the same issue?

 

Thanks in advance...

Hi,

Which version of prestashop are you using? I tested the installation and functions of the module and it works fine. Did you follow all the steps? If you did and the problem persists, please tell me and i'll recheck.

 

Regards

Edited by AnilaN (see edit history)

Share this post


Link to post
Share on other sites

Hi! (Sorry for my bad english)

 

I had installed the previous version of the module and works perfect.

 

Today I installed the new version. It did not work. 

 

In the list of customers, under approved, did not appear anything

 

Then uninstalled it and had an error. The same of bjf_jose

 

The only way to fix it was eliminating the "override" folder in the main folder

 

Luego volví a la versión anterior

 

Then I went back to the previous version and works fine.

 

Prestashop multisite 1.5.4

Share this post


Link to post
Share on other sites

Hi! (Sorry for my bad english)

 

I had installed the previous version of the module and works perfect.

 

Today I installed the new version. It did not work. 

 

In the list of customers, under approved, did not appear anything

 

Then uninstalled it and had an error. The same of bjf_jose

 

The only way to fix it was eliminating the "override" folder in the main folder

 

Luego volví a la versión anterior

 

Then I went back to the previous version and works fine.

 

Prestashop multisite 1.5.4

Hi,

one cause of this error may be that an override already exists for the file. does deleting the override file and reinstalling solve the problem? If not then let me know, I haven't seen this problem on my side but i'll try to reproduce it an work on it as soon as possible. 

Share this post


Link to post
Share on other sites

Hello. Using PS 1.5.4.1 this code made able to override the members list trigger function in AdminCustomersController.php:

	public function init()
	{
		$this->fields_list['active'] = array(
				'title' => $this->l('Enabled'),
				'width' => 70,
				'align' => 'center',
				'callback' => 'printStatusIcon',//'active' => 'status',
				'type' => 'bool',
				'orderby' => false,
				'filter_key' => 'a!active',
			);
		parent::init();
	}

A few other notes.

 

In contains a parse error in this piece:

             Mail::Send(
                $this->context->language->id,
                'account_activated',
                Mail::l('Welcome!'),
                array(
                    '{firstname}' => $customer->firstname,
                    '{lastname}' => $customer->lastname,
                    '{email}' => $customer->email,
                    '{shopname}' => $this->context->shop->name,),
                $customer->email,
                $customer->firstname.' '.$customer->lastname,
            );

Need to remove the last comma.

Also the subject here (Welcome!) differs from the one in customerupdatenotification.php

 

Other than that, thanks for your contribution!

Share this post


Link to post
Share on other sites

Hello. Using PS 1.5.4.1 this code made able to override the members list trigger function in AdminCustomersController.php:

	public function init()
	{
		$this->fields_list['active'] = array(
				'title' => $this->l('Enabled'),
				'width' => 70,
				'align' => 'center',
				'callback' => 'printStatusIcon',//'active' => 'status',
				'type' => 'bool',
				'orderby' => false,
				'filter_key' => 'a!active',
			);
		parent::init();
	}

A few other notes.

 

In contains a parse error in this piece:

             Mail::Send(
                $this->context->language->id,
                'account_activated',
                Mail::l('Welcome!'),
                array(
                    '{firstname}' => $customer->firstname,
                    '{lastname}' => $customer->lastname,
                    '{email}' => $customer->email,
                    '{shopname}' => $this->context->shop->name,),
                $customer->email,
                $customer->firstname.' '.$customer->lastname,
            );

Need to remove the last comma.

Also the subject here (Welcome!) differs from the one in customerupdatenotification.php

 

Other than that, thanks for your contribution!

hi, thanks for the feedback! i'll apply the modifications as soon as possible.

Share this post


Link to post
Share on other sites
  • 7 months later...
  • 3 months later...
  • 2 months later...

Hello!
 
I've managed to make this module work on Presta 1.6. Don't need to modify anything in the files, just install the module.

customerupdatenotification.zip

 

Update: found one more bug in the original module - the mail should be sent according to customers language, not the shop language.

Edited by Daresh (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hi,

 

this module does not block the welcome mail for new users. That would not be a very good idea, because the user wouldn't know that anything happened (after registration there is  no 'account created' message beacause the user is inactive and is beeing redirected to login). You should change the contents of the welcome email so the user would know that his account needs to be manually activated. And then the module will send the email after that manual activation.

 

This module overrides some of the Presta functionality, so it has some side effects, and I am personally not using it, I've just updated it to work on 1.6 :)

Share this post


Link to post
Share on other sites
  • 2 weeks later...

When the account is made active, the email is sent, can it be configured to include the username / password like the welcome message created in the front office?

Share this post


Link to post
Share on other sites
  • 1 month later...

Hi,

 

The latest version of this module work well on prestashop 1.6.0.14.

 

Maybe, just add translation for mail in admincustomercontroler :-D

Mail::l('Your account has been activated.', $customer->id_lang),

Thank you for your module !

 

C.Thierry

Share this post


Link to post
Share on other sites
  • 2 months later...
  • 1 month later...

Hi,

 

The latest version of this module work well on prestashop 1.6.0.14.

 

Maybe, just add translation for mail in admincustomercontroler :-D

Mail::l('Your account has been activated.', $customer->id_lang),

Thank you for your module !

 

C.Thierry

 

I installed module version 1.2.1(the last in this post) and it isn't working with ps 1.6.0.9. When I deactivate and activate an user again nothing happen, the module is enabled therefore I don't understand. 

How can I see what error occur when I activate or deactivate users?

Share this post


Link to post
Share on other sites

I installed module version 1.2.1(the last in this post) and it isn't working with ps 1.6.0.9. When I deactivate and activate an user again nothing happen, the module is enabled therefore I don't understand. 

How can I see what error occur when I activate or deactivate users?

 

Sorry, i had a problem with my language(spanish) but after create a subfolder es into mails, the module is working! Thank you op!

Share this post


Link to post
Share on other sites
  • 1 month later...

As of 1.6.1.0

You do NOT need to edit the following: 

 

 

        - open controllers/admin/AdminCustomersController.php and modify the following line
//ORIGIONAL!
'align' => 'center',
'active' => 'status', //around line 116
'type' => 'bool',

 

Please keep in mind that when you DO edit this, your activation from the customer overview WILL NOT WORK.

Please keep this exactly the same.

keep in mind that this is an edit for 'status' => Array();

 

Yours sincerely,

Mike M.

Edited by MikeM. (see edit history)

Share this post


Link to post
Share on other sites
  • 3 months later...

How can i redirect after registration using AuthController.php override???

 

After this:

 


//Send notification mail to administrator
Mail::Send(
           Configuration::get('PS_LANG_DEFAULT'),
           'account_for_admin',//template name
           Mail::l('New client!'),
           array(
               '{firstname}' => $customer->firstname,
               '{lastname}' => $customer->lastname,
               '{email}' => $customer->email
               ),
           Configuration::get('PS_SHOP_EMAIL'),
           Configuration::get('PS_SHOP_NAME')
       );
       Tools::redirect('index.php?id_cms=7&controller=cms');//redirect to CMS page


 

 

 

 

The redirection to CMS page is not working. Any ideas??? All the stuff works well but only the redirection left  to make functional.

Edited by caovillanueva (see edit history)

Share this post


Link to post
Share on other sites
  • 4 weeks later...

Hi, I'm running the last version of Prestashop 1.6.4 and I'm facing problems with this module as it makes the cart empty when you go to checkout page.

I'm not sure when this started to happen because a few months ago it worked great.

I'm complete sure is something related with this module because if I comment out the function processSubmitAccount() within AuthController (in module's folder) it works ok.

 

Any clue about this issue?

 

Thanks!

Share this post


Link to post
Share on other sites

The following module(s) could not be installed properly:

  • customerupdatenotification :
        Nu se poate instala override-ul: The method processSubmitAccount in the class AuthController is already overridden by the module activatecustomer version 1.0 at 2016-01-20 11:26:02 .

Share this post


Link to post
Share on other sites
  • 6 months later...

I used the module and it works perfectly but I want to add the password to  the email 
I added Password : {passwd} in the /customerupdatenotification/mails/en/account_activated.xt and the /customerupdatenotification/mails/en/account_activated.html files

 I added  '{passwd}' => $customer->passwd and $customer->passwd in /customerupdatenotification/override/controllers/admin/AdminCustomersController.php and in /customerupdatenotification/customerupdatenotification.php
But it is displayed in the email {passwrd} and it isn't generated.
Any help please??

Share this post


Link to post
Share on other sites

I used the module and it works perfectly but I want to add the password to the email

I added Password : {passwd} in the /customerupdatenotification/mails/en/account_activated.xt and the /customerupdatenotification/mails/en/account_activated.html files

I added '{passwd}' => $customer->passwd and $customer->passwd in /customerupdatenotification/override/controllers/admin/AdminCustomersController.php and in /customerupdatenotification/customerupdatenotification.php

But it is displayed in the email {passwrd} and it isn't generated.

Any help please??

the problem would be in that case that the password is hashed.

so inorder to get that feature working, you'd have to overwrite the current customer password with a generated one and send that one over the mail

  • Like 1

Share this post


Link to post
Share on other sites

I don't understand how to ovewrite the current customer password? I think it is possible to send the password because it is send it with email created by prestashop after the creation of an account

Share this post


Link to post
Share on other sites

I don't understand how to ovewrite the current customer password? I think it is possible to send the password because it is send it with email created by prestashop after the creation of an account

upon creation the password is sent over POST.

thus the password is known.

before the password is saved it is hashed.

hashing is a one way encryption method in order to secure user passwords it includes an unique salt...

 

thus what you'd like to do isn't possible.

without generating a password, save it and then send it in the mail.

Edited by MikeM. (see edit history)

Share this post


Link to post
Share on other sites
  • 2 months later...

Thanks for the share,

 

I have added my customers manually before founding out this module exists...

is there a way to send them the initial mail a new customer normally receives?

 

(password and etc...)

 

Thanks

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hi all

 

I have a multi-shop, when the client send the information to register in the shop, He receives an email from prestashop and says "Your request has been sent".

 

Here is all OK but when I add the customer, the module sends the email with account password but with wrong information of the shop (header logo, name, footer) .

 

Where I can modify this?

 

Thanks for your help

Share this post


Link to post
Share on other sites
  • 2 months later...
  • nadie unlocked this topic
  • 2 months later...

Hi,

Just installed on PS 1.6.1.17 and perfectly working except the callback function "printStatusIcon" in the overriden AdminCustomersController.php.

I actually have no icon showing whether the account is activated or not.

Any idea ?

Share this post


Link to post
Share on other sites

This module was created for PS 1.5. and it is not maintained anymore by the initial poster, although his last forum activity was on November 2017. It could be that there will be no answer for long time. Better you search and opt for another solution.

For to avoid further problems not answered by nobody, I'm closing now this thread.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More