Force Login - Version 1.1

Version Description

  • Whitelisted the Registration page and the Lost Password page - props jabdo.
Download this release

Release Info

Developer kevinvess
Plugin Icon 128x128 Force Login
Version 1.1
Comparing to
See all releases

Version 1.1

Files changed (2) hide show
  1. readme.txt +27 -0
  2. wp-force-login.php +39 -0
readme.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Force Login ===
2
+ Contributors: kevinvess
3
+ Tags: force user login, login, private, privacy, protected, hidden
4
+ Requires at least: 3.6
5
+ Tested up to: 3.9.1
6
+ Stable tag: 1.1
7
+ License: GPLv2 or later
8
+
9
+ Force Login is a simple lightweight plugin that requires visitors to log in to interact with the website.
10
+
11
+ == Description ==
12
+
13
+ Easily hide your WordPress site from public viewing by requiring visitors to log in first. As simple as flipping a switch.
14
+
15
+ Make your website private until it's ready to share publicly, or keep it private for members only.
16
+
17
+ == Installation ==
18
+
19
+ Upload the Force Login plugin to your site, then Activate it.
20
+
21
+ 1, 2: You're done!
22
+
23
+ == Changelog ==
24
+
25
+ = 1.1 =
26
+
27
+ * Whitelisted the Registration page and the Lost Password page - props [jabdo](http://profiles.wordpress.org/jabdo).
wp-force-login.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Force Login
4
+ Plugin URI: http://vess.me/
5
+ Description: Easily hide your WordPress site from public viewing by requiring visitors to log in first. Activate to turn on.
6
+ Version: 1.1
7
+ Author: Kevin Vess
8
+ Author URI: http://vess.me/
9
+ License: GPLv2 or later
10
+ */
11
+
12
+ /*
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
+ */
27
+
28
+ function v_getUrl() {
29
+ $url = @( $_SERVER["HTTPS"] != 'on' ) ? 'http://'.$_SERVER["SERVER_NAME"] : 'https://'.$_SERVER["SERVER_NAME"];
30
+ $url .= $_SERVER["REQUEST_URI"];
31
+ return $url;
32
+ }
33
+ function v_forcelogin() {
34
+ if( !is_user_logged_in() && ( v_getUrl() != wp_login_url() && v_getUrl() != wp_registration_url() && v_getUrl() != wp_lostpassword_url() ) ) {
35
+ wp_redirect( wp_login_url(), 302 );
36
+ exit();
37
+ }
38
+ }
39
+ add_action('init', 'v_forcelogin');