Protect Your Admin - Version 2.3

Version Description

  • Tested with new wordpress version 4.6.1
    • Fixed images size logo issue
    • Modify code for redirect user to new admin url
Download this release

Release Info

Developer india-web-developer
Plugin Icon 128x128 Protect Your Admin
Version 2.3
Comparing to
See all releases

Code changes from version 2.2 to 2.3

Files changed (5) hide show
  1. images/mrweb.jpg +0 -0
  2. images/raghu.jpg +0 -0
  3. protect-wp-admin.php +23 -17
  4. pwa-class.php +50 -21
  5. readme.txt +10 -4
images/mrweb.jpg ADDED
Binary file
images/raghu.jpg DELETED
Binary file
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: MR Web Solution
7
  Author URI: http://www.mrwebsolution.in/
8
- Version: 2.2
9
  */
10
 
11
  /*** Protect WP-Admin Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
@@ -80,11 +80,11 @@ function init_pwa_admin_option_page(){
80
  <p id="adminurl"><label>Admin Slug: </label><input type="text" id="pwa_rewrite_text" name="pwa_rewrite_text" value="<?php echo esc_attr(get_option('pwa_rewrite_text')); ?>" placeholder="myadmin" size="30">(<i>Add New Secure Admin URL Slug ( i.e myadmin )</i>)</p>
81
 
82
  <?php
83
- $getPwaOptions=get_pwa_setting_options();
84
- if((isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active']) && (isset($getPwaOptions['pwa_rewrite_text']) && $getPwaOptions['pwa_rewrite_text']!='')){
85
- echo "<p><strong>Your New Admin URL : </strong><a href='".home_url('/'.$getPwaOptions['pwa_rewrite_text'])."' target='_blank'>".home_url('/'.$getPwaOptions['pwa_rewrite_text'])."</a></p><p><strong><blink><a href='".home_url('/'.$getPwaOptions['pwa_rewrite_text'])."' target='_blank'>CLICK HERE</a></blink></strong> for preivew new admin URL.</p>";
86
 
87
- }
88
  ?>
89
  </div>
90
 
@@ -113,22 +113,28 @@ if((isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active']) &&
113
  <tr>
114
  <td width="30%"><p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZEMSYQUZRUK6A" target="_blank" style="font-size: 17px; font-weight: bold;"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" title="Donate for this plugin"></a></p>
115
 
116
- <p><strong>Plugin Author:</strong><br><img src="<?php echo plugins_url( 'images/raghu.jpg' , __FILE__ );?>" width="75" height="75"><br><a href="http://raghunathgurjar.wordpress.com" target="_blank">Raghunath Gurjar</a></p>
117
  <p><a href="mailto:raghunath.0087@gmail.com" target="_blank" class="contact-author">Contact Author</a></p>
118
- </td>
119
- <td> <p><strong>My Other Plugins:</strong><br>
120
- <ol>
121
- <li><a href="https://wordpress.org/plugins/custom-share-buttons-with-floating-sidebar" target="_blank">Custom Share Buttons with Floating Sidebar</a></li>
122
- <li><a href="https://wordpress.org/plugins/wp-testimonial" target="_blank">WP Testimonial</a></li>
123
- <li><a href="https://wordpress.org/plugins/wp-easy-recipe/" target="_blank">WP Easy Recipe</a></li>
 
 
 
 
 
 
124
  <li><a href="https://wordpress.org/plugins/wp-social-buttons/" target="_blank">WP Social Buttons</a></li>
125
  <li><a href="https://wordpress.org/plugins/wp-youtube-gallery/" target="_blank">WP Youtube Gallery</a></li>
126
- <li><a href="https://wordpress.org/plugins/cf7-advance-security/" target="_blank">CF7 Advance Security</a></li>
127
  <li><a href="https://wordpress.org/plugins/tweets-slider/" target="_blank">Tweets Slider</a></li>
128
- <li><a href="https://wordpress.org/plugins/wc-sales-count-manager/" target="_blank">WooCommerce Sales Count Manager</a></li>
129
- <li><a href="https://wordpress.org/plugins/rg-responsive-gallery/" target="_blank">RG Responsive Gallery/</a></li>
130
- <li><a href="https://wordpress.org/plugins/protect-wp-admin/" target="_blank">Protect WP Admin</a></li>
131
- </ol></p></td>
 
132
  </tr>
133
  </table>
134
 
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: MR Web Solution
7
  Author URI: http://www.mrwebsolution.in/
8
+ Version: 2.3
9
  */
10
 
11
  /*** Protect WP-Admin Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
80
  <p id="adminurl"><label>Admin Slug: </label><input type="text" id="pwa_rewrite_text" name="pwa_rewrite_text" value="<?php echo esc_attr(get_option('pwa_rewrite_text')); ?>" placeholder="myadmin" size="30">(<i>Add New Secure Admin URL Slug ( i.e myadmin )</i>)</p>
81
 
82
  <?php
83
+ $getPwaOptions=get_pwa_setting_options();
84
+ if((isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active']) && (isset($getPwaOptions['pwa_rewrite_text']) && $getPwaOptions['pwa_rewrite_text']!='')){
85
+ echo "<p><strong>Your New Admin URL : </strong><a href='".home_url($getPwaOptions['pwa_rewrite_text'])."' target='_blank'>".home_url($getPwaOptions['pwa_rewrite_text'])."</a></p><p><strong><blink><a href='".home_url($getPwaOptions['pwa_rewrite_text'].'?preview=1')."' target='_blank'>CLICK HERE</a></blink></strong> for preview new admin URL.</p>";
86
 
87
+ }
88
  ?>
89
  </div>
90
 
113
  <tr>
114
  <td width="30%"><p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZEMSYQUZRUK6A" target="_blank" style="font-size: 17px; font-weight: bold;"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" title="Donate for this plugin"></a></p>
115
 
116
+ <p><strong>Plugin Author:</strong><br><img src="<?php echo plugins_url( 'images/mrweb.jpg' , __FILE__ );?>" width="75" height="75"><br><a href="http://raghunathgurjar.wordpress.com" target="_blank">MR Web Solution</a></p>
117
  <p><a href="mailto:raghunath.0087@gmail.com" target="_blank" class="contact-author">Contact Author</a></p>
118
+ </td>
119
+ <td>
120
+ <p><strong>My Other Plugins:</strong><br>
121
+ <ol>
122
+ <li><a href="https://wordpress.org/plugins/custom-share-buttons-with-floating-sidebar" target="_blank">Custom Share Buttons With Floating Sidebar</a></li>
123
+ <li><a href="https://wordpress.org/plugins/protect-wp-admin/" target="_blank">Protect WP-Admin</a></li>
124
+ <li><a href="https://wordpress.org/plugins/wp-categories-widget/" target="_blank">WP Categories Widget</a></li>
125
+ <li><a href="https://wordpress.org/plugins/wp-posts-widget/" target="_blank">WP Post Widget</a></li>
126
+ <li><a href="https://wordpress.org/plugins/wp-importer" target="_blank">WP Importer</a></li>
127
+ <li><a href="https://wordpress.org/plugins/wp-csv-importer/" target="_blank">WP CSV Importer</a></li>
128
+ <li><a href="https://wordpress.org/plugins/wp-testimonial/" target="_blank">WP Testimonial</a></li>
129
+ <li><a href="https://wordpress.org/plugins/wc-sales-count-manager/" target="_blank">WooCommerce Sales Count Manager</a></li>
130
  <li><a href="https://wordpress.org/plugins/wp-social-buttons/" target="_blank">WP Social Buttons</a></li>
131
  <li><a href="https://wordpress.org/plugins/wp-youtube-gallery/" target="_blank">WP Youtube Gallery</a></li>
 
132
  <li><a href="https://wordpress.org/plugins/tweets-slider/" target="_blank">Tweets Slider</a></li>
133
+ <li><a href="https://wordpress.org/plugins/rg-responsive-gallery/" target="_blank">RG Responsive Slider</a></li>
134
+ <li><a href="https://wordpress.org/plugins/cf7-advance-security" target="_blank">Contact Form 7 Advance Security WP-Admin</a></li>
135
+ <li><a href="https://wordpress.org/plugins/wp-easy-recipe/" target="_blank">WP Easy Recipe</a></li>
136
+ </ol>
137
+ </p></td>
138
  </tr>
139
  </table>
140
 
pwa-class.php CHANGED
@@ -7,6 +7,7 @@
7
  ?>
8
  <?php
9
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
 
10
  /** Get all options value */
11
  if(!function_exists('get_pwa_setting_options')):
12
  function get_pwa_setting_options() {
@@ -19,14 +20,16 @@ function get_pwa_setting_options() {
19
  return $pwaOptions;
20
  }
21
  endif;
22
- $getPwaOptions=get_pwa_setting_options();
 
23
  if(isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active'])
24
  {
25
- add_action('login_enqueue_scripts','csbwfs_load_jquery');
26
  add_action('init', 'init_pwa_admin_rewrite_rules' );
27
  add_action('init', 'pwa_admin_url_redirect_conditions' );
28
  add_action('login_head', 'pwa_update_login_page_logo');
29
- add_action('login_footer','csbwfs_custom_script',5);
 
30
 
31
  if(isset($getPwaOptions['pwa_logout']))
32
  {
@@ -34,6 +37,23 @@ add_action('login_footer','csbwfs_custom_script',5);
34
  add_action('admin_init', 'pwa_logout_user_after_settings_save');
35
  }
36
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  if(!function_exists('pwa_logout_user_after_settings_save')):
38
  function pwa_logout_user_after_settings_save()
39
  {
@@ -72,15 +92,15 @@ endif;
72
  /**
73
  * Update Login, Register & Forgot password link as per new admin url
74
  * */
75
- if(!function_exists('csbwfs_load_jquery')):
76
- function csbwfs_load_jquery()
77
  {
78
  wp_enqueue_script("jquery");
79
  }
80
  endif;
81
 
82
- if(!function_exists('csbwfs_custom_script')):
83
- function csbwfs_custom_script()
84
  {
85
  $getPwaOptions=get_pwa_setting_options();
86
  if(isset($getPwaOptions['pwa_active']) && ''!=$getPwaOptions['pwa_rewrite_text']){
@@ -221,19 +241,28 @@ function pwa_get_current_page_url($s, $use_forwarded_host=false)
221
  endif;
222
  /* Change Wordpress Default Logo */
223
  if(!function_exists('pwa_update_login_page_logo')):
224
- function pwa_update_login_page_logo() {
225
- $getPwaOptions=get_pwa_setting_options();
226
-
227
- echo '<style type="text/css"> /* Protect WP-Admin Style*/';
228
-
229
- if(isset($getPwaOptions['pwa_logo_path']) && $getPwaOptions['pwa_logo_path']!='')
230
- echo ' h1 a { background-image:url('.$getPwaOptions['pwa_logo_path'].') !important; }';
231
-
232
- if(isset($getPwaOptions['pwa_login_page_bg_color']) && $getPwaOptions['pwa_login_page_bg_color']!='')
233
- echo ' body.login-action-login,html{ background:'.$getPwaOptions['pwa_login_page_bg_color'].' !important; height: 100% !important;}';
234
-
235
- echo '</style>';
236
-
237
- }
 
 
 
 
 
 
 
 
 
238
  endif;
239
  ?>
7
  ?>
8
  <?php
9
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
+ global $getPwaOptions;
11
  /** Get all options value */
12
  if(!function_exists('get_pwa_setting_options')):
13
  function get_pwa_setting_options() {
20
  return $pwaOptions;
21
  }
22
  endif;
23
+ GLOBAL $getPwaOptions;
24
+ $getPwaOptions = get_pwa_setting_options();
25
  if(isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active'])
26
  {
27
+ add_action('login_enqueue_scripts','pwa_load_jquery');
28
  add_action('init', 'init_pwa_admin_rewrite_rules' );
29
  add_action('init', 'pwa_admin_url_redirect_conditions' );
30
  add_action('login_head', 'pwa_update_login_page_logo');
31
+ add_action('login_footer','pwa_custom_script',5);
32
+ add_action('login_enqueue_scripts','check_login_status',20);
33
 
34
  if(isset($getPwaOptions['pwa_logout']))
35
  {
37
  add_action('admin_init', 'pwa_logout_user_after_settings_save');
38
  }
39
  }
40
+ if(!function_exists('check_login_status')):
41
+ function check_login_status()
42
+ {
43
+ $getPwaOptions = get_pwa_setting_options();
44
+ $current_uri = home_url( add_query_arg( NULL, NULL ) );
45
+ $newadminurl = home_url($getPwaOptions['pwa_rewrite_text']);
46
+ if ( is_user_logged_in() && $current_uri==$newadminurl)
47
+ {
48
+ wp_redirect(admin_url()); die();
49
+ } else {
50
+ //slient';
51
+ }
52
+
53
+
54
+ }
55
+ endif;
56
+
57
  if(!function_exists('pwa_logout_user_after_settings_save')):
58
  function pwa_logout_user_after_settings_save()
59
  {
92
  /**
93
  * Update Login, Register & Forgot password link as per new admin url
94
  * */
95
+ if(!function_exists('pwa_load_jquery')):
96
+ function pwa_load_jquery()
97
  {
98
  wp_enqueue_script("jquery");
99
  }
100
  endif;
101
 
102
+ if(!function_exists('pwa_custom_script')):
103
+ function pwa_custom_script()
104
  {
105
  $getPwaOptions=get_pwa_setting_options();
106
  if(isset($getPwaOptions['pwa_active']) && ''!=$getPwaOptions['pwa_rewrite_text']){
241
  endif;
242
  /* Change Wordpress Default Logo */
243
  if(!function_exists('pwa_update_login_page_logo')):
244
+ function pwa_update_login_page_logo()
245
+ {
246
+
247
+ $getPwaOptions=get_pwa_setting_options();
248
+ // get logo height and width
249
+ $imagelogo = $getPwaOptions['pwa_logo_path'];
250
+ if($imagelogo!=''){
251
+ $logoimagesize = getimagesize($imagelogo);
252
+ $logwigdth =$logoimagesize[0];
253
+ $logheight = $logoimagesize[1];
254
+ }
255
+ echo '<style type="text/css"> /* Protect WP-Admin Style*/';
256
+
257
+ if(isset($getPwaOptions['pwa_logo_path']) && $getPwaOptions['pwa_logo_path']!=''){
258
+ echo ' h1 a { background-image:url('.$getPwaOptions['pwa_logo_path'].') !important; width:'.$logwigdth.'px !important; height:'.$logheight.'px !important;background-size: inherit !important;}';
259
+ }
260
+
261
+ if(isset($getPwaOptions['pwa_login_page_bg_color']) && $getPwaOptions['pwa_login_page_bg_color']!='')
262
+ echo ' body.login-action-login,html{ background:'.$getPwaOptions['pwa_login_page_bg_color'].' !important; height: 100% !important;}';
263
+
264
+ echo '</style>';
265
+
266
+ }
267
  endif;
268
  ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors:india-web-developer
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZEMSYQUZRUK6A
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.8
6
- Tested up to: 4.5.3
7
- Stable tag: 2.2
8
 
9
  1.) Protect Your Website Admin Against Hackers
10
  2.) Modify Login Page Design
@@ -81,6 +81,7 @@ However, if you install this manually, follow these steps:
81
  Basicaly issues can come only in case when you will use default permalink settings.
82
  If your permalink will be update to any other option except default then it will be work fine. Anyway Dont' worry, manualy you can add code into your site .htaccess file.
83
 
 
84
  # BEGIN WordPress
85
  <IfModule mod_rewrite.c>
86
  RewriteEngine On
@@ -93,7 +94,8 @@ RewriteCond %{REQUEST_FILENAME} !-f
93
  RewriteCond %{REQUEST_FILENAME} !-d
94
  RewriteRule . /index.php [L]
95
  </IfModule>
96
- # END WordPress
 
97
 
98
  Don not forgot to update the "newadmin" slug with your new admin slug (that you were added during update the plugin settings) :-)
99
 
@@ -114,7 +116,11 @@ Don not forgot to update the "newadmin" slug with your new admin slug (that you
114
 
115
 
116
 
117
- == Changelog ==
 
 
 
 
118
  = 2.2 =
119
  * Tested with new wordpress version 4.5.3
120
  * Optmized plugin code
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZEMSYQUZRUK6A
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.8
6
+ Tested up to: 4.6.1
7
+ Stable tag: 2.3
8
 
9
  1.) Protect Your Website Admin Against Hackers
10
  2.) Modify Login Page Design
81
  Basicaly issues can come only in case when you will use default permalink settings.
82
  If your permalink will be update to any other option except default then it will be work fine. Anyway Dont' worry, manualy you can add code into your site .htaccess file.
83
 
84
+ <code>
85
  # BEGIN WordPress
86
  <IfModule mod_rewrite.c>
87
  RewriteEngine On
94
  RewriteCond %{REQUEST_FILENAME} !-d
95
  RewriteRule . /index.php [L]
96
  </IfModule>
97
+ # END WordPress
98
+ </code>
99
 
100
  Don not forgot to update the "newadmin" slug with your new admin slug (that you were added during update the plugin settings) :-)
101
 
116
 
117
 
118
 
119
+ == Changelog ==
120
+ = 2.3 =
121
+ * Tested with new wordpress version 4.6.1
122
+ * Fixed images size logo issue
123
+ * Modify code for redirect user to new admin url
124
  = 2.2 =
125
  * Tested with new wordpress version 4.5.3
126
  * Optmized plugin code