Rack_SelfDelete - Version 0.1.0

Version Notes

0.1.0 Initial release

Download this release

Release Info

Developer Magento Core Team
Extension Rack_SelfDelete
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Rack/SelfDelete/Block/Customer/Form.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rack_SelfDelete_Block_Customer_Form extends Mage_Core_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setTemplate('selfdelete/form.phtml');
8
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('customer')->__('My Account'));
9
+ }
10
+ }
app/code/community/Rack/SelfDelete/Block/Success.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rack_SelfDelete_Block_Success extends Mage_Core_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setTemplate('selfdelete/success.phtml');
8
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('customer')->__('My Account'));
9
+ }
10
+ }
app/code/community/Rack/SelfDelete/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Rack_SelfDelete_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ }
app/code/community/Rack/SelfDelete/Model/SelfDelete.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Rack_SelfDelete_Model_SelfDelete extends Mage_Core_Model_Abstract {
3
+
4
+ }
app/code/community/Rack/SelfDelete/Model/Session.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Rack_Selfdelete_Model_Session extends Mage_Core_Model_Session {
3
+
4
+ }
app/code/community/Rack/SelfDelete/controllers/CustomerController.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rack_SelfDelete_CustomerController extends Mage_Core_Controller_Front_Action {
3
+
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+ }
9
+
10
+ public function deletePostAction()
11
+ {
12
+ if (!$this->_getCustomerSession()->isLoggedIn()) {
13
+ $this->_redirect('*/*/');
14
+ return;
15
+ }
16
+
17
+ $_customer = Mage::getModel('customer/customer')->load($this->_getCustomerSession()->getId());
18
+ $_post = $this->getRequest()->getPost();
19
+
20
+ if (!$_customer->validatePassword($_post['password'])) {
21
+ $this->_getSession()->addError(Mage::helper('selfdelete')->__('Password is incorrect.'));
22
+ $this->_redirect('*/*/');
23
+ } else {
24
+ Mage::register('isSecureArea', true);
25
+ if($_customer->delete()) {
26
+ $this->_redirect('*/*/success');
27
+ } else {
28
+ $this->_getSession()->addError(Mage::helper('selfdelete')->__('Unable to delete your account'));
29
+ $this->_redirect('*/*/');
30
+ }
31
+ }
32
+ return;
33
+ }
34
+
35
+ public function successAction()
36
+ {
37
+ $this->loadLayout();
38
+ $this->renderLayout();
39
+ }
40
+
41
+ protected function _getSession()
42
+ {
43
+ return Mage::getSingleton('selfdelete/session');
44
+ }
45
+
46
+ protected function _getCustomerSession()
47
+ {
48
+ return Mage::getSingleton('customer/session');
49
+ }
50
+
51
+ public function preDispatch()
52
+ {
53
+ parent::preDispatch();
54
+
55
+ if (!$this->getRequest()->isDispatched()) {
56
+ return;
57
+ }
58
+
59
+ $action = $this->getRequest()->getActionName();
60
+ if (!preg_match('/^(index|delete|success)/i', $action)) {
61
+ if (!$this->_getCustomerSession()->authenticate($this)) {
62
+ $this->setFlag('', 'no-dispatch', true);
63
+ }
64
+ } else {
65
+ $this->_getCustomerSession()->setNoReferer(true);
66
+ }
67
+ }
68
+
69
+ public function postDispatch()
70
+ {
71
+ parent::postDispatch();
72
+ $this->_getCustomerSession()->unsNoReferer(false);
73
+ }
74
+ }
app/code/community/Rack/SelfDelete/etc/config.xml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Rack_SelfDelete>
5
+ <version>0.1.0</version>
6
+ </Rack_SelfDelete>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <selfdelete>
11
+ <class>Rack_SelfDelete_Block</class>
12
+ </selfdelete>
13
+ <sales>
14
+ <rewrite>
15
+ <order_view>Rack_SelfDelete_Block_Order_View</order_view>
16
+ </rewrite>
17
+ </sales>
18
+ </blocks>
19
+ <models>
20
+ <selfdelete>
21
+ <class>Rack_SelfDelete_Model</class>
22
+ </selfdelete>
23
+ </models>
24
+ <helpers>
25
+ <selfdelete>
26
+ <class>Rack_SelfDelete_Helper</class>
27
+ </selfdelete>
28
+ </helpers>
29
+ </global>
30
+ <frontend>
31
+ <routers>
32
+ <selfdelete>
33
+ <use>standard</use>
34
+ <args>
35
+ <module>Rack_SelfDelete</module>
36
+ <frontName>selfdelete</frontName>
37
+ </args>
38
+ </selfdelete>
39
+ </routers>
40
+ <layout>
41
+ <updates>
42
+ <selfdelete>
43
+ <file>rack_selfdelete.xml</file>
44
+ </selfdelete>
45
+ </updates>
46
+ </layout>
47
+ <translate>
48
+ <modules>
49
+ <Rack_SelfDelete>
50
+ <files>
51
+ <default>Rack_SelfDelete.csv</default>
52
+ </files>
53
+ </Rack_SelfDelete>
54
+ </modules>
55
+ </translate>
56
+ <secure_url>
57
+ <selfdelete>/selfdelete/</selfdelete>
58
+ </secure_url>
59
+ </frontend>
60
+ <adminhtml>
61
+ <translate>
62
+ <modules>
63
+ <Rack_SelfDelete>
64
+ <files>
65
+ <default>Rack_SelfDelete.csv</default>
66
+ </files>
67
+ </Rack_SelfDelete>
68
+ </modules>
69
+ </translate>
70
+ <acl>
71
+ <resources>
72
+ <all>
73
+ <title>Allow Everything</title>
74
+ </all>
75
+ <admin>
76
+ <children>
77
+ <system>
78
+ <children>
79
+ <config>
80
+ <children>
81
+ <selfdelete translate="title" module="selfdelete">
82
+ <title>SelfDelete Section</title>
83
+ </selfdelete>
84
+ </children>
85
+ </config>
86
+ </children>
87
+ </system>
88
+ </children>
89
+ </admin>
90
+ </resources>
91
+ </acl>
92
+ <system>
93
+ <children>
94
+ <config>
95
+ <children>
96
+ <selfdelete>
97
+ <title>Customer Self Delete Setting</title>
98
+ </selfdelete>
99
+ </children>
100
+ </config>
101
+ </children>
102
+ </system>
103
+ </adminhtml>
104
+ <default>
105
+ <selfdelete>
106
+ <general>
107
+ <active>1</active>
108
+ </general>
109
+ </selfdelete>
110
+ </default>
111
+ </config>
app/code/community/Rack/SelfDelete/etc/system.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <selfdelete translate="label" module="selfdelete">
5
+ <label>Customer Self Delete</label>
6
+ <tab>customer</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>150</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <general translate="label">
14
+ <label>General Options</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>1</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <active translate="label">
22
+ <label>Enabled</label>
23
+ <frontend_type>select</frontend_type>
24
+ <source_model>adminhtml/system_config_source_yesno</source_model>
25
+ <sort_order>1</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </active>
30
+ </fields>
31
+ </general>
32
+ </groups>
33
+ </selfdelete>
34
+ </sections>
35
+ </config>
app/design/frontend/base/default/layout/rack_selfdelete.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <!--
4
+ Customer account pages, rendered for all tabs in dashboard
5
+ -->
6
+ <customer_account>
7
+ <reference name="customer_account_navigation">
8
+ <action method="addLink" translate="label" module="selfdelete"><name>selfdelete</name><path>selfdelete/customer/index</path><label>Delete Account</label></action>
9
+ </reference>
10
+ </customer_account>
11
+
12
+ <selfdelete_customer_index translate="label">
13
+ <label>Customer Self Delete</label>
14
+ <update handle="customer_account"/>
15
+ <reference name="my.account.wrapper">
16
+ <block type="selfdelete/customer_form" name="selfdelete.customer" template="selfdelete/form.phtml"/>
17
+ </reference>
18
+ </selfdelete_customer_index>
19
+
20
+ <selfdelete_customer_success translate="label">
21
+ <label>Customer Self Delete</label>
22
+ <reference name="root">
23
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
24
+ </reference>
25
+ <reference name="content">
26
+ <block type="selfdelete/success" name="selfdelete.success" template="selfdelete/success.phtml"/>
27
+ </reference>
28
+ </selfdelete_customer_success>
29
+
30
+ </layout>
app/design/frontend/base/default/template/selfdelete/form.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1><?php echo $this->__('Delete Your Account') ?></h1>
3
+ </div>
4
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
5
+ <form action="<?php echo $this->getUrl('selfdelete/customer/deletePost'); ?>" method="post" id="delete-form">
6
+ <div class="fieldset">
7
+ <h2 class="legend"><?php echo $this->__('Delete Your Account') ?></h2>
8
+ <ul class="form-list">
9
+ <li>
10
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Your Password') ?></label>
11
+ <div class="input-box">
12
+ <input type="password" title="<?php echo $this->__('Your Password') ?>" class="input-text required-entry" name="password" id="password" />
13
+ </div>
14
+ </li>
15
+ </ul>
16
+ </div>
17
+ <div class="buttons-set">
18
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
19
+ <p class="back-link"><a href="<?php echo $this->getUrl('customer/account') ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
20
+ <button type="submit" title="<?php echo $this->__('Delete Account') ?>" class="button"><span><span><?php echo $this->__('Delete Account') ?></span></span></button>
21
+ </div>
22
+ </form>
23
+ <script type="text/javascript">
24
+ //<![CDATA[
25
+ var dataForm = new VarienForm('delete-form', true);
26
+ //]]>
27
+ </script>
app/design/frontend/base/default/template/selfdelete/success.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1><?php echo Mage::helper('selfdelete')->__('Thank you for using our survice!') ?></h1>
3
+ </div>
4
+ <p><?php echo Mage::helper('customer')->__('Your account successfully deleted and will be redirected to our homepage in 5 seconds.') ?></p>
5
+ <script type="text/javascript">
6
+ //<![CDATA[
7
+ setTimeout(function(){ location.href = '<?php echo $this->getUrl() ?>'},5000);
8
+ //]]>
9
+ </script>
app/etc/modules/Rack_SelfDelete.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Rack_SelfDelete>
6
+ <active>true</active>
7
+ <codePool>community</codePool>
8
+ </Rack_SelfDelete>
9
+ </modules>
10
+ </config>
app/locale/en_US/Rack_SelfDelete.csv ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ "Password is incorrect.","Password is incorrect."
2
+ "Unable to delete your account","Unable to delete your account"
3
+ "My Account","My Account"
4
+ "Your Password","Your Password"
5
+ "* Required Fields","* Required Fields"
6
+ "Back","Back"
7
+ "Delete Account","Delete Account"
8
+ "Thank you for using our survice!","Thank you for using our survice!"
9
+ "Your account successfully deleted and will be redirected to our homepage in 5 seconds.","Your account successfully deleted and will be redirected to our homepage in 5 seconds."
app/locale/ja_JP/Rack_SelfDelete.csv ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ "Password is incorrect.","パスワードが間違っています。"
2
+ "Unable to delete your account","アカウントを削除できません。"
3
+ "My Account","マイアカウント"
4
+ "Your Password","パスワード"
5
+ "* Required Fields","* 必須項目です"
6
+ "Back","戻る"
7
+ "Delete Account","退会"
8
+ "Delete Your Account","退会"
9
+ "Thank you for using our survice!","ご利用ありがとうございました!"
10
+ "Your account successfully deleted and will be redirected to our homepage in 5 seconds.","アカウントを削除しました。5秒後にトップページに移動します。"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Rack_SelfDelete</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension can delete customer account from frontend.</summary>
10
+ <description>This extension can delete customer account from frontend.</description>
11
+ <notes>0.1.0 Initial release</notes>
12
+ <authors><author><name>rack</name><user>auto-converted</user><email>rack990@gmail.com</email></author></authors>
13
+ <date>2010-08-05</date>
14
+ <time>05:45:25</time>
15
+ <contents><target name="magelocale"><dir name="en_US"><file name="Rack_SelfDelete.csv" hash="4903cd8e9e983bc196d9a668abab2c3d"/></dir><dir name="ja_JP"><file name="Rack_SelfDelete.csv" hash="ff5f47934585d39a6e9aa86e4fd279f3"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="rack_selfdelete.xml" hash="b1571009adace4b68f2e360613bd5252"/></dir><dir name="template"><dir name="selfdelete"><file name="form.phtml" hash="dfc9b019e705a4f3dd7466c16c741c91"/><file name="success.phtml" hash="319ddcf839d7056c765412ecf1d25288"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rack_SelfDelete.xml" hash="77568659c9b88f99648817d4a12eb9b9"/></dir></target><target name="magecommunity"><dir name="Rack"><dir name="SelfDelete"><dir name="Block"><dir name="Customer"><file name="Form.php" hash="d421b375440ed3d8d50e7a673240552f"/></dir><file name="Success.php" hash="ecf779b60e10a9251aaedfe935afc5a6"/></dir><dir name="controllers"><file name="CustomerController.php" hash="ced73c9a2a48bb631b5545a4887a8588"/></dir><dir name="etc"><file name="config.xml" hash="667d5ed16fc0f2a9517de220971c7789"/><file name="system.xml" hash="e0ef0c2ffef2c5ece4e77f059b438f75"/></dir><dir name="Helper"><file name="Data.php" hash="4067f1b8d0fa5edf4064e04f8cfbdc0e"/></dir><dir name="Model"><file name="SelfDelete.php" hash="8f9ad2d574c158c0f9daa148c1e82d37"/><file name="Session.php" hash="d1be26e8896492f6257f662ec997ad75"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>