Protect Your Admin - Version 1.7

Version Description

  • Fixed forget password email issue
    • Fixed forgot password link issue on login error page
Download this release

Release Info

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

Code changes from version 1.6 to 1.7

Files changed (5) hide show
  1. css/pwa-admin-min.css +1 -1
  2. images/raghu.jpg +0 -0
  3. protect-wp-admin.php +41 -27
  4. pwa-class.php +68 -27
  5. readme.txt +11 -3
css/pwa-admin-min.css CHANGED
@@ -2,4 +2,4 @@
2
  * Protect WP-Admin (C)
3
  * @Raghunath Gurjar
4
  * */
5
- #pwa-tab-menu {width:70%; padding:1%;background: none repeat scroll 0 0 #ccc;}#pwa-tab-menu a {background: none repeat scroll 0 0 #DCA808; border: 0 none;color: #FFFFFF;display: inline-block;font-size: 16px;font-weight: bold;padding: 12px 35px;opacity:0.5;}#pwa-tab-menu a:hover{cursor:pointer;background: none repeat scroll 0 0 #DCA808;opacity:1;}#pwa-tab-menu a.active{ background: none repeat scroll 0 0 #DCA808;opacity:1;}#pwa-settings-form-admin .submit-btn {width: 100%; display: inline-block; padding-top: 10px; margin-top: 10px; border-top: 1px dashed #DCA808;}#pwa-settings-form-admin .submit-btn .button-primary{cursor:pointer;height:35px;}#pwa-settings-form-admin .csbwfs-setting p label {min-width:75px;display:inline-block;}#div-pwa-support img {width:auto; height:auto;}#pwa-settings-form-admin ul {list-style:inside}#pwa-settings-form-admin #div-pwa-support .contact-author{ background: none repeat scroll 0 0 #DC22FF;border: 0 none;color: #FFFFFF;display: inline-block;font-size: 12px; font-weight: bold;padding: 2px 5px;text-decoration: none;}
2
  * Protect WP-Admin (C)
3
  * @Raghunath Gurjar
4
  * */
5
+ #pwa-tab-menu {width:80%; padding:1%;background: none repeat scroll 0 0 #ccc;}#pwa-tab-menu a {background: none repeat scroll 0 0 #DCA808; border: 0 none;color: #FFFFFF;display: inline-block;font-size: 16px;font-weight: bold;padding: 12px 35px;opacity:0.5;}#pwa-tab-menu a:hover{cursor:pointer;background: none repeat scroll 0 0 #DCA808;opacity:1;}#pwa-tab-menu a.active{ background: none repeat scroll 0 0 #DCA808;opacity:1;}#pwa-settings-form-admin .submit-btn {width: 100%; display: inline-block; padding-top: 10px; margin-top: 10px; border-top: 1px dashed #DCA808;}#pwa-settings-form-admin .submit-btn .button-primary{cursor:pointer;height:35px;}#pwa-settings-form-admin .csbwfs-setting p label {min-width:75px;display:inline-block;}#div-pwa-support img {width:auto; height:auto;}#pwa-settings-form-admin ul {list-style:inside}#pwa-settings-form-admin #div-pwa-support .contact-author{ background: none repeat scroll 0 0 #DC22FF;border: 0 none;color: #FFFFFF;display: inline-block;font-size: 12px; font-weight: bold;padding: 2px 5px;text-decoration: none;}
images/raghu.jpg CHANGED
Binary file
protect-wp-admin.php CHANGED
@@ -5,10 +5,10 @@ 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.6
9
  */
10
 
11
- /*** Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
@@ -23,24 +23,24 @@ Version: 1.6
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  ***/
26
-
27
-
28
  /**
29
  * Initialize "Protect WP-Admin" plugin admin menu
30
  * @create new menu
31
  * @create plugin settings page
32
  */
33
  add_action('admin_menu','init_pwa_admin_menu');
34
-
35
  function init_pwa_admin_menu(){
36
 
37
  add_options_page('Protect WP-Admin','Protect WP-Admin','manage_options','pwa-settings','init_pwa_admin_option_page');
38
 
39
  }
40
-
41
  /** Define Action to register "Protect WP-Admin" Options */
42
  add_action('admin_init','init_pwa_options_fields');
43
  /** Register "Protect WP-Admin" options */
 
44
  function init_pwa_options_fields(){
45
  register_setting('pwa_setting_options','pwa_active');
46
  register_setting('pwa_setting_options','pwa_rewrite_text');
@@ -50,16 +50,17 @@ function init_pwa_options_fields(){
50
  register_setting('pwa_setting_options','pwa_logo_path');
51
  register_setting('pwa_setting_options','pwa_login_page_bg_color');
52
  }
53
-
54
-
55
  /** Add settings link to plugin list page in admin */
56
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'pwa_action_links' );
 
57
  function pwa_action_links( $links ) {
58
  $links[] = '<a href="'. get_admin_url(null, 'options-general.php?page=pwa-settings') .'">Settings</a>';
59
  return $links;
60
  }
61
-
62
  /** Check Permalink enable or not*/
 
63
  function get_pwa_setting_optionsa() {
64
  global $wpdb;
65
  $pwaOptions1 = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name = 'rewrite_rules'");
@@ -70,12 +71,11 @@ function get_pwa_setting_optionsa() {
70
  return $pwaOptions1;
71
 
72
  }
73
-
74
-
75
 
76
  /** Options Form HTML for "Protect WP-Admin" plugin */
 
77
  function init_pwa_admin_option_page(){
78
-
79
  $tt=get_pwa_setting_optionsa();
80
  ?>
81
  <div style="width: 80%; padding: 10px; margin: 10px;">
@@ -115,19 +115,26 @@ function init_pwa_admin_option_page(){
115
  <!-- Support -->
116
  <div class="last author pwa-tab" id="div-pwa-support">
117
  <h2>Plugin Support</h2>
118
-
119
- <p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WN785E5V492L4" 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>
 
120
 
121
  <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>
122
  <p><a href="mailto:raghunath.0087@gmail.com" target="_blank" class="contact-author">Contact Author</a></p>
123
- <p><strong>My Other Plugins:</strong><br>
124
- <ul>
 
125
  <li><a href="https://wordpress.org/plugins/custom-share-buttons-with-floating-sidebar" target="_blank">Custom Share Buttons with Floating Sidebar</a></li>
126
  <li><a href="https://wordpress.org/plugins/wp-testimonial" target="_blank">WP Testimonial</a></li>
127
  <li><a href="https://wordpress.org/plugins/wp-easy-recipe/" target="_blank">WP Easy Recipe</a></li>
128
  <li><a href="https://wordpress.org/plugins/wp-social-buttons/" target="_blank">WP Social Buttons</a></li>
129
  <li><a href="https://wordpress.org/plugins/wp-youtube-gallery/" target="_blank">WP Youtube Gallery</a></li>
130
- </ul></p>
 
 
 
 
 
131
  </div>
132
 
133
  </div>
@@ -143,13 +150,13 @@ function init_pwa_admin_option_page(){
143
 
144
  <?php
145
  }
146
-
147
  /** add js into admin footer */
148
  // better use get_current_screen(); or the global $current_screen
149
  if (isset($_GET['page']) && $_GET['page'] == 'pwa-settings') {
150
  add_action('admin_footer','init_pwa_admin_scripts');
151
  }
152
-
153
  function init_pwa_admin_scripts()
154
  {
155
  wp_register_style( 'pwa_admin_style', plugins_url( 'css/pwa-admin-min.css',__FILE__ ) );
@@ -218,30 +225,33 @@ echo $script='<script type="text/javascript">
218
  })
219
  </script>';
220
 
221
- }
222
-
223
-
224
 
225
  // Add Check if permalinks are set on plugin activation
226
  register_activation_hook( __FILE__, 'is_permalink_activate' );
 
227
  function is_permalink_activate() {
228
  //add notice if user needs to enable permalinks
229
  if (! get_option('permalink_structure') )
230
  add_action('admin_notices', 'permalink_structure_admin_notice');
231
  }
232
-
 
233
  function permalink_structure_admin_notice(){
234
  echo '<div id="message" class="error"><p>Please Make sure to enable <a href="options-permalink.php">Permalinks</a>.</p></div>';
235
  }
236
-
237
  /** register_install_hook */
238
  if( function_exists('register_install_hook') ){
239
  register_uninstall_hook(__FILE__,'init_install_pwa_plugins');
240
  }
241
  //flush the rewrite
 
242
  function init_install_pwa_plugins(){
243
  flush_rewrite_rules();
244
- }
 
245
  /** register_uninstall_hook */
246
  /** Delete exits options during disable the plugins */
247
  if( function_exists('register_uninstall_hook') ){
@@ -249,6 +259,7 @@ if( function_exists('register_uninstall_hook') ){
249
  }
250
 
251
  //Delete all options after uninstall the plugin
 
252
  function init_uninstall_pwa_plugins(){
253
  delete_option('pwa_active');
254
  delete_option('pwa_rewrite_text');
@@ -258,6 +269,7 @@ function init_uninstall_pwa_plugins(){
258
  delete_option('pwa_logo_path');
259
  delete_option('pwa_login_page_bg_color');
260
  }
 
261
  require dirname(__FILE__).'/pwa-class.php';
262
 
263
  /** register_deactivation_hook */
@@ -267,20 +279,22 @@ if( function_exists('register_deactivation_hook') ){
267
  }
268
 
269
  //Delete all options after uninstall the plugin
 
270
  function init_deactivation_pwa_plugins(){
271
  delete_option('pwa_active');
272
  delete_option('pwa_rewrite_text');
273
  flush_rewrite_rules();
274
  }
275
-
276
  /** register_activation_hook */
277
  /** Delete exits options during disable the plugins */
278
  if( function_exists('register_activation_hook') ){
279
  register_activation_hook(__FILE__,'init_activation_pwa_plugins');
280
  }
281
-
282
  //Delete all options after uninstall the plugin
 
283
  function init_activation_pwa_plugins(){
284
  flush_rewrite_rules();
285
  }
 
286
  ?>
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.7
9
  */
10
 
11
+ /*** Protect WP-Admin Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  ***/
26
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
 
27
  /**
28
  * Initialize "Protect WP-Admin" plugin admin menu
29
  * @create new menu
30
  * @create plugin settings page
31
  */
32
  add_action('admin_menu','init_pwa_admin_menu');
33
+ if(!function_exists('init_pwa_admin_menu')):
34
  function init_pwa_admin_menu(){
35
 
36
  add_options_page('Protect WP-Admin','Protect WP-Admin','manage_options','pwa-settings','init_pwa_admin_option_page');
37
 
38
  }
39
+ endif;
40
  /** Define Action to register "Protect WP-Admin" Options */
41
  add_action('admin_init','init_pwa_options_fields');
42
  /** Register "Protect WP-Admin" options */
43
+ if(!function_exists('init_pwa_options_fields')):
44
  function init_pwa_options_fields(){
45
  register_setting('pwa_setting_options','pwa_active');
46
  register_setting('pwa_setting_options','pwa_rewrite_text');
50
  register_setting('pwa_setting_options','pwa_logo_path');
51
  register_setting('pwa_setting_options','pwa_login_page_bg_color');
52
  }
53
+ endif;
 
54
  /** Add settings link to plugin list page in admin */
55
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'pwa_action_links' );
56
+ if(!function_exists('pwa_action_links')):
57
  function pwa_action_links( $links ) {
58
  $links[] = '<a href="'. get_admin_url(null, 'options-general.php?page=pwa-settings') .'">Settings</a>';
59
  return $links;
60
  }
61
+ endif;
62
  /** Check Permalink enable or not*/
63
+ if(!function_exists('get_pwa_setting_optionsa')):
64
  function get_pwa_setting_optionsa() {
65
  global $wpdb;
66
  $pwaOptions1 = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name = 'rewrite_rules'");
71
  return $pwaOptions1;
72
 
73
  }
74
+ endif;
 
75
 
76
  /** Options Form HTML for "Protect WP-Admin" plugin */
77
+ if(!function_exists('init_pwa_admin_option_page')):
78
  function init_pwa_admin_option_page(){
 
79
  $tt=get_pwa_setting_optionsa();
80
  ?>
81
  <div style="width: 80%; padding: 10px; margin: 10px;">
115
  <!-- Support -->
116
  <div class="last author pwa-tab" id="div-pwa-support">
117
  <h2>Plugin Support</h2>
118
+ <table>
119
+ <tr>
120
+ <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>
121
 
122
  <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>
123
  <p><a href="mailto:raghunath.0087@gmail.com" target="_blank" class="contact-author">Contact Author</a></p>
124
+ </td>
125
+ <td> <p><strong>My Other Plugins:</strong><br>
126
+ <ol>
127
  <li><a href="https://wordpress.org/plugins/custom-share-buttons-with-floating-sidebar" target="_blank">Custom Share Buttons with Floating Sidebar</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/wp-easy-recipe/" target="_blank">WP Easy Recipe</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/cf7-advance-security/" target="_blank">CF7 Advance Security</a></li>
133
+ <li><a href="https://wordpress.org/plugins/wc-sales-count-manager/" target="_blank">WooCommerce Sales Count Manager</a></li>
134
+ </ol></p></td>
135
+ </tr>
136
+ </table>
137
+
138
  </div>
139
 
140
  </div>
150
 
151
  <?php
152
  }
153
+ endif;
154
  /** add js into admin footer */
155
  // better use get_current_screen(); or the global $current_screen
156
  if (isset($_GET['page']) && $_GET['page'] == 'pwa-settings') {
157
  add_action('admin_footer','init_pwa_admin_scripts');
158
  }
159
+ if(!function_exists('init_pwa_admin_scripts')):
160
  function init_pwa_admin_scripts()
161
  {
162
  wp_register_style( 'pwa_admin_style', plugins_url( 'css/pwa-admin-min.css',__FILE__ ) );
225
  })
226
  </script>';
227
 
228
+ }
229
+ endif;
 
230
 
231
  // Add Check if permalinks are set on plugin activation
232
  register_activation_hook( __FILE__, 'is_permalink_activate' );
233
+ if(!function_exists('is_permalink_activate')):
234
  function is_permalink_activate() {
235
  //add notice if user needs to enable permalinks
236
  if (! get_option('permalink_structure') )
237
  add_action('admin_notices', 'permalink_structure_admin_notice');
238
  }
239
+ endif;
240
+ if(!function_exists('permalink_structure_admin_notice')):
241
  function permalink_structure_admin_notice(){
242
  echo '<div id="message" class="error"><p>Please Make sure to enable <a href="options-permalink.php">Permalinks</a>.</p></div>';
243
  }
244
+ endif;
245
  /** register_install_hook */
246
  if( function_exists('register_install_hook') ){
247
  register_uninstall_hook(__FILE__,'init_install_pwa_plugins');
248
  }
249
  //flush the rewrite
250
+ if(!function_exists('init_install_pwa_plugins')):
251
  function init_install_pwa_plugins(){
252
  flush_rewrite_rules();
253
+ }
254
+ endif;
255
  /** register_uninstall_hook */
256
  /** Delete exits options during disable the plugins */
257
  if( function_exists('register_uninstall_hook') ){
259
  }
260
 
261
  //Delete all options after uninstall the plugin
262
+ if(!function_exists('init_uninstall_pwa_plugins')):
263
  function init_uninstall_pwa_plugins(){
264
  delete_option('pwa_active');
265
  delete_option('pwa_rewrite_text');
269
  delete_option('pwa_logo_path');
270
  delete_option('pwa_login_page_bg_color');
271
  }
272
+ endif;
273
  require dirname(__FILE__).'/pwa-class.php';
274
 
275
  /** register_deactivation_hook */
279
  }
280
 
281
  //Delete all options after uninstall the plugin
282
+ if(!function_exists('init_deactivation_pwa_plugins')):
283
  function init_deactivation_pwa_plugins(){
284
  delete_option('pwa_active');
285
  delete_option('pwa_rewrite_text');
286
  flush_rewrite_rules();
287
  }
288
+ endif;
289
  /** register_activation_hook */
290
  /** Delete exits options during disable the plugins */
291
  if( function_exists('register_activation_hook') ){
292
  register_activation_hook(__FILE__,'init_activation_pwa_plugins');
293
  }
 
294
  //Delete all options after uninstall the plugin
295
+ if(!function_exists('init_activation_pwa_plugins')):
296
  function init_activation_pwa_plugins(){
297
  flush_rewrite_rules();
298
  }
299
+ endif;
300
  ?>
pwa-class.php CHANGED
@@ -6,8 +6,9 @@
6
  * */
7
  ?>
8
  <?php
9
-
10
  /** Get all options value */
 
11
  function get_pwa_setting_options() {
12
  global $wpdb;
13
  $pwaOptions = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE 'pwa_%'");
@@ -15,28 +16,25 @@ function get_pwa_setting_options() {
15
  foreach ($pwaOptions as $option) {
16
  $pwaOptions[$option->option_name] = $option->option_value;
17
  }
18
-
19
  return $pwaOptions;
20
  }
21
-
22
-
23
  $getPwaOptions=get_pwa_setting_options();
24
-
25
  if(isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active'])
26
  {
27
-
28
  add_action('init', 'init_pwa_admin_rewrite_rules' );
29
  add_action('init', 'pwa_admin_url_redirect_conditions' );
 
 
30
 
 
 
 
 
 
31
  }
32
-
33
-
34
- if(isset($getPwaOptions['pwa_logout']))
35
- {
36
- add_action('admin_init', 'pwa_logout_user_after_settings_save');
37
- add_action('admin_init', 'pwa_logout_user_after_settings_save');
38
- }
39
-
40
  function pwa_logout_user_after_settings_save()
41
  {
42
  $getPwaOptions=get_pwa_setting_options();
@@ -56,9 +54,10 @@ function pwa_logout_user_after_settings_save()
56
  }
57
  //wp_redirect($URL);
58
  }
59
-
60
  }
 
61
  /** Create a new rewrite rule for change to wp-admin url */
 
62
  function init_pwa_admin_rewrite_rules() {
63
  $getPwaOptions=get_pwa_setting_options();
64
  if(isset($getPwaOptions['pwa_active']) && ''!=$getPwaOptions['pwa_rewrite_text']){
@@ -69,25 +68,36 @@ function init_pwa_admin_rewrite_rules() {
69
 
70
  }
71
  }
72
-
73
  /**
74
  * Update Login, Register & Forgot password link as per new admin url
75
  * */
76
- add_action('login_head','csbwfs_custom_script');
 
 
 
 
 
 
 
77
  function csbwfs_custom_script()
78
- {
79
  $getPwaOptions=get_pwa_setting_options();
80
  if(isset($getPwaOptions['pwa_active']) && ''!=$getPwaOptions['pwa_rewrite_text']){
 
81
  echo '<script>jQuery(window).load(function(){
82
  jQuery("#login #login_error a").attr("href","'.home_url($getPwaOptions["pwa_rewrite_text"].'/lostpassword').'");
 
83
  var formId= jQuery("#login form").attr("id");
84
  if(formId=="loginform"){
85
  jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"]).'");
86
  }else if("lostpasswordform"==formId){
87
  jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"].'/lostpassword').'");
 
88
  }else if("registerform"==formId){
89
  jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"].'/register').'");
90
- }else
 
91
  {
92
  //silent
93
  }
@@ -101,7 +111,9 @@ jQuery("#nav a").each(function(){
101
  }
102
 
103
  }
 
104
 
 
105
  function pwa_admin_url_redirect_conditions()
106
  {
107
  $getPwaOptions=get_pwa_setting_options();
@@ -119,7 +131,35 @@ function pwa_admin_url_redirect_conditions()
119
  //print_r($pwaActualURLAry); echo $newUrl[0];exit;
120
  if(! is_user_logged_in() && in_array($newUrl[0],$pwaActualURLAry) )
121
  {
122
- wp_redirect(home_url('/'),301);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  //exit;
124
  }
125
  else if(isset($getPwaOptions['pwa_restrict']) && $getPwaOptions['pwa_restrict']==1 && is_user_logged_in())
@@ -150,7 +190,7 @@ wp_redirect(home_url('/'),301);
150
  //silent is gold
151
  }else
152
  {
153
- wp_redirect(home_url('/'));
154
  }
155
  }else
156
  {
@@ -158,8 +198,9 @@ wp_redirect(home_url('/'),301);
158
  }
159
 
160
  }
161
-
162
  /** Get the current url*/
 
163
  function pwa_current_path_protocol($s, $use_forwarded_host=false)
164
  {
165
  $pwahttp = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on') ? true:false;
@@ -171,15 +212,15 @@ function pwa_current_path_protocol($s, $use_forwarded_host=false)
171
  $host = isset($host) ? $host : $s['SERVER_NAME'] . $port;
172
  return $pwa_protocol . '://' . $host;
173
  }
 
 
174
  function pwa_get_current_page_url($s, $use_forwarded_host=false)
175
  {
176
  return pwa_current_path_protocol($s, $use_forwarded_host) . $s['REQUEST_URI'];
177
  }
178
-
179
-
180
- //if(isset($getPwaOptions['pwa_logo_path'])):
181
-
182
  /* Change Wordpress Default Logo */
 
183
  function pwa_update_login_page_logo() {
184
  $getPwaOptions=get_pwa_setting_options();
185
 
@@ -194,5 +235,5 @@ $getPwaOptions=get_pwa_setting_options();
194
  echo '</style>';
195
 
196
  }
197
- add_action('login_head', 'pwa_update_login_page_logo');
198
  ?>
6
  * */
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() {
13
  global $wpdb;
14
  $pwaOptions = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE 'pwa_%'");
16
  foreach ($pwaOptions as $option) {
17
  $pwaOptions[$option->option_name] = $option->option_value;
18
  }
 
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
+ {
33
+ add_action('admin_init', 'pwa_logout_user_after_settings_save');
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
  {
40
  $getPwaOptions=get_pwa_setting_options();
54
  }
55
  //wp_redirect($URL);
56
  }
 
57
  }
58
+ endif;
59
  /** Create a new rewrite rule for change to wp-admin url */
60
+ if(!function_exists('init_pwa_admin_rewrite_rules')):
61
  function init_pwa_admin_rewrite_rules() {
62
  $getPwaOptions=get_pwa_setting_options();
63
  if(isset($getPwaOptions['pwa_active']) && ''!=$getPwaOptions['pwa_rewrite_text']){
68
 
69
  }
70
  }
71
+ 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']){
87
+
88
  echo '<script>jQuery(window).load(function(){
89
  jQuery("#login #login_error a").attr("href","'.home_url($getPwaOptions["pwa_rewrite_text"].'/lostpassword').'");
90
+ jQuery("body.login-action-resetpass p.reset-pass a").attr("href","'.home_url($getPwaOptions["pwa_rewrite_text"].'/').'");
91
  var formId= jQuery("#login form").attr("id");
92
  if(formId=="loginform"){
93
  jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"]).'");
94
  }else if("lostpasswordform"==formId){
95
  jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"].'/lostpassword').'");
96
+ jQuery("#"+formId+" input:hidden[name=redirect_to]").val("'.home_url($getPwaOptions["pwa_rewrite_text"].'/?checkemail=confirm').'");
97
  }else if("registerform"==formId){
98
  jQuery("#"+formId).attr("action","'.home_url($getPwaOptions["pwa_rewrite_text"].'/register').'");
99
+ }
100
+ else
101
  {
102
  //silent
103
  }
111
  }
112
 
113
  }
114
+ endif;
115
 
116
+ if(!function_exists('pwa_admin_url_redirect_conditions')):
117
  function pwa_admin_url_redirect_conditions()
118
  {
119
  $getPwaOptions=get_pwa_setting_options();
131
  //print_r($pwaActualURLAry); echo $newUrl[0];exit;
132
  if(! is_user_logged_in() && in_array($newUrl[0],$pwaActualURLAry) )
133
  {
134
+
135
+ /** is forgot password link */
136
+ if( isset($_GET['login']) && isset($_GET['action']) && $_GET['action']=='rp' && $_GET['login']!='')
137
+ {
138
+ $username = $_GET['login'];
139
+ if(username_exists($username))
140
+ {
141
+ //silent
142
+ }else{ wp_redirect(home_url('/'),301); //exit;
143
+ }
144
+ }elseif(isset($_GET['action']) && $_GET['action']=='rp')
145
+ {
146
+ //silent
147
+ }
148
+ elseif(isset($_GET['action']) && isset($_GET['error']) && $_GET['action']=='lostpassword' && $_GET['error']=='invalidkey')
149
+ {
150
+ $redirectUrl=home_url($getPwaOptions["pwa_rewrite_text"].'/?action=lostpassword&error=invalidkey');
151
+ wp_redirect($redirectUrl,301);//exit;
152
+ }
153
+ elseif(isset($_GET['action']) && $_GET['action']=='resetpass')
154
+ {
155
+ // silent
156
+ }
157
+ else{
158
+
159
+ wp_redirect(home_url('/'),301);//exit;
160
+ }
161
+
162
+
163
  //exit;
164
  }
165
  else if(isset($getPwaOptions['pwa_restrict']) && $getPwaOptions['pwa_restrict']==1 && is_user_logged_in())
190
  //silent is gold
191
  }else
192
  {
193
+ wp_redirect(home_url('/'));//exit;
194
  }
195
  }else
196
  {
198
  }
199
 
200
  }
201
+ endif;
202
  /** Get the current url*/
203
+ if(!function_exists('pwa_current_path_protocol')):
204
  function pwa_current_path_protocol($s, $use_forwarded_host=false)
205
  {
206
  $pwahttp = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on') ? true:false;
212
  $host = isset($host) ? $host : $s['SERVER_NAME'] . $port;
213
  return $pwa_protocol . '://' . $host;
214
  }
215
+ endif;
216
+ if(!function_exists('pwa_get_current_page_url')):
217
  function pwa_get_current_page_url($s, $use_forwarded_host=false)
218
  {
219
  return pwa_current_path_protocol($s, $use_forwarded_host) . $s['REQUEST_URI'];
220
  }
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
 
235
  echo '</style>';
236
 
237
  }
238
+ endif;
239
  ?>
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.3
6
- Tested up to: 4.3
7
- Stable tag: 1.6
8
 
9
  Protect Your Website Admin Against Hackers and Modify Login Page Style
10
 
@@ -38,6 +38,9 @@ It is extremely important to back up your database before beginning the activate
38
 
39
 
40
  == Installation ==
 
 
 
41
 
42
  * Step 1. Upload "protect-wp-admin" folder to the `/wp-content/plugins/` directory
43
  * Step 2. Activate the plugin through the Plugins menu in WordPress
@@ -52,7 +55,7 @@ It is extremely important to back up your database before beginning the activate
52
  * 2.Was not able to login after installation
53
 
54
  Basicaly issues can come only in case when you will use default permalink settings.
55
- If your permalink will be update to any other option except default then it will be work fine. Anyway Dont' worry,add code give below into your site .htaccess file.
56
 
57
  # BEGIN WordPress
58
  <IfModule mod_rewrite.c>
@@ -82,6 +85,11 @@ Don not forgot to update the "newadmin" slug with your new admin slug (that you
82
 
83
 
84
  == Changelog ==
 
 
 
 
 
85
  = 1.6 =
86
  * Fixed wp-login.php issue for www url
87
 
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.3
6
+ Tested up to: 4.3.1
7
+ Stable tag: 1.7
8
 
9
  Protect Your Website Admin Against Hackers and Modify Login Page Style
10
 
38
 
39
 
40
  == Installation ==
41
+ In most cases you can install automatically from WordPress.
42
+
43
+ However, if you install this manually, follow these steps:
44
 
45
  * Step 1. Upload "protect-wp-admin" folder to the `/wp-content/plugins/` directory
46
  * Step 2. Activate the plugin through the Plugins menu in WordPress
55
  * 2.Was not able to login after installation
56
 
57
  Basicaly issues can come only in case when you will use default permalink settings.
58
+ 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.
59
 
60
  # BEGIN WordPress
61
  <IfModule mod_rewrite.c>
85
 
86
 
87
  == Changelog ==
88
+
89
+ = 1.7 =
90
+ * Fixed forget password email issue
91
+ * Fixed forgot password link issue on login error page
92
+
93
  = 1.6 =
94
  * Fixed wp-login.php issue for www url
95