Jump to content
PhpMadman

[FREE MODULE] Validate Customer

Recommended Posts

Hi.

This is my first attempt on a module.
It's a basic module, that informs the customer that a admin must approve his account before he can login.

When user register account, the module automatically logout customer, and then set the status to disabled.
After that you have to manually enabled customer and the if mail template exist in your language, an mail will be sent automatically.

 

Version 1.1
* Added support for translations
* Added redirect to validate page.
* Fixed text typo
* Added some text to validate page.

Version 1.2
* Changed redirect address
* Added mail notify code from Anila Niaz's customerupdatenotification modulehttps://github.com/anila-niaz/Prestashop/tree/master/Modules/customerupdatenotification
* Diabled notify code, it's not working

Version 1.3
* 1.6 upgrade
* Competly remove code for auto mail
* Improved the code for how account is deactivated
* Wrote new and improved mail code
* Added php switch for mail
* Mail should be sent in customer language
* Added a db table to see what customers has been validated by module

Version 1.4
* Remove Please call line from template
* Fixed? redirect issue. Tested on 1.6.0.9
* Added switch to enable auto sending e-mail when an account activates
* Added switch for enableing employee e-mail when customer register

validatecustomer.zip

 

Edited by PhpMadman

Share this post


Link to post
Share on other sites

That seems very strange.

All the module does is to set newly reggd customers to disabled.

All old customers should not be affected.

Edited by PhpMadman

Share this post


Link to post
Share on other sites

Thank you for creating this module! I think is great, but when a customer creates an account, in the backoffice you can't see it (at the top in the left, like facebook), you must go to customers and see it.

 

And when you create the account, it redirects directly to the autentification page. Could you do it to redirect to another page that only shows "Your account is not activated yet, we're checking your account. If you want an instant answer call us to.... or send us an email to..." or something like that.

Share this post


Link to post
Share on other sites

Hi.

 

It shows customer in the little msg panel in backoffice for me.

 

As for the redirect. I don't know how to to that yet. I only been working on PS for 2 months. And I need to get the company's webshop launched soon. But I will look in to it, when I have the time. But it may take a while..

Share this post


Link to post
Share on other sites

And when you create the account, it redirects directly to the autentification page. Could you do it to redirect to another page that only shows "Your account is not activated yet, we're checking your account. If you want an instant answer call us to.... or send us an email to..." or something like that.

 

Hello.

 

I'm been working on this. And managed to add a redirect.

However if feels a little empty.

Any thoughts on what text to display? Currently I have this.

 

{l s='Thank you for registering.' mod='validatecustomer'}<br>
{l s='Your account must be approved by an admin before you can login after registering' mod='validatecustomer'}

 

Oh, and also... It can now be translated. Swedish language will be included in next release.

Share this post


Link to post
Share on other sites

Hello.

 

I'm been working on this. And managed to add a redirect.

However if feels a little empty.

Any thoughts on what text to display? Currently I have this.

 

{l s='Thank you for registering.' mod='validatecustomer'}<br>
{l s='Your account must be approved by an admin before you can login after registering' mod='validatecustomer'}

 

I guess that it's ok, you only need to say few words. Also you could type something like "Your account must be approved by an admin before you can login after registering. If you want an instant answer, please call to : shopnumber"

Share this post


Link to post
Share on other sites

Thank you PhpMadman!!! I really appreciate it!

but i have an issue, the problem is when someone creates an account, in the backoffice appears this:

258rl7t.jpg

 

I want only actived the second one and the third one, and not actived the first one.

 

Also where can i translate the text "Thank you for registering.

Your account must be approved by an admin before you can login after registering.

If you want an instant answer, please call :"????

 

thank you.

 

PD: do you know how to create a little popup window that says "you need to login to see the prices" or something like that?

Edited by centrobolsos

Share this post


Link to post
Share on other sites

If I understand you correct, if you click to acivte newsleltter and 3rd party offer, the account get's activated?

 

As for the translation. in the module folder, check the translation folder. There is a swedish translation. copy that, change it to your countrycode and then change the swedish string. Do not mess with the scrambeled validatecustomer]>844sdfs string

 

As for the popup window. Not at the moment.

Share this post


Link to post
Share on other sites

If I understand you correct, if you click to acivte newsleltter and 3rd party offer, the account get's activated?

 

As for the translation. in the module folder, check the translation folder. There is a swedish translation. copy that, change it to your countrycode and then change the swedish string. Do not mess with the scrambeled validatecustomer]>844sdfs string

 

As for the popup window. Not at the moment.

 

Haha, no. Sorry, i'm not very clear explaining.

In the picture, the second and the third option when it's activated, in my back office if a customer is new, on the top appears a number, like in facebook. I mean, i register as a customer, and wait for the admin answer, but the admin didn't know if i'm new or not, because there's no "popup" or "new notification" like facebook, i know that it's not very usefull, but sometimes it is.

 

Thank you for your effort.

Share this post


Link to post
Share on other sites

Oh. Okey, then I understand. I don't know what could be causing that. Because all my module really do is when customer reg, it log them out from their account, and then disable it. It dosen't really do anything in the backoffice.

 

I'll do som test tonight if I got the time, but it seem like a very strange ting for my module to cause.

Share this post


Link to post
Share on other sites

Hi.

 

This is my first attempt on a module.

It's a basic module, that informs the customer that a admin must approve his account before he can login.

 

When user register account, the module automatically logout customer, and then set the status to disabled.

After that you have to manually enabled customer and manually email customer that his account has been enabled.

 

I have to develop my works webshop, so I don't have time to update / maintain the module so much, so anyone can feel free to update it as they see fit.

 

*UPDATE*

 

New release, Changelog

 

Version 1.1

* Added support for translations

* Added redirect to validate page.

* Fixed text typo

* Added some text to validate page.

 

Some notes.

I used the {debug} smarty to find a smarty called {$telnumber}, and that for me atlest, get's our nr to the store. However, it does not seems to be the number entred in the Store Contacts, beacuse I added a ! and it did not show.

 

The tpl file customers are redirected to is called validate, and can be foumd in views/templates/front

Edit as see fit, to see your changes, navigate to index.php?fc=module&module=validatecustomer&controller=validate

 

 

 

Hi,

 

Its really great to see your module. I hope to develop one in future.

 

I wonder If admin fails to validate it in time and the customer goes to other site as he cant shop in my site? Just thinking about this possibility.

 

Or is it same like a customer gets verification email instantly and thus he can verify his account and start shopping?

 

Please correct me if i misunderstood the functionality.

 

Thank you.

 

Thank you.

Share this post


Link to post
Share on other sites

Hi.

 

You got most of it right.

I will simplify it.

 

1. This modules does nothing automatic.

2. User reg, user get reg mail, user goes my validate msg page.

3. An admin has to manually activate user in BackOffice, and then manually send a mail to the customer, about the user been activated.

 

So that the user is get annoyed and goes to another site is a possibility.

 

But not an issue for my site, since it aimed at local companies.

Share this post


Link to post
Share on other sites

Hi.

 

You got most of it right.

I will simplify it.

 

1. This modules does nothing automatic.

2. User reg, user get reg mail, user goes my validate msg page.

3. An admin has to manually activate user in BackOffice, and then manually send a mail to the customer, about the user been activated.

 

So that the user is get annoyed and goes to another site is a possibility.

 

But not an issue for my site, since it aimed at local companies.

 

Hi,

 

Thanks for clarifying it. :)

 

What is the main objective of providing such privileges to admin at the cost of user convenience as this generation is getting impatient over wait times.

 

Sometimes, I am afraid even having need to register gets away customers.

 

I am trying to improve my site's UX quotient. :) and will install your module.

 

Thank you.

Edited by PrestaFanBoy

Share this post


Link to post
Share on other sites

Well, sine our site is for country local companies. We use it to make sure they are registred as a company that pays a speical company tax called F-Skatt, and also to check that they are credit friendly.

 

As for thoose who use it on sites with regular users I don't know...

Share this post


Link to post
Share on other sites

Error installing in Ps 1.4.9.0.. Cant be installed..

 

Tks..

This is tested on 1.5.3.1 should work on 1.5.x.

 

I looked one some modules, for 1.4, but there is to much code diffrence for it to work.

Share this post


Link to post
Share on other sites

Hi , i m new in php and prestashop.

I have created my first web store and i like your module , i think its great.

 

But i have a problem , whem i create the account send me an error page like this

 

Fatal error: Call to a member function fetch_assoc() on a non-object in /home/jonymacd/public_html/shop/classes/db/DbMySQLi.php on line 79

 

Can u helpme whit this ?

 

 

my web store is www.labolonia.com.ar

 

Thank a lot...

Jon

Share this post


Link to post
Share on other sites

go to prestashop addons and look for customer email verification

Hi,

 

You forget the link in this post.

 

dopn't forget to put your spam on all topics in all language because in French topic i don't see your spam yet.

Share this post


Link to post
Share on other sites

Hi

I'm using you module, this one, to keep  certain customer at bay until theyr data are verified to fully qualify  ( basically I want  genuine reseller only, with VAT etc etc, no private people/customer )
lately I've got a problem, already twice in a week , people has registered AND enabled themself.

how can this be possible? how has it happened ?

Thanks for your help in investigating this

Share this post


Link to post
Share on other sites

Hi

 

I'm using you module, this one, to keep  certain customer at bay until theyr data are verified to fully qualify  ( basically I want  genuine reseller only, with VAT etc etc, no private people/customer )

lately I've got a problem, already twice in a week , people has registered AND enabled themself.

 

how can this be possible? how has it happened ?

 

Thanks for your help in investigating this

Hi,

here with Update

 

1 We think problem has been sort Out

2 Problem apparently Depends on Presta shop Mobile Setting AND PAypal ( API sides possibly )

 

long story Short:

Got a presta 1.5.6.1 Shop ( upgraded since one year ago )

where Customers have to be manually checked and approved, this because it's a B2B and we want ro deal with genuine Business people , Only. Prices also are Hidden to visitor.

 

So after setting  the ordinary to do not allow people to register and enables Themselve, we setted you Mod  for extra protection on our prospects dedicated price list, Also we  setted shop (default)  on Smartphone only , in Mobile behaviour  area.

 

 

 We found  2 different people coming Inside the shop ( meaning: having access to prices -hidden-) without   enabling them,

and 1 of them did and paied an Order Via Paypal (!!)

 

After extensive research we found the Following :

In Some situations, browsing from Some Android Smartphone Browsers and Versions , If you are already logged on Paypal account ( your Own...)  you Open a new Tab in your Browser to visit  a Prestashop setted as  above reported, You Might Bypass the 'filters' and Buy yourselve some items, also all the price will be Visible to You.

 

What we did:

 

We took the Radio  Button OFF in  -Mobile - Smartphone  only, and setted on  OFF the mobile things.

 

The, after even without cookyes cleaning was no possible to access site anymore, nor to 'enter' it in any way If you were NOT a legitimated ( registered and Approved ) Customer.

 

Maybe reason are even differents, I' d a small and succinte report of my/our case. 

 

Kind regards 

Share this post


Link to post
Share on other sites

Thanks for this really useful module! I was looking for something like this for a project of mine.

In the open-source spirit of 'giving back to the community' I made some adjustments to your module to improve the functionality:

 

First the question you had in your start post: Where you can get the phone number. I believe it's configured in the module 'blockcontact' and is thus retrieveable by the following code:

Configuration::get('blockcontact_telnumber')

Then I added a little method to your class to enable the sending of an e-mail to the shop owner that a new registration is pending:

 

In the function hookActionCustomerAccountAdd() right before Tools::redirect() add the following method-call:

$this->sendNotificationMail()

At the end of the class add this method:

/**
 * Send an e-mail to the shop owner
 *
 * @return boolean
 */
protected function sendNotificationMail()
{
    $customer = $this->context->customer;
    $shopContactMail = Configuration::get('PS_SHOP_EMAIL');

    return Mail::Send(
        $this->context->language->id,
        'notifyowner',
        Mail::l('New Registration!'),
            array(
                '{company}'   => $customer->company,
                '{firstname}' => $customer->firstname,
                '{lastname}'  => $customer->lastname,
                '{email}'     => $customer->email
            ),
            $shopContactMail
        );
}

Lastly don't forget to add the e-mail template(s) called 'notifyowner' to the your_curent_theme/mails/en/ folder (or whatever language you use). The example mail I use is:

File: default/mails/en/notifyowner.txt

A new has been created for {shop_name}.

The submitted customer details are:

Company: {company}
First name: {firstname}
Last name: {lastname}
E-mail: {email}

Please login to the admin page to activate this account.
Edited by C-Laze

Share this post


Link to post
Share on other sites

Looking for verification, does this work with 1.6.0.5 ?

 

I uploaded it but it did not show up in the list.

 

I tried a manual install as well. Am I missing something?

 

Thank you for your time.

 

 

EDIT: Second time is a charm, looks uploaded. I will test it now.

    

very usefull mod ..thanks.

Edited by Names

Share this post


Link to post
Share on other sites

Looking for verification, does this work with 1.6.0.5 ?

 

I uploaded it but it did not show up in the list.

 

I tried a manual install as well. Am I missing something?

 

Thank you for your time.

 

 

EDIT: Second time is a charm, looks uploaded. I will test it now.

    

very usefull mod ..thanks.

Ok So I get a blank Screen after I register same as a previous poster.

anyone know the issue here?

Yes it creates the account, and sends out the email.

But initially it does not redirect the page......

Share this post


Link to post
Share on other sites

Hi

 

Thanks for your module, it's really useful. :-)

 

Right now when the admin validates the account he/she still needs to send manually an email to the user to confirm his/her registration. Is there a way to get this done automatically?

 

Many thanks for your time on this.

 

Guillaume

Share this post


Link to post
Share on other sites

 

Thanks for this really useful module! I was looking for something like this for a project of mine.

In the open-source spirit of 'giving back to the community' I made some adjustments to your module to improve the functionality:

 

First the question you had in your start post: Where you can get the phone number. I believe it's configured in the module 'blockcontact' and is thus retrieveable by the following code:

Configuration::get('blockcontact_telnumber')

Then I added a little method to your class to enable the sending of an e-mail to the shop owner that a new registration is pending:

 

In the function hookActionCustomerAccountAdd() right before Tools::redirect() add the following method-call:

$this->sendNotificationMail()

At the end of the class add this method:

/**
 * Send an e-mail to the shop owner
 *
 * @return boolean
 */
protected function sendNotificationMail()
{
    $customer = $this->context->customer;
    $shopContactMail = Configuration::get('PS_SHOP_EMAIL');

    return Mail::Send(
        $this->context->language->id,
        'notifyowner',
        Mail::l('New Registration!'),
            array(
                '{company}'   => $customer->company,
                '{firstname}' => $customer->firstname,
                '{lastname}'  => $customer->lastname,
                '{email}'     => $customer->email
            ),
            $shopContactMail
        );
}

Lastly don't forget to add the e-mail template(s) called 'notifyowner' to the your_curent_theme/mails/en/ folder (or whatever language you use). The example mail I use is:

File: default/mails/en/notifyowner.txt

A new has been created for {shop_name}.

The submitted customer details are:

Company: {company}
First name: {firstname}
Last name: {lastname}
E-mail: {email}

Please login to the admin page to activate this account.
First of all say thanks to you for this and to all community, I'm new here.
I installed this module and works perfectly for me, but now I'm trying to add that code and nothing happens, no errors no mails receiving and don't know why, can you help me?
 

I'm running prestashop 1.6.0.6

 

Thank you.

Share this post


Link to post
Share on other sites

tks som much for the module.

 

 

I just did install on 1.6.0.6 and I'll let you now know about tests ;)

Edited by leovano

Share this post


Link to post
Share on other sites

New version released!
 

Version 1.1
* Added support for translations
* Added redirect to validate page.
* Fixed text typo
* Added som text to validate page.

Version 1.2
* Changed redirect address
* Added mail notify code from Anila Niaz's customerupdatenotification module
https://github.com/anila-niaz/Prestashop/tree/master/Modules/customerupdatenotification
* Diabled notify code, it's not working

Version 1.3
* 1.6 upgrade
* Competly remove code for auto mail
* Improved the code for how account is deactivated
* Wrote new and improved mail code
* Added php switch for mail
* Mail should be sent in customer language
* Added a db table to see what customers has been validated by module

This new version has mostly code improvements, but also I added the function to send an mail when account is activated.
 
I read the thread, and see that some wanted a mail when a customer reg themself.
I did not add that, beacuse that function allready exist in prestashop own E-Mail alets module.
 
If you don't want to send mail, open the php file and set send_mail to false.
 
The mail included is based on prestashop 1.6.0.9.
If you are on 1.5.x, you need to make your own to match your theme. I suggest to copy prestashops own account.html/txt

validatecustomer.zip

Edited by PhpMadman

Share this post


Link to post
Share on other sites

Hello, I come from version 1.1 and all right, in version 1.3 does not me back to the registration page appears, nor any email.

Edited by Rubenmo

Share this post


Link to post
Share on other sites

Great plugin, but PhpMadman, it's not true PS Mail Alert sends out emails on registration. It does that on orders only. So if someone registers, but doesn't order, no notification is send.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×