WabismMembersOnly - Version 0.1.0

Version Notes

Currently Supports:
-Enable/Disable Members Only Restriction
-Full website restriction for non-members

Future features include:
- Enable/Disable front-end account registration
- Selectable website restrictions for non-members (restrict catalog, allow cms pages, etc).

Download this release

Release Info

Developer Billy Bastardi
Extension WabismMembersOnly
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/local/Wabism/MembersOnly/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Wabism_MembersOnly_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
6
+ ?>
app/code/local/Wabism/MembersOnly/Model/Observer.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Wabism_MembersOnly_Model_Observer {
3
+ public function isEnabled() {
4
+ $membersonly_state = Mage::getStoreConfig('membersonly_options/membersonly_config/membersonly_state');
5
+ if ($membersonly_state == 1) {
6
+ return true;
7
+ } else return false;
8
+ }
9
+
10
+ public function getCustomerLoginPath() {
11
+ $membersonly_loginpath = Mage::getStoreConfig('membersonly_options/membersonly_config/membersonly_loginpath');
12
+ if (strlen($membersonly_loginpath) > 0) {
13
+ if ($membersonly_loginpath == "null") {
14
+ return false;
15
+ } else {
16
+ return $membersonly_loginpath;
17
+ }
18
+ } else {
19
+ return false;
20
+ }
21
+ }
22
+
23
+ public function initialize() {
24
+ if($this->isEnabled()) {
25
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
26
+ //print "Logged in!";
27
+ } else {
28
+ if($this->getCustomerLoginPath()) {
29
+ $customerlogin_path = $this->getCustomerLoginPath();
30
+ } else {
31
+ $customerlogin_path = "customer/account/login";
32
+ }
33
+
34
+ $base_url = Mage::getBaseUrl();
35
+ $current_path = Mage::helper('core/url')->getCurrentUrl();
36
+ $admin_path = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
37
+
38
+ if($current_path != $base_url.$customerlogin_path) {
39
+ if(substr($current_path,0,strlen($base_url.$admin_path)) != $base_url.$admin_path) {
40
+ header("Location: ".$base_url."customer/account/login");
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ ?>
app/code/local/Wabism/MembersOnly/Model/State.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Wabism_MembersOnly_Model_State {
3
+ public function toOptionArray() {
4
+ return array(
5
+ array('value'=>0, 'label'=>'No'),
6
+ array('value'=>1, 'label'=>'Yes')
7
+ );
8
+ }
9
+ }
10
+ ?>
app/code/local/Wabism/MembersOnly/etc/config.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Wabism_MembersOnly>
5
+ <version>0.1.0</version>
6
+ </Wabism_MembersOnly>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <membersonly>
11
+ <class>Wabism_MembersOnly_Model</class>
12
+ </membersonly>
13
+ </models>
14
+ <helpers>
15
+ <membersonly>
16
+ <class>Wabism_MembersOnly_Helper</class>
17
+ </membersonly>
18
+ </helpers>
19
+ <events>
20
+ <controller_action_layout_load_before>
21
+ <observers>
22
+ <wabism_membersonly_observer>
23
+ <type>singleton</type>
24
+ <class>Wabism_MembersOnly_Model_Observer</class>
25
+ <method>initialize</method>
26
+ </wabism_membersonly_observer>
27
+ </observers>
28
+ </controller_action_layout_load_before>
29
+ </events>
30
+ </global>
31
+
32
+ <adminhtml>
33
+ <acl>
34
+ <resources>
35
+ <admin>
36
+ <children>
37
+ <system>
38
+ <children>
39
+ <config>
40
+ <children>
41
+ <membersonly_options>
42
+ <title>WABISM Members Only Section</title>
43
+ </membersonly_options>
44
+ </children>
45
+ </config>
46
+ </children>
47
+ </system>
48
+ </children>
49
+ </admin>
50
+ </resources>
51
+ </acl>
52
+ </adminhtml>
53
+ <default>
54
+ <membersonly_options>
55
+ <membersonly_config>
56
+ <membersonly_loginpath>customer/account/login</membersonly_loginpath>
57
+ </membersonly_config>
58
+ </membersonly_options>
59
+ </default>
60
+ </config>
app/code/local/Wabism/MembersOnly/etc/system.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <tabs>
3
+ <wabismconfig translate="label" module="membersonly">
4
+ <label>WABISM</label>
5
+ <sort_order>99999</sort_order>
6
+ </wabismconfig>
7
+ </tabs>
8
+ <sections>
9
+ <membersonly_options translate="label" module="membersonly">
10
+ <label>WABISM Members Only</label>
11
+ <tab>wabismconfig</tab>
12
+ <frontend_type>text</frontend_type>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <membersonly_config translate="label">
19
+ <label>General Configuration</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>1</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <membersonly_state>
27
+ <label>Enable MembersOnly</label>
28
+ <frontend_type>select</frontend_type>
29
+ <sort_order>1</sort_order>
30
+ <source_model>membersonly/state</source_model>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </membersonly_state>
35
+ <membersonly_loginpath>
36
+ <label>Member Login Path:</label>
37
+ <frontend_type>text</frontend_type>
38
+ <comment>Value must be 'path/to/login' without a leading slash; set to "null" for default (customer/account/login)</comment>
39
+ <sort_order>2</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </membersonly_loginpath>
44
+ </fields>
45
+ </membersonly_config>
46
+ </groups>
47
+ </membersonly_options>
48
+ </sections>
49
+ </config>
package.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>WabismMembersOnly</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Limit your website to store members only.</summary>
10
+ <description>This module adds an additional layer of security onto your website, limiting anonymous visitors to the user login screen.&#xD;
11
+ &#xD;
12
+ Anyone that visits your website that isn't logged in will be redirected to the login screen with no access to anywhere else on the website. &#xD;
13
+ &#xD;
14
+ Once a member logs in, they will have full access to the website.&#xD;
15
+ &#xD;
16
+ This module was made for wholesale businesses that want to add an additional layer of security to their storefront-- limiting their store to members and denying access to the outside world.</description>
17
+ <notes>Currently Supports:&#xD;
18
+ -Enable/Disable Members Only Restriction&#xD;
19
+ -Full website restriction for non-members&#xD;
20
+ &#xD;
21
+ Future features include:&#xD;
22
+ - Enable/Disable front-end account registration&#xD;
23
+ - Selectable website restrictions for non-members (restrict catalog, allow cms pages, etc).</notes>
24
+ <authors><author><name>Billy Bastardi</name><user>wabism</user><email>billy@wabism.com</email></author></authors>
25
+ <date>2011-11-06</date>
26
+ <time>23:55:23</time>
27
+ <contents><target name="magelocal"><dir name="Wabism"><dir name="MembersOnly"><dir name="Helper"><file name="Data.php" hash="185f1d499deeebdcb5aa57000036b024"/></dir><dir name="Model"><file name="Observer.php" hash="b8b5527c5a52e33bc2e6e2348fdd4221"/><file name="State.php" hash="7465dde4a04aad4f184fe74119c9b163"/></dir><dir name="etc"><file name="config.xml" hash="b42857ca2840159f61a3763fc8c5f093"/><file name="system.xml" hash="6ded546e6dea4cd03d3da9d8a7c75b35"/></dir></dir></dir></target></contents>
28
+ <compatible/>
29
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
30
+ </package>