-
Notifications
You must be signed in to change notification settings - Fork 6
/
unLockCustomer.php
49 lines (40 loc) · 1.68 KB
/
unLockCustomer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* @Author: Alex Dong
* @Date: 2021-03-10 10:09:13
* @Last Modified by: Alex Dong
* @Last Modified time: 2021-03-10 10:23:29
*/
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
//// Setup Base
$folder = ''; //Folder Name
$file = $folder ? "$folder/app/bootstrap.php" : "app/bootstrap.php";
if(!file_exists ($file)) $file = "app/bootstrap.php";
if(file_exists ($file)){
require dirname(__FILE__) .'/' .$file;
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
} else {die('Not found bootstrap.php');}
class updateOrder extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$this->_state->setAreaCode('adminhtml');
// $_storeManager = $this->_objectManager->create('\Magento\Store\Model\StoreManagerInterface');
// $_storeManager->setCurrentStore(0);
$customerId = '2272';
$authentication = $this->_objectManager->create('Magento\Customer\Model\AuthenticationInterface');
$customerRepository = $this->_objectManager->create('Magento\Customer\Api\CustomerRepositoryInterface');
// go to admin url domain.com/admin/customer/locks/unlock/customer_id/1
if ($customerId) {
$authentication->unlock($customerId);
$customer = $customerRepository->getById($customerId);
$customer->setConfirmation(null);
$customerRepository->save($customer);
echo 'done';
}
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('updateOrder');
$bootstrap->run($app);