Version Description
Download this release
Release Info
Developer | jakemgold |
Plugin | Restricted Site Access |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- readme.txt +5 -2
- restricted_site_access.php +16 -13
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.cmurrayconsulting.com/software/wordpress-restricted-site
|
|
4 |
Tags: restricted, limited, permissions, security
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 2.8.4
|
7 |
-
Stable tag: 1.0.
|
8 |
|
9 |
Limit access to your site to visitors who are logged in or accessing the site from a set of specific IP addresses.
|
10 |
Send restricted visitors to the log in page, redirect them, or display a message. Powerful control over
|
@@ -48,7 +48,10 @@ folder to the `/wp-content/plugins/` directory
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
-
v1.
|
|
|
|
|
|
|
52 |
|
53 |
== Coming soon ==
|
54 |
|
4 |
Tags: restricted, limited, permissions, security
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 2.8.4
|
7 |
+
Stable tag: 1.0.2
|
8 |
|
9 |
Limit access to your site to visitors who are logged in or accessing the site from a set of specific IP addresses.
|
10 |
Send restricted visitors to the log in page, redirect them, or display a message. Powerful control over
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
v1.0.1 - Important fundamental change related to handling of what should be restricted
|
52 |
+
|
53 |
+
v1.0.2 - Fix login redirect to home; improve redirect handling to take advantage of wp_redirect function
|
54 |
+
|
55 |
|
56 |
== Coming soon ==
|
57 |
|
restricted_site_access.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Restricted Site Access
|
4 |
Plugin URI: http://www.cmurrayconsulting.com/software/wordpress-restricted-site-access/
|
5 |
Description: <strong>Limit access your site</strong> to visitors who are logged in or accessing the site from a set of specific IP addresses. Send restricted visitors to the log in page, redirect them, or display a message. <strong>Powerful control over redirection</strong>, with option to send to same path and send <strong>SEO friendly redirect headers</strong>. Great solution for Extranets, publicly hosted Intranets, or parallel development sites.
|
6 |
-
Version: 1.0.
|
7 |
Author: Jacob M Goldman (C. Murray Consulting)
|
8 |
Author URI: http://www.cmurrayconsulting.com
|
9 |
|
@@ -67,7 +67,8 @@ function restricted_site_access() {
|
|
67 |
$rsa_restrict_approach = intval(get_option('rsa_restrict_approach'));
|
68 |
switch ($rsa_restrict_approach) {
|
69 |
case 1:
|
70 |
-
|
|
|
71 |
exit;
|
72 |
case 2:
|
73 |
// get base url
|
@@ -75,15 +76,18 @@ function restricted_site_access() {
|
|
75 |
if (!$rsa_redirect_url) return false;
|
76 |
|
77 |
// if redirecting to same path get info
|
78 |
-
if(get_option('rsa_redirect_path') == 1)
|
79 |
-
$url_path = $_SERVER["REQUEST_URI"];
|
80 |
-
$rsa_redirect_url = $rsa_redirect_url.$url_path;
|
81 |
-
}
|
82 |
|
83 |
$rsa_redirect_head = get_option('rsa_redirect_head');
|
84 |
-
if($rsa_redirect_head) header($rsa_redirect_head);
|
85 |
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
exit;
|
88 |
case 3:
|
89 |
exit("Access to this site is restricted.");
|
@@ -187,11 +191,10 @@ function rsa_options() {
|
|
187 |
<th scope="row" style="vertical-align: middle; padding-top: 0;">Redirect type header [<a href="#" onclick="alert('Redirect type headers can provide certain visitors, particularly search engines, more information about the nature of the redirect. A 301 redirect tells search engines that the page has moved permanently to the new location. 307 indicates a temporary redirect. 302 is an undefined redirect.'); return false;" style="cursor: help;">?</a>]</th>
|
188 |
<td style="padding-top: 0;">
|
189 |
<select name="rsa_redirect_head" id="rsa_redirect_head">
|
190 |
-
<?php $rsa_redirect_head =
|
191 |
-
<option value="
|
192 |
-
<option value="
|
193 |
-
<option value="
|
194 |
-
<option value="307 Temporary Redirect HTTP/1.1"<?php if ($rsa_redirect_head == "307") echo ' selected="selected"'; ?>>307 Temporary</option>
|
195 |
</select>
|
196 |
</td>
|
197 |
</tr>
|
3 |
Plugin Name: Restricted Site Access
|
4 |
Plugin URI: http://www.cmurrayconsulting.com/software/wordpress-restricted-site-access/
|
5 |
Description: <strong>Limit access your site</strong> to visitors who are logged in or accessing the site from a set of specific IP addresses. Send restricted visitors to the log in page, redirect them, or display a message. <strong>Powerful control over redirection</strong>, with option to send to same path and send <strong>SEO friendly redirect headers</strong>. Great solution for Extranets, publicly hosted Intranets, or parallel development sites.
|
6 |
+
Version: 1.0.2
|
7 |
Author: Jacob M Goldman (C. Murray Consulting)
|
8 |
Author URI: http://www.cmurrayconsulting.com
|
9 |
|
67 |
$rsa_restrict_approach = intval(get_option('rsa_restrict_approach'));
|
68 |
switch ($rsa_restrict_approach) {
|
69 |
case 1:
|
70 |
+
$new_url = (is_home()) ? get_bloginfo("url") : get_permalink();
|
71 |
+
wp_redirect(wp_login_url($new_url));
|
72 |
exit;
|
73 |
case 2:
|
74 |
// get base url
|
76 |
if (!$rsa_redirect_url) return false;
|
77 |
|
78 |
// if redirecting to same path get info
|
79 |
+
if(get_option('rsa_redirect_path') == 1) $rsa_redirect_url = $rsa_redirect_url.$_SERVER["REQUEST_URI"];
|
|
|
|
|
|
|
80 |
|
81 |
$rsa_redirect_head = get_option('rsa_redirect_head');
|
|
|
82 |
|
83 |
+
//backwards compability for WordPress upgrades from 1.0.1 and earlier
|
84 |
+
if (strlen($rsa_redirect_head) > 3) {
|
85 |
+
$rsa_redirect_head = substr($rsa_redirect_head, 0, 3);
|
86 |
+
update_option("rsa_redirect_head",$rsa_redirect_head);
|
87 |
+
}
|
88 |
+
$rsa_redirect_head = (!$rsa_redirect_head) ? 302 : intval($rsa_redirect_head);
|
89 |
+
|
90 |
+
wp_redirect($rsa_redirect_url, $rsa_redirect_head);
|
91 |
exit;
|
92 |
case 3:
|
93 |
exit("Access to this site is restricted.");
|
191 |
<th scope="row" style="vertical-align: middle; padding-top: 0;">Redirect type header [<a href="#" onclick="alert('Redirect type headers can provide certain visitors, particularly search engines, more information about the nature of the redirect. A 301 redirect tells search engines that the page has moved permanently to the new location. 307 indicates a temporary redirect. 302 is an undefined redirect.'); return false;" style="cursor: help;">?</a>]</th>
|
192 |
<td style="padding-top: 0;">
|
193 |
<select name="rsa_redirect_head" id="rsa_redirect_head">
|
194 |
+
<?php $rsa_redirect_head = get_option('rsa_redirect_head'); ?>
|
195 |
+
<option value="301"<?php if ($rsa_redirect_head == "301") echo ' selected="selected"'; ?>>301 Permanent</option>
|
196 |
+
<option value="302"<?php if ($rsa_redirect_head == "302" || !$rsa_redirect_head) echo ' selected="selected"'; ?>>302 Undefined</option>
|
197 |
+
<option value="307"<?php if ($rsa_redirect_head == "307") echo ' selected="selected"'; ?>>307 Temporary</option>
|
|
|
198 |
</select>
|
199 |
</td>
|
200 |
</tr>
|