Version Description
- Fixed links issue on "Register", "Login" & "Lost Password" As Per New Admin Url
- Fixed the "Register", "Login" & "Lost Password" Form Action URL As Per New Admin Url
- Add validation to check SEO firendly url enable or not.
- Add validation to check .htaccess file is writable or not.
Download this release
Release Info
Developer | india-web-developer |
Plugin | Protect Your Admin |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.4
- protect-wp-admin.php +22 -2
- pwa-class.php +46 -6
- readme.txt +16 -4
protect-wp-admin.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.mrwebsolution.in/
|
|
5 |
Description: "protect-wp-admin" is a very help full plugin to make wordpress admin more secure. Protect WP-Admin plugin is provide the options for change the wp-admin url and make the login page private(directly user can't access the login page).
|
6 |
Author: Raghunath
|
7 |
Author URI: http://www.mrwebsolution.in/
|
8 |
-
Version: 1.
|
9 |
*/
|
10 |
|
11 |
/*** Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
|
@@ -151,6 +151,20 @@ function init_pwa_admin_scripts()
|
|
151 |
wp_register_style( 'pwa_admin_style', plugins_url( 'css/pwa-admin-min.css',__FILE__ ) );
|
152 |
wp_enqueue_style( 'pwa_admin_style' );
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
echo $script='<script type="text/javascript">
|
155 |
/* Protect WP-Admin js for admin */
|
156 |
jQuery(document).ready(function(){
|
@@ -166,12 +180,18 @@ echo $script='<script type="text/javascript">
|
|
166 |
|
167 |
jQuery("#pwa-settings-form-admin .button-primary").click(function(){
|
168 |
var seoUrlVal=jQuery("#check_permalink").val();
|
|
|
169 |
if(seoUrlVal==0)
|
170 |
{
|
171 |
alert("Please update permalinks before activate the plugin. Permalinks option should not be default");
|
172 |
document.location.href="'.admin_url('options-permalink.php').'";
|
173 |
return false;
|
174 |
-
}
|
|
|
|
|
|
|
|
|
|
|
175 |
{
|
176 |
return true;
|
177 |
}
|
5 |
Description: "protect-wp-admin" is a very help full plugin to make wordpress admin more secure. Protect WP-Admin plugin is provide the options for change the wp-admin url and make the login page private(directly user can't access the login page).
|
6 |
Author: Raghunath
|
7 |
Author URI: http://www.mrwebsolution.in/
|
8 |
+
Version: 1.4
|
9 |
*/
|
10 |
|
11 |
/*** Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
|
151 |
wp_register_style( 'pwa_admin_style', plugins_url( 'css/pwa-admin-min.css',__FILE__ ) );
|
152 |
wp_enqueue_style( 'pwa_admin_style' );
|
153 |
|
154 |
+
/* check .htaccess file writeable or not*/
|
155 |
+
$csbwfsHtaccessfilePath = getcwd()."/.htaccess";
|
156 |
+
$csbwfsHtaccessfilePath = str_replace('/wp-admin/','/',$csbwfsHtaccessfilePath);
|
157 |
+
|
158 |
+
if(file_exists($csbwfsHtaccessfilePath)){
|
159 |
+
if(is_writable($csbwfsHtaccessfilePath))
|
160 |
+
{ $htaccessWriteable="1";}
|
161 |
+
else
|
162 |
+
{ $htaccessWriteable="0";}
|
163 |
+
}else
|
164 |
+
{
|
165 |
+
$htaccessWriteable="0";
|
166 |
+
}
|
167 |
+
|
168 |
echo $script='<script type="text/javascript">
|
169 |
/* Protect WP-Admin js for admin */
|
170 |
jQuery(document).ready(function(){
|
180 |
|
181 |
jQuery("#pwa-settings-form-admin .button-primary").click(function(){
|
182 |
var seoUrlVal=jQuery("#check_permalink").val();
|
183 |
+
var htaccessWriteable ="'.$htaccessWriteable.'";
|
184 |
if(seoUrlVal==0)
|
185 |
{
|
186 |
alert("Please update permalinks before activate the plugin. Permalinks option should not be default");
|
187 |
document.location.href="'.admin_url('options-permalink.php').'";
|
188 |
return false;
|
189 |
+
}
|
190 |
+
else if(htaccessWriteable=="0"){
|
191 |
+
alert("Error : .htaccess file is not exist OR may be htaccess file is not writeable, So please double check it before enable the plugin");
|
192 |
+
return false;
|
193 |
+
}
|
194 |
+
else
|
195 |
{
|
196 |
return true;
|
197 |
}
|
pwa-class.php
CHANGED
@@ -65,21 +65,61 @@ function init_pwa_admin_rewrite_rules() {
|
|
65 |
if(isset($getPwaOptions['pwa_active']) && ''!=$getPwaOptions['pwa_rewrite_text']){
|
66 |
$newurl=strip_tags($getPwaOptions['pwa_rewrite_text']);
|
67 |
add_rewrite_rule( $newurl.'/?$', 'wp-login.php', 'top' );
|
|
|
|
|
|
|
68 |
}
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
function pwa_admin_url_redirect_conditions()
|
72 |
{
|
73 |
$getPwaOptions=get_pwa_setting_options();
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
$request_url = pwa_get_current_page_url($_SERVER);
|
78 |
$newUrl = explode('?',$request_url);
|
79 |
-
|
|
|
80 |
{
|
81 |
-
wp_redirect(home_url('/'));
|
82 |
-
|
83 |
}else if(isset($getPwaOptions['pwa_restrict']) && $getPwaOptions['pwa_restrict']==1 && is_user_logged_in())
|
84 |
{
|
85 |
global $current_user;
|
65 |
if(isset($getPwaOptions['pwa_active']) && ''!=$getPwaOptions['pwa_rewrite_text']){
|
66 |
$newurl=strip_tags($getPwaOptions['pwa_rewrite_text']);
|
67 |
add_rewrite_rule( $newurl.'/?$', 'wp-login.php', 'top' );
|
68 |
+
add_rewrite_rule( $newurl.'/register/?$', 'wp-login.php?action=register', 'top' );
|
69 |
+
add_rewrite_rule( $newurl.'/lostpassword/?$', 'wp-login.php?action=lostpassword', 'top' );
|
70 |
+
|
71 |
}
|
72 |
}
|
73 |
|
74 |
+
/**
|
75 |
+
* Update Login, Register & Forgot password link as per new admin url
|
76 |
+
* */
|
77 |
+
add_action('login_head','csbwfs_custom_script');
|
78 |
+
function csbwfs_custom_script()
|
79 |
+
{
|
80 |
+
$getPwaOptions=get_pwa_setting_options();
|
81 |
+
if(isset($getPwaOptions['pwa_active']) && ''!=$getPwaOptions['pwa_rewrite_text']){
|
82 |
+
echo '<script>jQuery(window).load(function(){var formId= jQuery("#login form").attr("id");
|
83 |
+
if(formId=="loginform"){
|
84 |
+
jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"]).'");
|
85 |
+
}else if("lostpasswordform"==formId){
|
86 |
+
jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"].'/lostpassword').'");
|
87 |
+
}else if("registerform"==formId){
|
88 |
+
jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"].'/register').'");
|
89 |
+
}else
|
90 |
+
{
|
91 |
+
//silent
|
92 |
+
}
|
93 |
+
jQuery("#nav a").each(function(){
|
94 |
+
var linkText=jQuery(this).text();
|
95 |
+
if(linkText=="Log in"){jQuery(this).attr("href","'.home_url($getPwaOptions["pwa_rewrite_text"]).'");}
|
96 |
+
else if(linkText=="Register"){jQuery(this).attr("href","'.home_url($getPwaOptions["pwa_rewrite_text"].'/register').'");}else if(linkText=="Lost your password?"){jQuery(this).attr("href","'.home_url($getPwaOptions["pwa_rewrite_text"].'/lostpassword').'");}else {
|
97 |
+
//silent
|
98 |
+
}
|
99 |
+
});});</script>';
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
function pwa_admin_url_redirect_conditions()
|
105 |
{
|
106 |
$getPwaOptions=get_pwa_setting_options();
|
107 |
+
$pwaActualURLAry =array
|
108 |
+
(
|
109 |
+
home_url('/wp-login.php'),
|
110 |
+
home_url('/wp-login.php/'),
|
111 |
+
home_url('/wp-login'),
|
112 |
+
home_url('/wp-login/'),
|
113 |
+
home_url('/wp-admin/'),
|
114 |
+
home_url('/wp-admin')
|
115 |
+
);
|
116 |
$request_url = pwa_get_current_page_url($_SERVER);
|
117 |
$newUrl = explode('?',$request_url);
|
118 |
+
//print_r($pwaActualURLAry); echo $newUrl[0];exit;
|
119 |
+
if(! is_user_logged_in() && in_array($newUrl[0],$pwaActualURLAry) )
|
120 |
{
|
121 |
+
wp_redirect(home_url('/'),301);
|
122 |
+
exit;
|
123 |
}else if(isset($getPwaOptions['pwa_restrict']) && $getPwaOptions['pwa_restrict']==1 && is_user_logged_in())
|
124 |
{
|
125 |
global $current_user;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: Protect WP-Admin,wp-admin,Protect wordpress admin,Secure Admin,Admin,Scure Wordpress Admin,Rename Admin URL, Rename Wordpress Admin URL,Change wp-admin url,Change Admin URL,Change Admin Path,Restrict wp-admin
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Protect Your Website Admin Against Hackers and Modify Login Page Style
|
10 |
|
@@ -22,14 +22,19 @@ All queries for the classic "/wp-admin/" and "wp-login.php" files will be redire
|
|
22 |
|
23 |
The plugin also comes with some access filters, allowing webmasters to restrict guest and registered users access to wp-admin, just in case you want some of your editors to log in the classic way.
|
24 |
|
25 |
-
|
|
|
26 |
|
27 |
= Features =
|
28 |
|
29 |
-
*
|
|
|
|
|
|
|
|
|
30 |
* Restrict guest users for access to wp-admin
|
31 |
* Restrict registered non-admin users from wp-admin
|
32 |
-
*
|
33 |
|
34 |
|
35 |
== Installation ==
|
@@ -75,8 +80,15 @@ Don not forgot to update the "newadmin" slug with your new admin slug (that you
|
|
75 |
|
76 |
5. screenshot-5.png
|
77 |
|
|
|
78 |
== Changelog ==
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
= 1.3 =
|
81 |
* Added an option for define to admin login page logo
|
82 |
* Added an option for define to wp-login page background-color
|
4 |
Tags: Protect WP-Admin,wp-admin,Protect wordpress admin,Secure Admin,Admin,Scure Wordpress Admin,Rename Admin URL, Rename Wordpress Admin URL,Change wp-admin url,Change Admin URL,Change Admin Path,Restrict wp-admin
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.4
|
8 |
|
9 |
Protect Your Website Admin Against Hackers and Modify Login Page Style
|
10 |
|
22 |
|
23 |
The plugin also comes with some access filters, allowing webmasters to restrict guest and registered users access to wp-admin, just in case you want some of your editors to log in the classic way.
|
24 |
|
25 |
+
**NOTE :Back up your database before beginning the activate plugin.**
|
26 |
+
It is extremely important to back up your database before beginning the activate plugin. If, for some reason, you find it necessary to restore your database from these backups.
|
27 |
|
28 |
= Features =
|
29 |
|
30 |
+
* Define custom wp-admin url(i.e http://yourdomain.com/myadmin)
|
31 |
+
* Define custom Logo OR change default logo on login page
|
32 |
+
* Define body background color on login page
|
33 |
+
* SEO friendly URL for "Register" page (i.e http://yourdomain.com/myadmin/register)
|
34 |
+
* SEO friendly URL for "Lost Password" page (i.e http://yourdomain.com/myadmin/lostpassword)
|
35 |
* Restrict guest users for access to wp-admin
|
36 |
* Restrict registered non-admin users from wp-admin
|
37 |
+
* Allow admin access to non-admin users by define comma seprate multiple ids
|
38 |
|
39 |
|
40 |
== Installation ==
|
80 |
|
81 |
5. screenshot-5.png
|
82 |
|
83 |
+
|
84 |
== Changelog ==
|
85 |
|
86 |
+
= 1.4 =
|
87 |
+
* Fixed links issue on "Register", "Login" & "Lost Password" As Per New Admin Url
|
88 |
+
* Fixed the "Register", "Login" & "Lost Password" Form Action URL As Per New Admin Url
|
89 |
+
* Add validation to check SEO firendly url enable or not.
|
90 |
+
* Add validation to check .htaccess file is writable or not.
|
91 |
+
|
92 |
= 1.3 =
|
93 |
* Added an option for define to admin login page logo
|
94 |
* Added an option for define to wp-login page background-color
|