Magento 2: how to enable and disable customer?Magento2 : Best way to load Customer by customer Idvalidating is_unique property for custom attribute in customer registration formHow to disable customer?magento2: Enable and Disable logMagento 2 : How to disable/enable payment method based on customer?Magento 2: How to override newsletter Subscriber modelMagento 2 Add new field to Magento_User admin formMagento 2.2: How to completely disable customer login and registrationHow to add a register form inside the login popup during the checkoutDisable customer registration and loginMagento 2 How to disable price from orders, customer account and order view if custom module is enabled?
Visiting the UK as unmarried couple
Superhero words!
What to do when my ideas aren't chosen, when I strongly disagree with the chosen solution?
Could solar power be utilized and substitute coal in the 19th century?
Simulating a probability of 1 of 2^N with less than N random bits
Why are all the doors on Ferenginar (the Ferengi home world) far shorter than the average Ferengi?
Installing PowerShell on 32-bit Kali OS fails
I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?
Is there a problem with hiding "forgot password" until it's needed?
Golf game boilerplate
Giant Toughroad SLR 2 for 200 miles in two days, will it make it?
I2C signal and power over long range (10meter cable)
What is the term when two people sing in harmony, but they aren't singing the same notes?
Are taller landing gear bad for aircraft, particulary large airliners?
Stereotypical names
Why isn't KTEX's runway designation 10/28 instead of 9/27?
How to deal with or prevent idle in the test team?
Does "Dominei" mean something?
Organic chemistry Iodoform Reaction
Should a half Jewish man be discouraged from marrying a Jewess?
Partial sums of primes
Can I create an upright 7-foot × 5-foot wall with the Minor Illusion spell?
Reply ‘no position’ while the job posting is still there (‘HiWi’ position in Germany)
Why are on-board computers allowed to change controls without notifying the pilots?
Magento 2: how to enable and disable customer?
Magento2 : Best way to load Customer by customer Idvalidating is_unique property for custom attribute in customer registration formHow to disable customer?magento2: Enable and Disable logMagento 2 : How to disable/enable payment method based on customer?Magento 2: How to override newsletter Subscriber modelMagento 2 Add new field to Magento_User admin formMagento 2.2: How to completely disable customer login and registrationHow to add a register form inside the login popup during the checkoutDisable customer registration and loginMagento 2 How to disable price from orders, customer account and order view if custom module is enabled?
I am looking for code how the customer can be enabled and disabled using customer Id in Magento 2.
When customer is disabled we should not allow customer to login from front end.
I tried setting is_active column as 0 in Database then also i can able to login from frontend.
I am using below code
public function execute()
$user = $this->customerFactory->create();
$userId = $this->getRequest()->getParam('user_id', false);
$status = 0;
if($userId):
$user->load($userId)->setWebsiteId($oldUser->getWebsiteId());
endif;
try
$user->setIsActive($status);
$user->save();
catch (Exception $e)
$this->_messageManager->addError(__('Can't save user'));
is that can be done pro grammatically?
magento2 customer customer-account
|
show 1 more comment
I am looking for code how the customer can be enabled and disabled using customer Id in Magento 2.
When customer is disabled we should not allow customer to login from front end.
I tried setting is_active column as 0 in Database then also i can able to login from frontend.
I am using below code
public function execute()
$user = $this->customerFactory->create();
$userId = $this->getRequest()->getParam('user_id', false);
$status = 0;
if($userId):
$user->load($userId)->setWebsiteId($oldUser->getWebsiteId());
endif;
try
$user->setIsActive($status);
$user->save();
catch (Exception $e)
$this->_messageManager->addError(__('Can't save user'));
is that can be done pro grammatically?
magento2 customer customer-account
there is little big process for doing this batter use free module for ithttps://github.com/amitshree/magento2-account-approval
– Ansar Husain
Aug 9 '18 at 12:47
It is not correct if we set is_active to 0 in customer_entity table? This module is not my requirement
– jafar pinjar
Aug 9 '18 at 12:55
it will not work with only set that attribute , you will have to use observer in registration time to check customer approved then login other wise logout it and redirect in same page with not active message same is for login condition you will have to create observer to check customer approved then continue login other wise logout and display message for not logged in like that process you will have to do
– Ansar Husain
Aug 9 '18 at 13:02
How to check customer is approved or not using customer Id? Because in my controller i get customer id with drop down value enable or disable, Using id i need to implement that functionality,
– jafar pinjar
Aug 9 '18 at 13:06
magento.stackexchange.com/questions/132577/… use this code to load customer by id then get attribute value $is_active=$customer->getCustomAttribute('is_active');
– Ansar Husain
Aug 9 '18 at 13:15
|
show 1 more comment
I am looking for code how the customer can be enabled and disabled using customer Id in Magento 2.
When customer is disabled we should not allow customer to login from front end.
I tried setting is_active column as 0 in Database then also i can able to login from frontend.
I am using below code
public function execute()
$user = $this->customerFactory->create();
$userId = $this->getRequest()->getParam('user_id', false);
$status = 0;
if($userId):
$user->load($userId)->setWebsiteId($oldUser->getWebsiteId());
endif;
try
$user->setIsActive($status);
$user->save();
catch (Exception $e)
$this->_messageManager->addError(__('Can't save user'));
is that can be done pro grammatically?
magento2 customer customer-account
I am looking for code how the customer can be enabled and disabled using customer Id in Magento 2.
When customer is disabled we should not allow customer to login from front end.
I tried setting is_active column as 0 in Database then also i can able to login from frontend.
I am using below code
public function execute()
$user = $this->customerFactory->create();
$userId = $this->getRequest()->getParam('user_id', false);
$status = 0;
if($userId):
$user->load($userId)->setWebsiteId($oldUser->getWebsiteId());
endif;
try
$user->setIsActive($status);
$user->save();
catch (Exception $e)
$this->_messageManager->addError(__('Can't save user'));
is that can be done pro grammatically?
magento2 customer customer-account
magento2 customer customer-account
edited Mar 12 at 11:33
WaPoNe
90311125
90311125
asked Aug 9 '18 at 10:06
jafar pinjarjafar pinjar
735414
735414
there is little big process for doing this batter use free module for ithttps://github.com/amitshree/magento2-account-approval
– Ansar Husain
Aug 9 '18 at 12:47
It is not correct if we set is_active to 0 in customer_entity table? This module is not my requirement
– jafar pinjar
Aug 9 '18 at 12:55
it will not work with only set that attribute , you will have to use observer in registration time to check customer approved then login other wise logout it and redirect in same page with not active message same is for login condition you will have to create observer to check customer approved then continue login other wise logout and display message for not logged in like that process you will have to do
– Ansar Husain
Aug 9 '18 at 13:02
How to check customer is approved or not using customer Id? Because in my controller i get customer id with drop down value enable or disable, Using id i need to implement that functionality,
– jafar pinjar
Aug 9 '18 at 13:06
magento.stackexchange.com/questions/132577/… use this code to load customer by id then get attribute value $is_active=$customer->getCustomAttribute('is_active');
– Ansar Husain
Aug 9 '18 at 13:15
|
show 1 more comment
there is little big process for doing this batter use free module for ithttps://github.com/amitshree/magento2-account-approval
– Ansar Husain
Aug 9 '18 at 12:47
It is not correct if we set is_active to 0 in customer_entity table? This module is not my requirement
– jafar pinjar
Aug 9 '18 at 12:55
it will not work with only set that attribute , you will have to use observer in registration time to check customer approved then login other wise logout it and redirect in same page with not active message same is for login condition you will have to create observer to check customer approved then continue login other wise logout and display message for not logged in like that process you will have to do
– Ansar Husain
Aug 9 '18 at 13:02
How to check customer is approved or not using customer Id? Because in my controller i get customer id with drop down value enable or disable, Using id i need to implement that functionality,
– jafar pinjar
Aug 9 '18 at 13:06
magento.stackexchange.com/questions/132577/… use this code to load customer by id then get attribute value $is_active=$customer->getCustomAttribute('is_active');
– Ansar Husain
Aug 9 '18 at 13:15
there is little big process for doing this batter use free module for ithttps://github.com/amitshree/magento2-account-approval
– Ansar Husain
Aug 9 '18 at 12:47
there is little big process for doing this batter use free module for ithttps://github.com/amitshree/magento2-account-approval
– Ansar Husain
Aug 9 '18 at 12:47
It is not correct if we set is_active to 0 in customer_entity table? This module is not my requirement
– jafar pinjar
Aug 9 '18 at 12:55
It is not correct if we set is_active to 0 in customer_entity table? This module is not my requirement
– jafar pinjar
Aug 9 '18 at 12:55
it will not work with only set that attribute , you will have to use observer in registration time to check customer approved then login other wise logout it and redirect in same page with not active message same is for login condition you will have to create observer to check customer approved then continue login other wise logout and display message for not logged in like that process you will have to do
– Ansar Husain
Aug 9 '18 at 13:02
it will not work with only set that attribute , you will have to use observer in registration time to check customer approved then login other wise logout it and redirect in same page with not active message same is for login condition you will have to create observer to check customer approved then continue login other wise logout and display message for not logged in like that process you will have to do
– Ansar Husain
Aug 9 '18 at 13:02
How to check customer is approved or not using customer Id? Because in my controller i get customer id with drop down value enable or disable, Using id i need to implement that functionality,
– jafar pinjar
Aug 9 '18 at 13:06
How to check customer is approved or not using customer Id? Because in my controller i get customer id with drop down value enable or disable, Using id i need to implement that functionality,
– jafar pinjar
Aug 9 '18 at 13:06
magento.stackexchange.com/questions/132577/… use this code to load customer by id then get attribute value $is_active=$customer->getCustomAttribute('is_active');
– Ansar Husain
Aug 9 '18 at 13:15
magento.stackexchange.com/questions/132577/… use this code to load customer by id then get attribute value $is_active=$customer->getCustomAttribute('is_active');
– Ansar Husain
Aug 9 '18 at 13:15
|
show 1 more comment
1 Answer
1
active
oldest
votes
I am afraid that without customization you cannot disable a customer in Magento2 as discussed here.
However, you can use Disable Customer developed by "STee Extensions" to easily deactivate a customer access on the frontend website, and of-course you can always reactivate them. Once deactivated, no data will be erased from the customer account.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f237784%2fmagento-2-how-to-enable-and-disable-customer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I am afraid that without customization you cannot disable a customer in Magento2 as discussed here.
However, you can use Disable Customer developed by "STee Extensions" to easily deactivate a customer access on the frontend website, and of-course you can always reactivate them. Once deactivated, no data will be erased from the customer account.
add a comment |
I am afraid that without customization you cannot disable a customer in Magento2 as discussed here.
However, you can use Disable Customer developed by "STee Extensions" to easily deactivate a customer access on the frontend website, and of-course you can always reactivate them. Once deactivated, no data will be erased from the customer account.
add a comment |
I am afraid that without customization you cannot disable a customer in Magento2 as discussed here.
However, you can use Disable Customer developed by "STee Extensions" to easily deactivate a customer access on the frontend website, and of-course you can always reactivate them. Once deactivated, no data will be erased from the customer account.
I am afraid that without customization you cannot disable a customer in Magento2 as discussed here.
However, you can use Disable Customer developed by "STee Extensions" to easily deactivate a customer access on the frontend website, and of-course you can always reactivate them. Once deactivated, no data will be erased from the customer account.
answered 3 mins ago
Saad TaimoorSaad Taimoor
694
694
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f237784%2fmagento-2-how-to-enable-and-disable-customer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
there is little big process for doing this batter use free module for ithttps://github.com/amitshree/magento2-account-approval
– Ansar Husain
Aug 9 '18 at 12:47
It is not correct if we set is_active to 0 in customer_entity table? This module is not my requirement
– jafar pinjar
Aug 9 '18 at 12:55
it will not work with only set that attribute , you will have to use observer in registration time to check customer approved then login other wise logout it and redirect in same page with not active message same is for login condition you will have to create observer to check customer approved then continue login other wise logout and display message for not logged in like that process you will have to do
– Ansar Husain
Aug 9 '18 at 13:02
How to check customer is approved or not using customer Id? Because in my controller i get customer id with drop down value enable or disable, Using id i need to implement that functionality,
– jafar pinjar
Aug 9 '18 at 13:06
magento.stackexchange.com/questions/132577/… use this code to load customer by id then get attribute value $is_active=$customer->getCustomAttribute('is_active');
– Ansar Husain
Aug 9 '18 at 13:15