Version Description
- Fixed status code custom login page.
Download this release
Release Info
Developer | avryl |
Plugin | Rename wp-login.php |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.2
- readme.txt +2 -6
- rename-wp-login.php +32 -52
readme.txt
CHANGED
@@ -50,10 +50,6 @@ While you could use this plugin to prevent a lot of brute force attacks, it does
|
|
50 |
|
51 |
== Changelog ==
|
52 |
|
53 |
-
= 1.3 =
|
54 |
-
|
55 |
-
* Prevents the plugin from working when there is no permalink structure.
|
56 |
-
|
57 |
= 1.2 =
|
58 |
|
59 |
* Fixed status code custom login page.
|
@@ -68,6 +64,6 @@ While you could use this plugin to prevent a lot of brute force attacks, it does
|
|
68 |
|
69 |
== Upgrade Notice ==
|
70 |
|
71 |
-
= 1.
|
72 |
|
73 |
-
Always immediately update this plugin please!
|
50 |
|
51 |
== Changelog ==
|
52 |
|
|
|
|
|
|
|
|
|
53 |
= 1.2 =
|
54 |
|
55 |
* Fixed status code custom login page.
|
64 |
|
65 |
== Upgrade Notice ==
|
66 |
|
67 |
+
= 1.2 =
|
68 |
|
69 |
+
* Always immediately update this plugin please!
|
rename-wp-login.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/plugins/rename-wp-login/
|
|
5 |
Description: Change wp-login.php to whatever you want. It can also prevent a lot of brute force attacks.
|
6 |
Author: avryl
|
7 |
Author URI: http://profiles.wordpress.org/avryl/
|
8 |
-
Version: 1.
|
9 |
Text Domain: rename-wp-login
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -24,57 +24,6 @@ function rwl_activation() {
|
|
24 |
add_option('rwl_page', wp_unique_post_slug('login', 0, 'publish', 'page', 0));
|
25 |
}
|
26 |
|
27 |
-
add_action('admin_init', 'rwl_admin_init');
|
28 |
-
function rwl_admin_init() {
|
29 |
-
add_settings_section('rename-wp-login-section', 'Login', '__return_false', 'permalink');
|
30 |
-
add_settings_field('rwl-page', '<label for="rwl-page-input">Rename wp-login.php</label>', 'rwl_page', 'permalink', 'rename-wp-login-section');
|
31 |
-
add_settings_field('rwl-admin', '<label for="rwl-admin-input">Redirect wp-admin/ to new login page (not recommended)</label>', 'rwl_admin', 'permalink', 'rename-wp-login-section');
|
32 |
-
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
33 |
-
if (!empty($_POST['rwl_page'])) {
|
34 |
-
update_option('rwl_page', wp_unique_post_slug(sanitize_title_with_dashes($_POST['rwl_page']), 0, 'publish', 'page', 0));
|
35 |
-
}
|
36 |
-
update_option('rwl_admin', isset($_POST['rwl_admin']) ? $_POST['rwl_admin'] : '0');
|
37 |
-
}
|
38 |
-
if (get_option('rwl_redirect') == '1') {
|
39 |
-
delete_option('rwl_redirect');
|
40 |
-
wp_redirect(admin_url('options-permalink.php#rwl-page-input'));
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
function rwl_page() {
|
45 |
-
echo '<code>' . site_url() . '/</code> <input id="rwl-page-input" type="text" name="rwl_page" value="' . get_option('rwl_page') . '" /> <code>/</code>';
|
46 |
-
}
|
47 |
-
|
48 |
-
function rwl_admin() {
|
49 |
-
echo '<input id="rwl-admin-input" type="checkbox" name="rwl_admin" value="1" ' . checked(get_option('rwl_admin'), true, false) . ' />';
|
50 |
-
}
|
51 |
-
|
52 |
-
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'rwl_plugin_action_links');
|
53 |
-
function rwl_plugin_action_links($links) {
|
54 |
-
array_unshift($links, '<a href="options-permalink.php#rwl-page-input">Settings</a>');
|
55 |
-
return $links;
|
56 |
-
}
|
57 |
-
|
58 |
-
add_action('admin_notices', 'rwl_admin_notices');
|
59 |
-
function rwl_admin_notices() {
|
60 |
-
if (!get_option('permalink_structure')) {
|
61 |
-
?>
|
62 |
-
<div class="error">
|
63 |
-
<p><strong>Rename wp-login.php</strong> doesn't work if you’re using the default permalink structure.<br>You must choose another permalink structure for it to work.</p>
|
64 |
-
</div>
|
65 |
-
<?php
|
66 |
-
} elseif ($_GET['settings-updated'] == true) {
|
67 |
-
?>
|
68 |
-
<div class="updated">
|
69 |
-
<p>Your login page is now here: <a href="<?php echo site_url(); ?>/<?php echo get_option('rwl_page'); ?>/"><?php echo site_url(); ?>/<strong><?php echo get_option('rwl_page'); ?></strong>/</a>. Bookmark this page!</p>
|
70 |
-
</div>
|
71 |
-
<?php
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
if (!get_option('permalink_structure'))
|
76 |
-
return;
|
77 |
-
|
78 |
add_action('wp_loaded', 'rwl_wp_loaded');
|
79 |
function rwl_wp_loaded() {
|
80 |
if (is_admin() && !is_user_logged_in() && !defined('DOING_AJAX') && get_option('rwl_admin') != '1') {
|
@@ -126,6 +75,37 @@ function rwl_wp() {
|
|
126 |
}
|
127 |
}
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
add_filter('site_url', 'rwl_filter_site_url', 10, 4);
|
130 |
function rwl_filter_site_url($url, $path, $scheme, $blog_id) {
|
131 |
return (strpos($path, 'wp-login.php') !== false && $scheme == 'login_post') ? site_url() . '/' . get_option('rwl_page') . '/' . str_replace('wp-login.php', '', $path) : $url;
|
5 |
Description: Change wp-login.php to whatever you want. It can also prevent a lot of brute force attacks.
|
6 |
Author: avryl
|
7 |
Author URI: http://profiles.wordpress.org/avryl/
|
8 |
+
Version: 1.2
|
9 |
Text Domain: rename-wp-login
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
24 |
add_option('rwl_page', wp_unique_post_slug('login', 0, 'publish', 'page', 0));
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
add_action('wp_loaded', 'rwl_wp_loaded');
|
28 |
function rwl_wp_loaded() {
|
29 |
if (is_admin() && !is_user_logged_in() && !defined('DOING_AJAX') && get_option('rwl_admin') != '1') {
|
75 |
}
|
76 |
}
|
77 |
|
78 |
+
add_action('admin_init', 'rwl_admin_init');
|
79 |
+
function rwl_admin_init() {
|
80 |
+
add_settings_section('rename-wp-login-section', 'Login', '__return_false', 'permalink');
|
81 |
+
add_settings_field('rwl-page', '<label for="rwl-page-input">Rename wp-login.php</label>', 'rwl_page', 'permalink', 'rename-wp-login-section');
|
82 |
+
add_settings_field('rwl-admin', '<label for="rwl-admin-input">Redirect wp-admin/ to new login page (not recommended)</label>', 'rwl_admin', 'permalink', 'rename-wp-login-section');
|
83 |
+
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
84 |
+
if (!empty($_POST['rwl_page'])) {
|
85 |
+
update_option('rwl_page', wp_unique_post_slug($_POST['rwl_page'], 0, 'publish', 'page', 0));
|
86 |
+
}
|
87 |
+
update_option('rwl_admin', isset($_POST['rwl_admin']) ? $_POST['rwl_admin'] : '0');
|
88 |
+
}
|
89 |
+
if (get_option('rwl_redirect') == '1') {
|
90 |
+
delete_option('rwl_redirect');
|
91 |
+
wp_redirect(admin_url('options-permalink.php#rwl-page-input'));
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
function rwl_page() {
|
96 |
+
echo '<code>' . site_url() . '/</code> <input id="rwl-page-input" type="text" name="rwl_page" value="' . get_option('rwl_page') . '" /> <code>/</code>';
|
97 |
+
}
|
98 |
+
|
99 |
+
function rwl_admin() {
|
100 |
+
echo '<input id="rwl-admin-input" type="checkbox" name="rwl_admin" value="1" ' . checked(get_option('rwl_admin'), true, false) . ' />';
|
101 |
+
}
|
102 |
+
|
103 |
+
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'rwl_plugin_action_links');
|
104 |
+
function rwl_plugin_action_links($links) {
|
105 |
+
array_unshift($links, '<a href="options-permalink.php#rwl-page-input">Settings</a>');
|
106 |
+
return $links;
|
107 |
+
}
|
108 |
+
|
109 |
add_filter('site_url', 'rwl_filter_site_url', 10, 4);
|
110 |
function rwl_filter_site_url($url, $path, $scheme, $blog_id) {
|
111 |
return (strpos($path, 'wp-login.php') !== false && $scheme == 'login_post') ? site_url() . '/' . get_option('rwl_page') . '/' . str_replace('wp-login.php', '', $path) : $url;
|