MageWare_CustomerLockdown - Version 1.0.0.0

Version Notes

Public release-1.0.0.0

Download this release

Release Info

Developer MageWare
Extension MageWare_CustomerLockdown
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

app/code/community/MageWare/CustomerLockdown/Helper/Data.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_CustomerLockdown_Helper_Data
4
+ extends Mage_Core_Helper_Abstract
5
+ {
6
+
7
+ }
app/code/community/MageWare/CustomerLockdown/Model/Observer.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_CustomerLockdown_Model_Observer
4
+ {
5
+ public function checkPredispatchLockdown($observer)
6
+ {
7
+ $session = Mage::getSingleton('customer/session');
8
+
9
+ if ($session->isLoggedIn()) {
10
+ if ($session->getCustomer()->getIsSuspended()) {
11
+ $session->logout();
12
+ }
13
+ }
14
+
15
+ return $this;
16
+ }
17
+
18
+ public function checkCustomerLockdown($observer)
19
+ {
20
+ $customer = $observer->getModel();
21
+
22
+ if ($customer->getIsSuspended()) {
23
+ throw Mage::exception('Mage_Core', Mage::helper('customerlockdown')->__('Account is suspended.'));
24
+ }
25
+
26
+ return $this;
27
+ }
28
+ }
app/code/community/MageWare/CustomerLockdown/Model/Resource/Setup.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_CustomerLockdown_Model_Resource_Setup
4
+ extends Mage_Eav_Model_Entity_Setup
5
+ {
6
+
7
+ }
app/code/community/MageWare/CustomerLockdown/etc/config.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MageWare_CustomerLockdown>
5
+ <version>1.0.0.0</version>
6
+ </MageWare_CustomerLockdown>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <customerlockdown>
11
+ <class>MageWare_CustomerLockdown_Model</class>
12
+ <resourceModel>customerlockdown_resource</resourceModel>
13
+ </customerlockdown>
14
+ <customerlockdown_resource>
15
+ <class>MageWare_CustomerLockdown_Model_Resource</class>
16
+ </customerlockdown_resource>
17
+ </models>
18
+ <resources>
19
+ <customerlockdown_setup>
20
+ <setup>
21
+ <module>MageWare_CustomerLockdown</module>
22
+ <class>MageWare_CustomerLockdown_Model_Resource_Setup</class>
23
+ </setup>
24
+ </customerlockdown_setup>
25
+ </resources>
26
+ <helpers>
27
+ <customerlockdown>
28
+ <class>MageWare_CustomerLockdown_Helper</class>
29
+ </customerlockdown>
30
+ </helpers>
31
+ </global>
32
+ <adminhtml>
33
+ <translate>
34
+ <modules>
35
+ <MageWare_CustomerLockdown>
36
+ <files>
37
+ <default>MageWare_CustomerLockdown.csv</default>
38
+ </files>
39
+ </MageWare_CustomerLockdown>
40
+ </modules>
41
+ </translate>
42
+ </adminhtml>
43
+ <frontend>
44
+ <translate>
45
+ <modules>
46
+ <MageWare_CustomerLockdown>
47
+ <files>
48
+ <default>MageWare_CustomerLockdown.csv</default>
49
+ </files>
50
+ </MageWare_CustomerLockdown>
51
+ </modules>
52
+ </translate>
53
+ <events>
54
+ <customer_customer_authenticated>
55
+ <observers>
56
+ <customerlockdown_authenticated>
57
+ <class>customerlockdown/observer</class>
58
+ <method>checkCustomerLockdown</method>
59
+ </customerlockdown_authenticated>
60
+ </observers>
61
+ </customer_customer_authenticated>
62
+ <controller_action_predispatch>
63
+ <observers>
64
+ <customerlockdown_predispatch>
65
+ <class>customerlockdown/observer</class>
66
+ <method>checkPredispatchLockdown</method>
67
+ </customerlockdown_predispatch>
68
+ </observers>
69
+ </controller_action_predispatch>
70
+ </events>
71
+ </frontend>
72
+ </config>
app/code/community/MageWare/CustomerLockdown/sql/customerlockdown_setup/install-1.0.0.0.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->getConnection()
8
+ ->addColumn($installer->getTable('customer/entity'), 'is_suspended', array(
9
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
10
+ 'unsigned' => true,
11
+ 'nullable' => false,
12
+ 'default' => '0',
13
+ 'comment' => 'Is Suspended'
14
+ ));
15
+
16
+ $installer->addAttribute('customer', 'is_suspended', array(
17
+ 'type' => 'static',
18
+ 'label' => 'Is Suspended',
19
+ 'input' => 'select',
20
+ 'source' => 'eav/entity_attribute_source_boolean',
21
+ 'backend' => 'customer/attribute_backend_data_boolean',
22
+ 'position' => 25,
23
+ 'required' => false
24
+ ));
25
+
26
+ $attribute = Mage::getSingleton('eav/config')
27
+ ->getAttribute('customer', 'is_suspended');
28
+
29
+ $attribute->setData('used_in_forms', array(
30
+ 'adminhtml_customer'
31
+ ));
32
+
33
+ $attribute->save();
34
+
35
+ $installer->endSetup();
app/etc/modules/MageWare_CustomerLockdown.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MageWare_CustomerLockdown>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Customer />
9
+ <Mage_Adminhtml />
10
+ </depends>
11
+ </MageWare_CustomerLockdown>
12
+ </modules>
13
+ </config>
app/locale/en_US/MageWare_CustomerLockdown.csv ADDED
@@ -0,0 +1,2 @@
 
 
1
+ "Account is suspended.","Account is suspended."
2
+ "Is Suspended","Is Suspended"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>MageWare_CustomerLockdown</name>
4
+ <version>1.0.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Allows to suspend customer accounts.</summary>
10
+ <description>Allows to suspend customer accounts.</description>
11
+ <notes>Public release-1.0.0.0</notes>
12
+ <authors><author><name>MageWare</name><user>mageware</user><email>magentocommerce@mageware.co</email></author></authors>
13
+ <date>2013-03-30</date>
14
+ <time>14:11:36</time>
15
+ <contents><target name="magecommunity"><dir name="MageWare"><dir name="CustomerLockdown"><dir name="Helper"><file name="Data.php" hash="88b2e4df974eca1cb634d0dc318ebe2e"/></dir><dir name="Model"><file name="Observer.php" hash="db9e10c8e617a772d9855fcb77b813f5"/><dir name="Resource"><file name="Setup.php" hash="280d6078581b87bed3e5e5242e33d39e"/></dir></dir><dir name="etc"><file name="config.xml" hash="5d403117ffa0338d727bc42e5ea4242e"/></dir><dir name="sql"><dir name="customerlockdown_setup"><file name="install-1.0.0.0.php" hash="3823a857b0dd7a486dc305d1715c6ced"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MageWare_CustomerLockdown.xml" hash="f71bd6392569939baad704f52f718d80"/></dir></target><target name="magelocale"><dir name="en_US"><file name="MageWare_CustomerLockdown.csv" hash="aef675b49a07a7211bffd5e10f1a80ca"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_All_Latest</name><channel>community</channel><min>1.6.0.0</min><max>1.7.0.2</max></package></required></dependencies>
18
+ </package>