Page Restrict - Version 2.5.2

Version Description

  • Added code to use the filtered login form default value for "remember" checkbox allowing the checkbox to be suppressed by the login_form_defaults filter.
Download this release

Release Info

Developer theandystratton
Plugin Icon wp plugin Page Restrict
Version 2.5.2
Comparing to
See all releases

Code changes from version 2.5.1 to 2.5.2

Files changed (2) hide show
  1. pagerestrict.php +12 -5
  2. readme.txt +3 -0
pagerestrict.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://theandystratton.com/pagerestrict
5
  Description: Restrict certain pages to logged in users
6
  Author: Matt Martz & Andy Stratton
7
  Author URI: http://theandystratton.com
8
- Version: 2.5.1
9
 
10
  Page Restrict is released under the GNU Lesser General Public License (LGPL)
11
  http://www.gnu.org/licenses/lgpl-3.0.txt
@@ -60,6 +60,10 @@ function pr_get_page_content() {
60
  $user_login = \sanitize_user( $_GET['pr-user-login'] );
61
  }
62
 
 
 
 
 
63
  $pr_page_content .= '
64
  <form style="text-align: left;" action="' . \wp_login_url() . '" method="post">
65
  ' . $errors . '
@@ -68,9 +72,12 @@ function pr_get_page_content() {
68
  . \apply_filters( 'pr_username_label', 'Username' ) . '</label><br />
69
  <label for="pwd"><input type="password" name="pwd" id="pwd" size="22" /> '
70
  . \apply_filters( 'pr_password_label' , 'Password' ) . '</label><br />
71
- <input type="submit" name="submit" value="Log In" class="button" />
72
- <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label><br />
73
- </p>
 
 
 
74
  <input type="hidden" name="redirect_to" value="' . \esc_url( $_SERVER['REQUEST_URI'] ) . '" />
75
  </form>
76
  <p>
@@ -252,4 +259,4 @@ function pr_authenticate( $error, $user, $pass )
252
  \add_filter( 'wp_nav_menu_items', function( $values ){
253
  \add_filter( 'the_title' , 'pr_page_restrict_title' , 50 );
254
  return $values;
255
- });
5
  Description: Restrict certain pages to logged in users
6
  Author: Matt Martz & Andy Stratton
7
  Author URI: http://theandystratton.com
8
+ Version: 2.5.2
9
 
10
  Page Restrict is released under the GNU Lesser General Public License (LGPL)
11
  http://www.gnu.org/licenses/lgpl-3.0.txt
60
  $user_login = \sanitize_user( $_GET['pr-user-login'] );
61
  }
62
 
63
+ $remember = true;
64
+ $args = \apply_filters( 'login_form_defaults', [ 'remember' => true ] );
65
+ $remember_me = $args['remember'];
66
+
67
  $pr_page_content .= '
68
  <form style="text-align: left;" action="' . \wp_login_url() . '" method="post">
69
  ' . $errors . '
72
  . \apply_filters( 'pr_username_label', 'Username' ) . '</label><br />
73
  <label for="pwd"><input type="password" name="pwd" id="pwd" size="22" /> '
74
  . \apply_filters( 'pr_password_label' , 'Password' ) . '</label><br />
75
+ <input type="submit" name="submit" value="Log In" class="button" />'
76
+
77
+ .
78
+ ( $remember_me ? '<label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label><br />' : '' )
79
+
80
+ . '</p>
81
  <input type="hidden" name="redirect_to" value="' . \esc_url( $_SERVER['REQUEST_URI'] ) . '" />
82
  </form>
83
  <p>
259
  \add_filter( 'wp_nav_menu_items', function( $values ){
260
  \add_filter( 'the_title' , 'pr_page_restrict_title' , 50 );
261
  return $values;
262
+ });
readme.txt CHANGED
@@ -47,6 +47,9 @@ NOTE: See "Other Notes" for Upgrade and Usage Instructions as well as other pert
47
 
48
  == Changelog ==
49
 
 
 
 
50
  = 2.5.1 =
51
  * Added code to NOT affect the title of nav menu items. Should work on most installations.
52
 
47
 
48
  == Changelog ==
49
 
50
+ = 2.5.2 =
51
+ * Added code to use the filtered login form default value for "remember" checkbox allowing the checkbox to be suppressed by the `login_form_defaults` filter.
52
+
53
  = 2.5.1 =
54
  * Added code to NOT affect the title of nav menu items. Should work on most installations.
55