Version Description
Download this release
Release Info
Developer | jfarthing84 |
Plugin | Theme My Login |
Version | 2.2 |
Comparing to | |
See all releases |
Code changes from version 2.1 to 2.2
- includes/admin-page.php +30 -118
- includes/profile-actions.php +0 -33
- includes/profile-form.php +0 -164
- includes/wp-login-actions.php +28 -40
- includes/wp-login-forms.php +38 -47
- includes/wp-login-functions.php +16 -12
- readme.txt +8 -48
- theme-my-login.css +15 -0
- theme-my-login.php +62 -123
includes/admin-page.php
CHANGED
@@ -1,181 +1,93 @@
|
|
1 |
<?php
|
2 |
|
3 |
if ( $_POST ) {
|
4 |
-
if ( !current_user_can('manage_options') )
|
5 |
-
die( __('Cheatin’ huh?') );
|
6 |
|
7 |
-
check_admin_referer('
|
8 |
-
|
9 |
-
$
|
10 |
-
$this->SetOption('chk_uninstall', $chk_uninstall);
|
11 |
-
$this->SetOption('subscr_login_redirect', stripslashes($_POST['subscr_login_redirect']));
|
12 |
-
$this->SetOption('contrb_login_redirect', stripslashes($_POST['contrb_login_redirect']));
|
13 |
-
$this->SetOption('author_login_redirect', stripslashes($_POST['author_login_redirect']));
|
14 |
-
$this->SetOption('editor_login_redirect', stripslashes($_POST['editor_login_redirect']));
|
15 |
-
$this->SetOption('admin_login_redirect', stripslashes($_POST['admin_login_redirect']));
|
16 |
-
$this->SetOption('logout_redirect', stripslashes($_POST['logout_redirect']));
|
17 |
-
$this->SetOption('theme_profile', $theme_profile);
|
18 |
$this->SetOption('login_title', stripslashes($_POST['login_title']));
|
19 |
-
$this->SetOption('login_text', stripslashes($_POST['login_text']));
|
20 |
$this->SetOption('register_title', stripslashes($_POST['register_title']));
|
21 |
-
$this->SetOption('register_text', stripslashes($_POST['register_text']));
|
22 |
$this->SetOption('register_msg', stripslashes($_POST['register_msg']));
|
|
|
23 |
$this->SetOption('password_title', stripslashes($_POST['password_title']));
|
24 |
-
$this->SetOption('
|
25 |
-
$this->SetOption('profile_title', stripslashes($_POST['profile_title']));
|
26 |
-
$this->SetOption('profile_text', stripslashes($_POST['profile_text']));
|
27 |
$this->SaveOptions();
|
28 |
|
29 |
-
if ($
|
30 |
-
$success =
|
31 |
else
|
32 |
-
$success =
|
33 |
}
|
|
|
34 |
?>
|
35 |
|
36 |
<div class="updated" style="background:aliceblue; border:1px solid lightblue">
|
37 |
-
<p><?php _e('If you like this plugin, please help keep it up to date by <a href="
|
38 |
</div>
|
39 |
|
40 |
<div class="wrap">
|
41 |
<?php if ( isset($success) && strlen($success) > 0 ) { ?>
|
42 |
<div id="message" class="updated fade">
|
43 |
-
<p><strong><?php
|
44 |
</div>
|
45 |
<?php } ?>
|
46 |
<div id="icon-options-general" class="icon32"><br /></div>
|
47 |
-
<h2><?php _e('Theme My Login Settings'); ?></h2>
|
48 |
|
49 |
<form action="" method="post" id="tml-settings">
|
50 |
-
<?php if ( function_exists('wp_nonce_field') ) wp_nonce_field('
|
51 |
-
|
52 |
-
|
53 |
-
<th scope="row"><label for="chk_uninstall"><?php _e('Complete Uninstall?'); ?></label></th>
|
54 |
-
<td>
|
55 |
-
<input name="chk_uninstall" type="checkbox" id="chk_uninstall" value="1" <?php if ($this->GetOption('chk_uninstall')) { echo 'checked="checked"'; } ?> />
|
56 |
-
<span class="setting-description"><?php _e('Check here and then disable plugin to completely uninstall.'); ?></span>
|
57 |
-
</td>
|
58 |
-
</tr>
|
59 |
-
</table>
|
60 |
-
<h3><?php _e('Redirection Settings'); ?></h3>
|
61 |
<table class="form-table">
|
62 |
<tr valign="top">
|
63 |
-
<th scope="row"><label for="
|
64 |
-
<td>
|
65 |
-
<input name="subscr_login_redirect" type="text" id="subscr_login_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('subscr_login_redirect') ) ); ?>" class="regular-text" size="100" />
|
66 |
-
<span class="setting-description"><?php _e('Must be an absolute URL.'); ?></span>
|
67 |
-
</td>
|
68 |
-
</tr>
|
69 |
-
<tr valign="top">
|
70 |
-
<th scope="row"><label for="contrb_login_redirect"><?php _e('Contributor Login Redirect'); ?></label></th>
|
71 |
-
<td>
|
72 |
-
<input name="contrb_login_redirect" type="text" id="contrb_login_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('contrb_login_redirect') ) ); ?>" class="regular-text" size="75" />
|
73 |
-
<span class="setting-description"><?php _e('Must be an absolute URL.'); ?></span>
|
74 |
-
</td>
|
75 |
-
</tr>
|
76 |
-
<tr valign="top">
|
77 |
-
<th scope="row"><label for="login_redirect"><?php _e('Author Login Redirect'); ?></label></th>
|
78 |
-
<td>
|
79 |
-
<input name="author_login_redirect" type="text" id="author_login_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('author_login_redirect') ) ); ?>" class="regular-text" size="75" />
|
80 |
-
<span class="setting-description"><?php _e('Must be an absolute URL.'); ?></span>
|
81 |
-
</td>
|
82 |
-
</tr>
|
83 |
-
<tr valign="top">
|
84 |
-
<th scope="row"><label for="editor_login_redirect"><?php _e('Editor Login Redirect'); ?></label></th>
|
85 |
-
<td>
|
86 |
-
<input name="editor_login_redirect" type="text" id="editor_login_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('editor_login_redirect') ) ); ?>" class="regular-text" size="75" />
|
87 |
-
<span class="setting-description"><?php _e('Must be an absolute URL.'); ?></span>
|
88 |
-
</td>
|
89 |
-
</tr>
|
90 |
-
<tr valign="top">
|
91 |
-
<th scope="row"><label for="admin_login_redirect"><?php _e('Administrator Login Redirect'); ?></label></th>
|
92 |
-
<td>
|
93 |
-
<input name="admin_login_redirect" type="text" id="admin_login_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('admin_login_redirect') ) ); ?>" class="regular-text" size="75" />
|
94 |
-
<span class="setting-description"><?php _e('Must be an absolute URL.'); ?></span>
|
95 |
-
</td>
|
96 |
-
</tr>
|
97 |
-
<tr valign="top">
|
98 |
-
<th scope="row"><label for="logout_redirect"><?php _e('Redirect on Logout'); ?></label></th>
|
99 |
<td>
|
100 |
-
<input name="
|
101 |
-
|
102 |
</td>
|
103 |
</tr>
|
104 |
</table>
|
105 |
|
106 |
-
<h3><?php _e('Template Settings'); ?></h3>
|
107 |
<table class="form-table">
|
108 |
<tr valign="top">
|
109 |
-
<th scope="row"><label for="
|
110 |
-
<td>
|
111 |
-
<input name="theme_profile" type="checkbox" id="theme_profile" value="1" <?php if ($this->GetOption('theme_profile')) { echo 'checked="checked"'; } ?> />
|
112 |
-
<span class="setting-description"><?php _e('Check here to theme subscriber\'s profile. This is known to cause issues with plugins that have a user administration menu.'); ?></span>
|
113 |
-
</td>
|
114 |
-
</tr>
|
115 |
-
<tr valign="top">
|
116 |
-
<th scope="row"><label for="register_title"><?php _e('Register Page Title'); ?></label></th>
|
117 |
<td>
|
118 |
<input name="register_title" type="text" id="register_title" value="<?php echo( htmlspecialchars ( $this->GetOption('register_title') ) ); ?>" class="regular-text" />
|
119 |
-
<span class="setting-description">You can use %blogname% for your blog name.'</span>
|
120 |
-
</td>
|
121 |
-
</tr>
|
122 |
-
<tr valign="top">
|
123 |
-
<th scope="row"><label for="register_text"><?php _e('Register Text'); ?></label></th>
|
124 |
-
<td>
|
125 |
-
<input name="register_text" type="text" id="register_text" value="<?php echo( htmlspecialchars ( $this->GetOption('register_text') ) ); ?>" class="regular-text" />
|
126 |
-
<span class="setting-description"><?php _e('This will appear above the registration form.'); ?></span>
|
127 |
</td>
|
128 |
</tr>
|
129 |
<tr valign="top">
|
130 |
-
<th scope="row"><label for="register_msg"><?php _e('Register Message'); ?></label></th>
|
131 |
<td>
|
132 |
<input name="register_msg" type="text" id="register_msg" value="<?php echo( htmlspecialchars ( $this->GetOption('register_msg') ) ); ?>" class="regular-text" />
|
133 |
-
<span class="setting-description"><?php _e('This will appear below the registration form.'); ?></span>
|
134 |
</td>
|
135 |
</tr>
|
136 |
<tr valign="top">
|
137 |
-
<th scope="row"><label for="
|
138 |
<td>
|
139 |
-
<input name="
|
140 |
-
<span class="setting-description">You can use %blogname% for your blog name.'</span>
|
141 |
</td>
|
142 |
</tr>
|
143 |
<tr valign="top">
|
144 |
-
<th scope="row"><label for="
|
145 |
<td>
|
146 |
-
<input name="
|
147 |
-
<span class="setting-description"><?php _e('This will appear above the login form.'); ?></span>
|
148 |
</td>
|
149 |
</tr>
|
150 |
<tr valign="top">
|
151 |
-
<th scope="row"><label for="password_title"><?php _e('Lost Password
|
152 |
<td>
|
153 |
<input name="password_title" type="text" id="password_title" value="<?php echo( htmlspecialchars ( $this->GetOption('password_title') ) ); ?>" class="regular-text" />
|
154 |
-
<span class="setting-description">You can use %blogname% for your blog name.'</span>
|
155 |
-
</td>
|
156 |
-
</tr>
|
157 |
-
<tr valign="top">
|
158 |
-
<th scope="row"><label for="password_text"><?php _e('Lost Password Text'); ?></label></th>
|
159 |
-
<td>
|
160 |
-
<input name="password_text" type="text" id="password_text" value="<?php echo( htmlspecialchars ( $this->GetOption('password_text') ) ); ?>" class="regular-text" />
|
161 |
-
<span class="setting-description"><?php _e('This will appear above the lost password form.'); ?></span>
|
162 |
-
</td>
|
163 |
-
</tr>
|
164 |
-
<tr valign="top">
|
165 |
-
<th scope="row"><label for="profile_title"><?php _e('Profile Page Title'); ?></label></th>
|
166 |
-
<td>
|
167 |
-
<input name="profile_title" type="text" id="profile_title" value="<?php echo( htmlspecialchars ( $this->GetOption('profile_title') ) ); ?>" class="regular-text" />
|
168 |
-
<span class="setting-description">You can use %blogname% for your blog name.'</span>
|
169 |
</td>
|
170 |
</tr>
|
171 |
<tr valign="top">
|
172 |
-
<th scope="row"><label for="
|
173 |
<td>
|
174 |
-
<input name="
|
175 |
-
<span class="setting-description"><?php _e('This will appear above the users profile.'); ?></span>
|
176 |
</td>
|
177 |
</tr>
|
178 |
</table>
|
179 |
-
|
|
|
180 |
</form>
|
181 |
</div>
|
1 |
<?php
|
2 |
|
3 |
if ( $_POST ) {
|
|
|
|
|
4 |
|
5 |
+
check_admin_referer('theme-my-login');
|
6 |
+
|
7 |
+
$this->SetOption('uninstall', $_POST['uninstall']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
$this->SetOption('login_title', stripslashes($_POST['login_title']));
|
|
|
9 |
$this->SetOption('register_title', stripslashes($_POST['register_title']));
|
|
|
10 |
$this->SetOption('register_msg', stripslashes($_POST['register_msg']));
|
11 |
+
$this->SetOption('register_complete', stripslashes($_POST['register_complete']));
|
12 |
$this->SetOption('password_title', stripslashes($_POST['password_title']));
|
13 |
+
$this->SetOption('password_msg', stripslashes($_POST['password_msg']));
|
|
|
|
|
14 |
$this->SaveOptions();
|
15 |
|
16 |
+
if (isset($_POST['uninstall']))
|
17 |
+
$success = __('To complete uninstall, deactivate this plugin. If you do not wish to uninstall, please uncheck the "Complete Uninstall" checkbox.', 'theme-my-login');
|
18 |
else
|
19 |
+
$success =__('Settings saved.', 'theme-my-login');
|
20 |
}
|
21 |
+
|
22 |
?>
|
23 |
|
24 |
<div class="updated" style="background:aliceblue; border:1px solid lightblue">
|
25 |
+
<p><?php _e('If you like this plugin, please help keep it up to date by <a href="http://www.jfarthing.com/donate">donating through PayPal</a>!', 'theme-my-login'); ?></p>
|
26 |
</div>
|
27 |
|
28 |
<div class="wrap">
|
29 |
<?php if ( isset($success) && strlen($success) > 0 ) { ?>
|
30 |
<div id="message" class="updated fade">
|
31 |
+
<p><strong><?php echo $success; ?></strong></p>
|
32 |
</div>
|
33 |
<?php } ?>
|
34 |
<div id="icon-options-general" class="icon32"><br /></div>
|
35 |
+
<h2><?php _e('Theme My Login Settings', 'theme-my-login'); ?></h2>
|
36 |
|
37 |
<form action="" method="post" id="tml-settings">
|
38 |
+
<?php if ( function_exists('wp_nonce_field') ) wp_nonce_field('theme-my-login'); ?>
|
39 |
+
|
40 |
+
<h3><?php _e('General Settings', 'theme-my-login'); ?></h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
<table class="form-table">
|
42 |
<tr valign="top">
|
43 |
+
<th scope="row"><label for="uninstall"><?php _e('Plugin', 'theme-my-login'); ?></label></th>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
<td>
|
45 |
+
<input name="uninstall" type="checkbox" id="uninstall" value="1" <?php if ($this->GetOption('uninstall')) { echo 'checked="checked"'; } ?> />
|
46 |
+
<?php _e('Uninstall', 'theme-my-login'); ?>
|
47 |
</td>
|
48 |
</tr>
|
49 |
</table>
|
50 |
|
51 |
+
<h3><?php _e('Template Settings', 'theme-my-login'); ?></h3>
|
52 |
<table class="form-table">
|
53 |
<tr valign="top">
|
54 |
+
<th scope="row"><label for="register_title"><?php _e('Register Title', 'theme-my-login'); ?></label></th>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
<td>
|
56 |
<input name="register_title" type="text" id="register_title" value="<?php echo( htmlspecialchars ( $this->GetOption('register_title') ) ); ?>" class="regular-text" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
</td>
|
58 |
</tr>
|
59 |
<tr valign="top">
|
60 |
+
<th scope="row"><label for="register_msg"><?php _e('Register Message', 'theme-my-login'); ?></label></th>
|
61 |
<td>
|
62 |
<input name="register_msg" type="text" id="register_msg" value="<?php echo( htmlspecialchars ( $this->GetOption('register_msg') ) ); ?>" class="regular-text" />
|
|
|
63 |
</td>
|
64 |
</tr>
|
65 |
<tr valign="top">
|
66 |
+
<th scope="row"><label for="register_complete"><?php _e('Registration Complete Message', 'theme-my-login'); ?></label></th>
|
67 |
<td>
|
68 |
+
<input name="register_complete" type="text" id="register_complete" value="<?php echo( htmlspecialchars ( $this->GetOption('register_complete') ) ); ?>" class="regular-text" />
|
|
|
69 |
</td>
|
70 |
</tr>
|
71 |
<tr valign="top">
|
72 |
+
<th scope="row"><label for="login_title"><?php _e('Login Title', 'theme-my-login'); ?></label></th>
|
73 |
<td>
|
74 |
+
<input name="login_title" type="text" id="login_title" value="<?php echo( htmlspecialchars ( $this->GetOption('login_title') ) ); ?>" class="regular-text" />
|
|
|
75 |
</td>
|
76 |
</tr>
|
77 |
<tr valign="top">
|
78 |
+
<th scope="row"><label for="password_title"><?php _e('Lost Password Title', 'theme-my-login'); ?></label></th>
|
79 |
<td>
|
80 |
<input name="password_title" type="text" id="password_title" value="<?php echo( htmlspecialchars ( $this->GetOption('password_title') ) ); ?>" class="regular-text" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</td>
|
82 |
</tr>
|
83 |
<tr valign="top">
|
84 |
+
<th scope="row"><label for="password_msg"><?php _e('Lost Password Message', 'theme-my-login'); ?></label></th>
|
85 |
<td>
|
86 |
+
<input name="password_msg" type="text" id="password_msg" value="<?php echo( htmlspecialchars ( $this->GetOption('password_msg') ) ); ?>" class="regular-text" />
|
|
|
87 |
</td>
|
88 |
</tr>
|
89 |
</table>
|
90 |
+
|
91 |
+
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'theme-my-login'); ?>" />
|
92 |
</form>
|
93 |
</div>
|
includes/profile-actions.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-functions.php');
|
4 |
-
require_once (ABSPATH . '/wp-admin/includes/misc.php');
|
5 |
-
require_once (ABSPATH . '/wp-admin/includes/user.php');
|
6 |
-
require_once (ABSPATH . WPINC . '/registration.php');
|
7 |
-
|
8 |
-
if ( !isset($user_id) ) {
|
9 |
-
$current_user = wp_get_current_user();
|
10 |
-
$user_id = $current_user->ID;
|
11 |
-
}
|
12 |
-
|
13 |
-
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
14 |
-
|
15 |
-
switch ($action) {
|
16 |
-
case 'update':
|
17 |
-
check_admin_referer('update-user_' . $user_id);
|
18 |
-
|
19 |
-
if ( !current_user_can('edit_user', $user_id) )
|
20 |
-
wp_die(__('You do not have permission to edit this user.'));
|
21 |
-
|
22 |
-
do_action('personal_options_update');
|
23 |
-
|
24 |
-
$this->errors = edit_user($user_id);
|
25 |
-
|
26 |
-
if ( !is_wp_error( $this->errors ) ) {
|
27 |
-
$redirect = (admin_url('profile.php') . '?updated=true');
|
28 |
-
wp_redirect($redirect);
|
29 |
-
exit;
|
30 |
-
}
|
31 |
-
break;
|
32 |
-
} // end action switch
|
33 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/profile-form.php
DELETED
@@ -1,164 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-functions.php');
|
4 |
-
require_once (ABSPATH . '/wp-admin/includes/misc.php');
|
5 |
-
require_once (ABSPATH . '/wp-admin/includes/user.php');
|
6 |
-
|
7 |
-
if ( !isset($user_id) ) {
|
8 |
-
$current_user = wp_get_current_user();
|
9 |
-
$user_id = $current_user->ID;
|
10 |
-
}
|
11 |
-
|
12 |
-
wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
|
13 |
-
if (isset($wp_http_referer))
|
14 |
-
$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
|
15 |
-
$user_id = (int) $user_id;
|
16 |
-
|
17 |
-
global $profileuser;
|
18 |
-
$profileuser = get_user_to_edit($user_id);
|
19 |
-
|
20 |
-
if ( !current_user_can('edit_user', $user_id) )
|
21 |
-
wp_die(__('You do not have permission to edit this user.'));
|
22 |
-
|
23 |
-
login_header('', $this->errors);
|
24 |
-
|
25 |
-
if (isset($_GET['updated']) && $_GET['updated'] == true) {
|
26 |
-
echo '<p class="message">Your profile has been updated.</p>';
|
27 |
-
}
|
28 |
-
?>
|
29 |
-
|
30 |
-
<form name="profile" id="your-profile" action="<?php echo ssl_or_not($this->QueryURL().'profile=1') ?>" method="post">
|
31 |
-
<?php wp_nonce_field('update-user_' . $user_id) ?>
|
32 |
-
<?php if ( isset($wp_http_referer) ) : ?>
|
33 |
-
<input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" />
|
34 |
-
<?php endif; ?>
|
35 |
-
<p>
|
36 |
-
<input type="hidden" name="from" value="profile" />
|
37 |
-
<input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
|
38 |
-
</p>
|
39 |
-
|
40 |
-
<h3><?php _e('Name') ?></h3>
|
41 |
-
|
42 |
-
<table class="form-table">
|
43 |
-
<tr>
|
44 |
-
<th><label for="user_login"><?php _e('Username'); ?></label></th>
|
45 |
-
<td><input type="text" name="user_login" id="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" /> <?php _e('Your username cannot be changed'); ?></td>
|
46 |
-
</tr>
|
47 |
-
<tr>
|
48 |
-
<th><label for="first_name"><?php _e('First name') ?></label></th>
|
49 |
-
<td><input type="text" name="first_name" id="first_name" value="<?php echo $profileuser->first_name ?>" /></td>
|
50 |
-
</tr>
|
51 |
-
<tr>
|
52 |
-
<th><label for="last_name"><?php _e('Last name') ?></label></th>
|
53 |
-
<td><input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" /></td>
|
54 |
-
</tr>
|
55 |
-
<tr>
|
56 |
-
<th><label for="nickname"><?php _e('Nickname') ?></label></th>
|
57 |
-
<td><input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" /></td>
|
58 |
-
</tr>
|
59 |
-
<tr>
|
60 |
-
<th><label for="display_name"><?php _e('Display name publicly as') ?></label></th>
|
61 |
-
<td>
|
62 |
-
<select name="display_name" id="display_name">
|
63 |
-
<?php
|
64 |
-
$public_display = array();
|
65 |
-
$public_display['display_displayname'] = $profileuser->display_name;
|
66 |
-
$public_display['display_nickname'] = $profileuser->nickname;
|
67 |
-
$public_display['display_username'] = $profileuser->user_login;
|
68 |
-
$public_display['display_firstname'] = $profileuser->first_name;
|
69 |
-
$public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
|
70 |
-
$public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
|
71 |
-
$public_display = array_unique(array_filter(array_map('trim', $public_display)));
|
72 |
-
foreach($public_display as $id => $item) {
|
73 |
-
?>
|
74 |
-
<option id="<?php echo $id; ?>" value="<?php echo $item; ?>"><?php echo $item; ?></option>
|
75 |
-
<?php
|
76 |
-
}
|
77 |
-
?>
|
78 |
-
</select>
|
79 |
-
</td>
|
80 |
-
</tr>
|
81 |
-
</table>
|
82 |
-
|
83 |
-
<h3><?php _e('Contact Info') ?></h3>
|
84 |
-
|
85 |
-
<table class="form-table">
|
86 |
-
<tr>
|
87 |
-
<th><label for="email"><?php _e('E-mail') ?></label></th>
|
88 |
-
<td><input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" /> <?php _e('Required'); ?></td>
|
89 |
-
</tr>
|
90 |
-
|
91 |
-
<tr>
|
92 |
-
<th><label for="url"><?php _e('Website') ?></label></th>
|
93 |
-
<td><input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" /></td>
|
94 |
-
</tr>
|
95 |
-
|
96 |
-
<tr>
|
97 |
-
<th><label for="aim"><?php _e('AIM') ?></label></th>
|
98 |
-
<td><input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" /></td>
|
99 |
-
</tr>
|
100 |
-
|
101 |
-
<tr>
|
102 |
-
<th><label for="yim"><?php _e('Yahoo IM') ?></label></th>
|
103 |
-
<td><input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" /></td>
|
104 |
-
</tr>
|
105 |
-
|
106 |
-
<tr>
|
107 |
-
<th><label for="jabber"><?php _e('Jabber / Google Talk') ?></label></th>
|
108 |
-
<td><input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" /></td>
|
109 |
-
</tr>
|
110 |
-
</table>
|
111 |
-
|
112 |
-
<h3><?php _e('About Yourself'); ?></h3>
|
113 |
-
|
114 |
-
<table class="form-table">
|
115 |
-
<tr>
|
116 |
-
<th><label for="description"><?php _e('Biographical Info'); ?></label></th>
|
117 |
-
<td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea><br /><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?><br/><br/></td>
|
118 |
-
</tr>
|
119 |
-
|
120 |
-
<?php
|
121 |
-
$show_password_fields = apply_filters('show_password_fields', true);
|
122 |
-
if ( $show_password_fields ) :
|
123 |
-
?>
|
124 |
-
<tr>
|
125 |
-
<th><label for="pass1"><?php _e('New Password'); ?></label></th>
|
126 |
-
<td>
|
127 |
-
<input type="password" name="pass1" id="pass1" size="16" value="" /><br/><?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?><br />
|
128 |
-
<input type="password" name="pass2" id="pass2" size="16" value="" /><br/><?php _e("Type your new password again."); ?><br />
|
129 |
-
</td>
|
130 |
-
</tr>
|
131 |
-
<?php endif; ?>
|
132 |
-
</table>
|
133 |
-
|
134 |
-
<?php
|
135 |
-
do_action('profile_personal_options');
|
136 |
-
do_action('show_user_profile');
|
137 |
-
?>
|
138 |
-
|
139 |
-
<?php if (count($profileuser->caps) > count($profileuser->roles)): ?>
|
140 |
-
<br class="clear" />
|
141 |
-
<table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
|
142 |
-
<tr>
|
143 |
-
<th scope="row"><?php _e('Additional Capabilities') ?></th>
|
144 |
-
<td><?php
|
145 |
-
$output = '';
|
146 |
-
foreach($profileuser->caps as $cap => $value) {
|
147 |
-
if(!$wp_roles->is_role($cap)) {
|
148 |
-
if($output != '') $output .= ', ';
|
149 |
-
$output .= $value ? $cap : "Denied: {$cap}";
|
150 |
-
}
|
151 |
-
}
|
152 |
-
echo $output;
|
153 |
-
?></td>
|
154 |
-
</tr>
|
155 |
-
</table>
|
156 |
-
<?php endif; ?>
|
157 |
-
|
158 |
-
<p class="submit">
|
159 |
-
<input type="hidden" name="action" value="update" />
|
160 |
-
<input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
|
161 |
-
<input type="submit" id="submit" value="<?php _e('Update Profile') ?>" name="submit" />
|
162 |
-
</p>
|
163 |
-
</form>
|
164 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/wp-login-actions.php
CHANGED
@@ -15,15 +15,10 @@ if ( force_ssl_admin() && !is_ssl() ) {
|
|
15 |
}
|
16 |
|
17 |
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
18 |
-
$this->errors = new WP_Error();
|
19 |
|
20 |
if ( isset($_GET['key']) )
|
21 |
$action = 'resetpass';
|
22 |
|
23 |
-
nocache_headers();
|
24 |
-
|
25 |
-
header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
|
26 |
-
|
27 |
if ( defined('RELOCATE') ) { // Move flag is set
|
28 |
if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
|
29 |
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
|
@@ -44,14 +39,10 @@ case 'logout' :
|
|
44 |
if ($wp_version >= '2.6')
|
45 |
check_admin_referer('log-out');
|
46 |
wp_logout();
|
47 |
-
|
|
|
48 |
if ( isset( $_REQUEST['redirect_to'] ) )
|
49 |
$redirect_to = $_REQUEST['redirect_to'];
|
50 |
-
else
|
51 |
-
$redirect_to = $this->GetOption('logout_redirect');
|
52 |
-
|
53 |
-
if ( empty($redirect_to) )
|
54 |
-
$redirect_to = get_bloginfo('siteurl') . '/wp-login.php?loggedout=true';
|
55 |
|
56 |
wp_safe_redirect($redirect_to);
|
57 |
exit();
|
@@ -59,31 +50,31 @@ case 'logout' :
|
|
59 |
case 'lostpassword' :
|
60 |
case 'retrievepassword' :
|
61 |
if ( $http_post ) {
|
62 |
-
$
|
63 |
-
if ( !is_wp_error($
|
64 |
-
wp_redirect(
|
65 |
exit();
|
66 |
}
|
67 |
}
|
68 |
|
69 |
if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] )
|
70 |
-
$
|
71 |
break;
|
72 |
case 'resetpass' :
|
73 |
case 'rp' :
|
74 |
-
$
|
75 |
|
76 |
-
if ( ! is_wp_error($
|
77 |
-
wp_redirect(
|
78 |
exit();
|
79 |
}
|
80 |
|
81 |
-
wp_redirect(
|
82 |
exit();
|
83 |
break;
|
84 |
case 'register' :
|
85 |
if ( !get_option('users_can_register') ) {
|
86 |
-
wp_redirect(
|
87 |
exit();
|
88 |
}
|
89 |
|
@@ -92,10 +83,10 @@ case 'register' :
|
|
92 |
|
93 |
$user_login = $_POST['user_login'];
|
94 |
$user_email = $_POST['user_email'];
|
95 |
-
$
|
96 |
|
97 |
-
if ( !is_wp_error($
|
98 |
-
wp_redirect(
|
99 |
exit();
|
100 |
}
|
101 |
}
|
@@ -113,35 +104,32 @@ case 'login' :
|
|
113 |
}
|
114 |
}
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() )
|
118 |
$secure_cookie = false;
|
119 |
|
120 |
$user = wp_signon('', $secure_cookie);
|
|
|
|
|
121 |
|
122 |
if ( !is_wp_error($user) ) {
|
123 |
-
|
124 |
-
|
125 |
-
elseif ($user->has_cap('contributor'))
|
126 |
-
$redirect_to = $this->GetOption('contrb_login_redirect');
|
127 |
-
elseif ($user->has_cap('author'))
|
128 |
-
$redirect_to = $this->GetOption('author_login_redirect');
|
129 |
-
elseif ($user->has_cap('editor'))
|
130 |
-
$redirect_to = $this->GetOption('editor_login_redirect');
|
131 |
-
elseif ($user->has_cap('administrator'))
|
132 |
-
$redirect_to = $this->GetOption('admin_login_redirect');
|
133 |
-
|
134 |
-
if (empty($redirect_to))
|
135 |
-
$redirect_to = get_bloginfo('siteurl') . '/wp-admin';
|
136 |
-
|
137 |
-
if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
|
138 |
$redirect_to = admin_url('profile.php');
|
139 |
-
|
140 |
wp_safe_redirect($redirect_to);
|
141 |
exit();
|
142 |
}
|
143 |
|
144 |
-
$
|
145 |
break;
|
146 |
} // end action switch
|
147 |
?>
|
15 |
}
|
16 |
|
17 |
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
|
|
18 |
|
19 |
if ( isset($_GET['key']) )
|
20 |
$action = 'resetpass';
|
21 |
|
|
|
|
|
|
|
|
|
22 |
if ( defined('RELOCATE') ) { // Move flag is set
|
23 |
if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
|
24 |
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
|
39 |
if ($wp_version >= '2.6')
|
40 |
check_admin_referer('log-out');
|
41 |
wp_logout();
|
42 |
+
|
43 |
+
$redirect_to = site_url('wp-login.php?loggedout=true', 'login');
|
44 |
if ( isset( $_REQUEST['redirect_to'] ) )
|
45 |
$redirect_to = $_REQUEST['redirect_to'];
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
wp_safe_redirect($redirect_to);
|
48 |
exit();
|
50 |
case 'lostpassword' :
|
51 |
case 'retrievepassword' :
|
52 |
if ( $http_post ) {
|
53 |
+
$login_errors = retrieve_password();
|
54 |
+
if ( !is_wp_error($login_errors) ) {
|
55 |
+
wp_redirect(site_url('wp-login.php?checkemail=confirm', 'login'));
|
56 |
exit();
|
57 |
}
|
58 |
}
|
59 |
|
60 |
if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] )
|
61 |
+
$login_errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
|
62 |
break;
|
63 |
case 'resetpass' :
|
64 |
case 'rp' :
|
65 |
+
$login_errors = reset_password($_GET['key']);
|
66 |
|
67 |
+
if ( ! is_wp_error($login_errors) ) {
|
68 |
+
wp_redirect(site_url('wp-login.php?checkemail=newpass', 'login'));
|
69 |
exit();
|
70 |
}
|
71 |
|
72 |
+
wp_redirect(site_url('wp-login.php?action=lostpassword&error=invalidkey', 'login'));
|
73 |
exit();
|
74 |
break;
|
75 |
case 'register' :
|
76 |
if ( !get_option('users_can_register') ) {
|
77 |
+
wp_redirect(site_url('wp-login.php?registration=disabled', 'login'));
|
78 |
exit();
|
79 |
}
|
80 |
|
83 |
|
84 |
$user_login = $_POST['user_login'];
|
85 |
$user_email = $_POST['user_email'];
|
86 |
+
$login_errors = register_new_user($user_login, $user_email);
|
87 |
|
88 |
+
if ( !is_wp_error($login_errors) ) {
|
89 |
+
wp_redirect(site_url('wp-login.php?checkemail=registered', 'login'));
|
90 |
exit();
|
91 |
}
|
92 |
}
|
104 |
}
|
105 |
}
|
106 |
}
|
107 |
+
|
108 |
+
if ( isset( $_REQUEST['redirect_to'] ) ) {
|
109 |
+
$redirect_to = $_REQUEST['redirect_to'];
|
110 |
+
// Redirect to https if user wants ssl
|
111 |
+
if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
|
112 |
+
$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
113 |
+
} else {
|
114 |
+
$redirect_to = admin_url();
|
115 |
+
}
|
116 |
|
117 |
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() )
|
118 |
$secure_cookie = false;
|
119 |
|
120 |
$user = wp_signon('', $secure_cookie);
|
121 |
+
|
122 |
+
$redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
|
123 |
|
124 |
if ( !is_wp_error($user) ) {
|
125 |
+
// If the user can't edit posts, send them to their profile.
|
126 |
+
if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
$redirect_to = admin_url('profile.php');
|
|
|
128 |
wp_safe_redirect($redirect_to);
|
129 |
exit();
|
130 |
}
|
131 |
|
132 |
+
$login_errors = $user;
|
133 |
break;
|
134 |
} // end action switch
|
135 |
?>
|
includes/wp-login-forms.php
CHANGED
@@ -10,113 +10,104 @@ switch ($action) :
|
|
10 |
case 'lostpassword' :
|
11 |
case 'retrievepassword' :
|
12 |
do_action('lost_password');
|
13 |
-
login_header('<p class="message">' .
|
14 |
|
15 |
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
16 |
?>
|
17 |
|
18 |
-
<form name="lostpasswordform" id="lostpasswordform" action="<?php echo
|
19 |
<p>
|
20 |
-
<label><?php _e('Username or E-mail:') ?><br />
|
21 |
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
|
22 |
</p>
|
23 |
<?php do_action('lostpassword_form'); ?>
|
24 |
-
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Get New Password'); ?>" tabindex="100" /></p>
|
25 |
</form>
|
26 |
|
27 |
-
<ul class="nav">
|
28 |
-
<li><a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></a></li>
|
29 |
-
<?php if (get_option('users_can_register')) : ?>
|
30 |
-
<li><a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></a></li>
|
31 |
-
<?php endif; ?>
|
32 |
-
</ul>
|
33 |
-
|
34 |
-
</div>
|
35 |
-
|
36 |
<?php
|
|
|
37 |
break;
|
38 |
|
39 |
case 'register' :
|
40 |
$user_login = isset($_POST['user_login']) ? $_POST['user_login'] : '';
|
41 |
$user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
|
42 |
-
login_header('', $
|
43 |
?>
|
44 |
|
45 |
-
<form name="registerform" id="registerform" action="<?php echo
|
46 |
<p>
|
47 |
-
<label><?php _e('Username') ?><br />
|
48 |
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
|
49 |
</p>
|
50 |
<p>
|
51 |
-
<label><?php _e('E-mail') ?><br />
|
52 |
<input type="text" name="user_email" id="user_email" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
|
53 |
</p>
|
54 |
<?php do_action('register_form'); ?>
|
55 |
<p id="reg_passmail"><?php _e($this->GetOption('register_msg')) ?></p>
|
56 |
-
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Register'); ?>" tabindex="100" /></p>
|
57 |
</form>
|
58 |
|
59 |
-
<ul class="nav">
|
60 |
-
<li><a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></a></li>
|
61 |
-
<li><a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>
|
62 |
-
</ul>
|
63 |
-
|
64 |
-
</div>
|
65 |
<?php
|
|
|
66 |
break;
|
67 |
|
68 |
case 'login' :
|
69 |
default :
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
// Clear errors if loggedout is set.
|
72 |
if ( !empty($_GET['loggedout']) )
|
73 |
-
$
|
74 |
|
75 |
// If cookies are disabled we can't log in even with a valid user+pass
|
76 |
if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
|
77 |
-
$
|
78 |
|
79 |
// Some parts of this script use the main login form to display a message
|
80 |
-
if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] ) $
|
81 |
-
elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $
|
82 |
-
elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) $
|
83 |
-
elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) $
|
84 |
-
elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) $
|
85 |
|
86 |
-
login_header('', $
|
87 |
|
88 |
if ( isset($_POST['log']) )
|
89 |
-
$user_login = ( 'incorrect_password' == $
|
90 |
?>
|
91 |
<?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
|
92 |
-
<form name="loginform" id="loginform" action="<?php echo
|
93 |
<p>
|
94 |
-
<label><?php _e('Username') ?><br />
|
95 |
<input type="text" name="log" id="user_login" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20" tabindex="10" /></label>
|
96 |
</p>
|
97 |
<p>
|
98 |
-
<label><?php _e('Password') ?><br />
|
99 |
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
|
100 |
</p>
|
101 |
<?php do_action('login_form'); ?>
|
102 |
-
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember Me'); ?></label></p>
|
103 |
<p class="submit">
|
104 |
-
<input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
|
|
|
105 |
<input type="hidden" name="testcookie" value="1" />
|
106 |
</p>
|
107 |
</form>
|
108 |
<?php endif; ?>
|
109 |
|
110 |
-
<ul class="nav">
|
111 |
-
<?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
|
112 |
-
<?php elseif (get_option('users_can_register')) : ?>
|
113 |
-
<li><a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></a></li>
|
114 |
-
<?php endif; ?>
|
115 |
-
<li><a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>
|
116 |
-
</ul>
|
117 |
-
|
118 |
-
</div>
|
119 |
<?php
|
|
|
120 |
break;
|
121 |
|
122 |
endswitch;
|
10 |
case 'lostpassword' :
|
11 |
case 'retrievepassword' :
|
12 |
do_action('lost_password');
|
13 |
+
login_header('<p class="message">' . $this->GetOption('password_msg') . '</p>', $login_errors);
|
14 |
|
15 |
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
16 |
?>
|
17 |
|
18 |
+
<form name="lostpasswordform" id="lostpasswordform" action="<?php echo add_query_arg('action', 'lostpassword', $this->permalink) ?>" method="post">
|
19 |
<p>
|
20 |
+
<label><?php _e('Username or E-mail:', 'theme-my-login') ?><br />
|
21 |
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
|
22 |
</p>
|
23 |
<?php do_action('lostpassword_form'); ?>
|
24 |
+
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Get New Password', 'theme-my-login'); ?>" tabindex="100" /></p>
|
25 |
</form>
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
<?php
|
28 |
+
login_footer();
|
29 |
break;
|
30 |
|
31 |
case 'register' :
|
32 |
$user_login = isset($_POST['user_login']) ? $_POST['user_login'] : '';
|
33 |
$user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
|
34 |
+
login_header('', $login_errors);
|
35 |
?>
|
36 |
|
37 |
+
<form name="registerform" id="registerform" action="<?php echo add_query_arg('action', 'register', $this->permalink) ?>" method="post">
|
38 |
<p>
|
39 |
+
<label><?php _e('Username', 'theme-my-login') ?><br />
|
40 |
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
|
41 |
</p>
|
42 |
<p>
|
43 |
+
<label><?php _e('E-mail', 'theme-my-login') ?><br />
|
44 |
<input type="text" name="user_email" id="user_email" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
|
45 |
</p>
|
46 |
<?php do_action('register_form'); ?>
|
47 |
<p id="reg_passmail"><?php _e($this->GetOption('register_msg')) ?></p>
|
48 |
+
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Register', 'theme-my-login'); ?>" tabindex="100" /></p>
|
49 |
</form>
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
<?php
|
52 |
+
login_footer();
|
53 |
break;
|
54 |
|
55 |
case 'login' :
|
56 |
default :
|
57 |
|
58 |
+
if ( isset( $_REQUEST['redirect_to'] ) ) {
|
59 |
+
$redirect_to = $_REQUEST['redirect_to'];
|
60 |
+
// Redirect to https if user wants ssl
|
61 |
+
if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
|
62 |
+
$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
63 |
+
} else {
|
64 |
+
$redirect_to = admin_url();
|
65 |
+
}
|
66 |
+
|
67 |
+
$redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
|
68 |
+
|
69 |
// Clear errors if loggedout is set.
|
70 |
if ( !empty($_GET['loggedout']) )
|
71 |
+
$login_errors = new WP_Error();
|
72 |
|
73 |
// If cookies are disabled we can't log in even with a valid user+pass
|
74 |
if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
|
75 |
+
$login_errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'theme-my-login'));
|
76 |
|
77 |
// Some parts of this script use the main login form to display a message
|
78 |
+
if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] ) $login_errors->add('loggedout', __('You are now logged out.', 'theme-my-login'), 'message');
|
79 |
+
elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $login_errors->add('registerdisabled', __('User registration is currently not allowed.', 'theme-my-login'));
|
80 |
+
elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) $login_errors->add('confirm', __('Check your e-mail for the confirmation link.', 'theme-my-login'), 'message');
|
81 |
+
elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) $login_errors->add('newpass', __('Check your e-mail for your new password.', 'theme-my-login'), 'message');
|
82 |
+
elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) $login_errors->add('registered', __('Registration complete. Please check your e-mail.', 'theme-my-login'), 'message');
|
83 |
|
84 |
+
login_header('', $login_errors);
|
85 |
|
86 |
if ( isset($_POST['log']) )
|
87 |
+
$user_login = ( 'incorrect_password' == $login_errors->get_error_code() || 'empty_password' == $login_errors->get_error_code() ) ? attribute_escape(stripslashes($_POST['log'])) : '';
|
88 |
?>
|
89 |
<?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
|
90 |
+
<form name="loginform" id="loginform" action="<?php echo add_query_arg('action', 'login', $this->permalink) ?>" method="post">
|
91 |
<p>
|
92 |
+
<label><?php _e('Username', 'theme-my-login') ?><br />
|
93 |
<input type="text" name="log" id="user_login" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20" tabindex="10" /></label>
|
94 |
</p>
|
95 |
<p>
|
96 |
+
<label><?php _e('Password', 'theme-my-login') ?><br />
|
97 |
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
|
98 |
</p>
|
99 |
<?php do_action('login_form'); ?>
|
100 |
+
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember Me', 'theme-my-login'); ?></label></p>
|
101 |
<p class="submit">
|
102 |
+
<input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Log In', 'theme-my-login'); ?>" tabindex="100" />
|
103 |
+
<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
|
104 |
<input type="hidden" name="testcookie" value="1" />
|
105 |
</p>
|
106 |
</form>
|
107 |
<?php endif; ?>
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
<?php
|
110 |
+
login_footer();
|
111 |
break;
|
112 |
|
113 |
endswitch;
|
includes/wp-login-functions.php
CHANGED
@@ -30,13 +30,28 @@ function login_header($message = '', $wp_error = '') {
|
|
30 |
}
|
31 |
}
|
32 |
if ( !empty($errors) )
|
33 |
-
echo '<
|
34 |
if ( !empty($messages) )
|
35 |
echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
|
36 |
}
|
37 |
}
|
38 |
endif;
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
if (!function_exists('retrieve_password')) :
|
41 |
function retrieve_password() {
|
42 |
global $wpdb;
|
@@ -176,15 +191,4 @@ function register_new_user($user_login, $user_email) {
|
|
176 |
}
|
177 |
endif;
|
178 |
|
179 |
-
if ( !function_exists('ssl_or_not') ) :
|
180 |
-
function ssl_or_not($url = '') {
|
181 |
-
if ( force_ssl_login() || force_ssl_admin() )
|
182 |
-
$scheme = 'https';
|
183 |
-
else
|
184 |
-
$scheme = ( is_ssl() ? 'https' : 'http' );
|
185 |
-
|
186 |
-
return str_replace( 'http://', "{$scheme}://", $url );
|
187 |
-
}
|
188 |
-
endif;
|
189 |
-
|
190 |
?>
|
30 |
}
|
31 |
}
|
32 |
if ( !empty($errors) )
|
33 |
+
echo '<p class="error">' . apply_filters('login_errors', $errors) . "</p>\n";
|
34 |
if ( !empty($messages) )
|
35 |
echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
|
36 |
}
|
37 |
}
|
38 |
endif;
|
39 |
|
40 |
+
if (!function_exists('login_footer')) :
|
41 |
+
function login_footer() {
|
42 |
+
$_GET['action'] = isset($_GET['action']) ? $_GET['action'] : 'login';
|
43 |
+
echo '<ul class="links">' . "\n";
|
44 |
+
if (in_array($_GET['action'], array('register', 'lostpassword')) || $_GET['action'] == 'login' && isset($_GET['checkemail']))
|
45 |
+
echo '<li><a href="' . site_url('wp-login.php', 'login') . '">' . __('Log in') . '</a></li>' . "\n";
|
46 |
+
if (get_option('users_can_register') && $_GET['action'] != 'register')
|
47 |
+
echo '<li><a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a></li>' . "\n";
|
48 |
+
if ($_GET['action'] != 'lostpassword')
|
49 |
+
echo '<li><a href="' . site_url('wp-login.php?action=lostpassword', 'login') . '" title="' . __('Password Lost and Found') . '">' . __('Lost your password?') . '</a></li>' . "\n";
|
50 |
+
echo '</ul>' . "\n";
|
51 |
+
echo '</div>' . "\n";
|
52 |
+
}
|
53 |
+
endif;
|
54 |
+
|
55 |
if (!function_exists('retrieve_password')) :
|
56 |
function retrieve_password() {
|
57 |
global $wpdb;
|
191 |
}
|
192 |
endif;
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
?>
|
readme.txt
CHANGED
@@ -1,66 +1,26 @@
|
|
1 |
=== Theme My Login ===
|
2 |
Contributors: jfarthing84
|
3 |
-
Donate link:
|
4 |
-
Tags: themed login, custom login
|
5 |
Requires at least: 2.5
|
6 |
-
Tested up to: 2.
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
-
Themes the WordPress login pages according to your theme.
|
10 |
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
This plugin themes the WordPress login,
|
15 |
|
16 |
== Installation ==
|
17 |
|
18 |
-
Upload the Theme My Login plugin to your 'wp-content/plugins' directory and activate it. The 'Theme My Login' settings will apear under the 'Settings' menu in the WordPress admin.
|
19 |
-
|
20 |
-
|
21 |
-
-- Redirection Settings
|
22 |
-
|
23 |
-
* Subscriber Login Redirect - You can change this to any location on your site that you would like to redirect subscribers to upon login. This must be an absolute URL.
|
24 |
-
|
25 |
-
* Contributor Login Redirect - You can change this to any location on your site that you would like to redirect contributors to upon login. This must be an absolute URL.
|
26 |
-
|
27 |
-
* Author Login Redirect - You can change this to any location on your site that you would like to redirect authors to upon login. This must be an absolute URL.
|
28 |
-
|
29 |
-
* Editor Login Redirect - You can change this to any location on your site that you would like to redirect editors to upon login. This must be an absolute URL.
|
30 |
-
|
31 |
-
* Administrator Login Redirect - You can change this to any location on your site that you would like to redirect administrators to upon login. This must be an absolute URL.
|
32 |
-
|
33 |
-
* Redirect on Logout - You can change this to any location you would like all users to be redirected to upon logout.
|
34 |
-
|
35 |
-
|
36 |
-
-- Template Settings
|
37 |
-
|
38 |
-
* Theme Subscribers Profile - Check this option if you would like to theme subscriber's profiles. This is useful to hide the back-end from people who can't write posts anyway. <strong>WARNING</strong>: This will disable any user menus created by plugins.
|
39 |
-
|
40 |
-
* Register Page Title - You can change this to whatever title you want for the registration page. You can use %blogname% for your blog name.
|
41 |
-
|
42 |
-
* Register Text - You can change this to whatever text you want to appear above your registration form. This defaults to 'Register'.
|
43 |
-
|
44 |
-
* Register Message - You can change this to whatever you want to appear below your registration form.
|
45 |
-
|
46 |
-
* Login Page Title - You can change this to whatever title you want to for the login page. You can use %blogname% for your blog name.
|
47 |
-
|
48 |
-
* Login Text - You can change this to whatever text you want to appear above your login form.
|
49 |
-
|
50 |
-
* Lost Password Page Title - You can change this to whatever title you want for the lost password page. You can use %blogname% for your blog name.
|
51 |
-
|
52 |
-
* Lost Password Text - You can change this to whatever text you want to appear above your lost password form. This defaults to 'Lost Password'.
|
53 |
-
|
54 |
-
* Profile Page Title - You can change this to whatever title you want for the subscriber profile page. You can use %blogname% for your blog name.
|
55 |
-
|
56 |
-
* Profile Text - You can change this to whatever text you want to appear above the user profile form.
|
57 |
-
|
58 |
-
|
59 |
-
Now you can save your changes and go test out your new themed login and registration pages. That's all!
|
60 |
|
61 |
|
62 |
== Version History ==
|
63 |
|
|
|
64 |
* 2.1.0 - 2009-04-12 - Implemented login redirection based on user role
|
65 |
* 2.0.8 - 2009-04-11 - Fixed a bug that broke the login with permalinks
|
66 |
* 2.0.7 - 2009-04-10 - Fixed a bug that broke the Featured Content plugin
|
1 |
=== Theme My Login ===
|
2 |
Contributors: jfarthing84
|
3 |
+
Donate link: http://www.jfarthing.com/donate
|
4 |
+
Tags: themed login, custom login
|
5 |
Requires at least: 2.5
|
6 |
+
Tested up to: 2.8
|
7 |
+
Stable tag: 2.2
|
8 |
|
9 |
+
Themes the WordPress login pages according to your theme.
|
10 |
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
This plugin themes the WordPress login, registration and forgot password pages according to your current theme. It replaces the wp-login.php and profile.php by using a page template from your theme.
|
15 |
|
16 |
== Installation ==
|
17 |
|
18 |
+
Upload the Theme My Login plugin to your 'wp-content/plugins' directory and activate it. The 'Theme My Login' settings will apear under the 'Settings' menu in the WordPress admin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
|
21 |
== Version History ==
|
22 |
|
23 |
+
* 2.2.0 - 2009-07-01 - The plugin now simply does what it's titled to do
|
24 |
* 2.1.0 - 2009-04-12 - Implemented login redirection based on user role
|
25 |
* 2.0.8 - 2009-04-11 - Fixed a bug that broke the login with permalinks
|
26 |
* 2.0.7 - 2009-04-10 - Fixed a bug that broke the Featured Content plugin
|
theme-my-login.css
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#login {
|
2 |
+
padding: 5px;
|
3 |
+
}
|
4 |
+
|
5 |
+
#login .error {
|
6 |
+
padding: 5px;
|
7 |
+
border: 1px solid red;
|
8 |
+
background-color: lightcoral;
|
9 |
+
}
|
10 |
+
|
11 |
+
#login .message {
|
12 |
+
padding: 5px;
|
13 |
+
border: 1px solid yellow;
|
14 |
+
background-color: lightyellow;
|
15 |
+
}
|
theme-my-login.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Theme My Login
|
4 |
-
Plugin URI: http://
|
5 |
-
Description: Themes the WordPress login pages according to your theme.
|
6 |
-
Version: 2.
|
7 |
Author: Jae Dub
|
8 |
-
Author URI: http://
|
9 |
*/
|
10 |
|
11 |
global $wp_version;
|
@@ -26,15 +26,18 @@ if ($wp_version < '2.6') {
|
|
26 |
if (!class_exists('ThemeMyLogin')) {
|
27 |
class ThemeMyLogin {
|
28 |
|
29 |
-
var $version = '2.
|
30 |
var $options = array();
|
31 |
-
var $
|
32 |
|
33 |
function ThemeMyLogin() {
|
34 |
$this->__construct();
|
35 |
}
|
36 |
|
37 |
function __construct() {
|
|
|
|
|
|
|
38 |
register_activation_hook ( __FILE__, array( &$this, 'Activate' ) );
|
39 |
register_deactivation_hook ( __FILE__, array( &$this, 'Deactivate' ) );
|
40 |
|
@@ -47,6 +50,9 @@ if (!class_exists('ThemeMyLogin')) {
|
|
47 |
add_filter('the_title', array(&$this, 'TheTitle'));
|
48 |
add_filter('wp_list_pages_excludes', array(&$this, 'ListPagesExcludes'));
|
49 |
add_filter('the_content', array(&$this, 'TheContent'));
|
|
|
|
|
|
|
50 |
}
|
51 |
|
52 |
function Activate() {
|
@@ -65,39 +71,28 @@ if (!class_exists('ThemeMyLogin')) {
|
|
65 |
} else $page_id = $theme_my_login->ID;
|
66 |
|
67 |
$this->SetOption('page_id', $page_id);
|
|
|
68 |
$this->SaveOptions();
|
69 |
}
|
70 |
|
71 |
function Deactivate() {
|
72 |
-
if ($this->GetOption('
|
73 |
delete_option('theme_my_login');
|
74 |
wp_delete_post($this->GetOption('page_id'));
|
75 |
}
|
76 |
}
|
77 |
|
78 |
-
# Sets up default options
|
79 |
function InitOptions() {
|
80 |
-
$this->options['
|
81 |
-
$this->options['
|
82 |
-
$this->options['
|
83 |
-
$this->options['
|
84 |
-
$this->options['
|
85 |
-
$this->options['
|
86 |
-
$this->options['
|
87 |
-
$this->options['
|
88 |
-
$this->options['logout_redirect'] = site_url('wp-login.php?loggedout=true', 'login');
|
89 |
-
$this->options['login_title'] = 'Log In';
|
90 |
-
$this->options['login_text'] = 'Log In';
|
91 |
-
$this->options['register_title'] = 'Register';
|
92 |
-
$this->options['register_text'] = 'Register';
|
93 |
-
$this->options['register_msg'] = 'A password will be e-mailed to you.';
|
94 |
-
$this->options['password_title'] = 'Lost Password';
|
95 |
-
$this->options['password_text'] = 'Lost Password';
|
96 |
-
$this->options['profile_title'] = 'Your Profile';
|
97 |
-
$this->options['profile_text'] = 'Your Profile';
|
98 |
}
|
99 |
|
100 |
-
# Loads options from database
|
101 |
function LoadOptions() {
|
102 |
|
103 |
$this->InitOptions();
|
@@ -110,19 +105,16 @@ if (!class_exists('ThemeMyLogin')) {
|
|
110 |
} else update_option( 'theme_my_login', $this->options );
|
111 |
}
|
112 |
|
113 |
-
# Returns option value for given key
|
114 |
function GetOption( $key ) {
|
115 |
if ( array_key_exists( $key, $this->options ) ) {
|
116 |
return $this->options[$key];
|
117 |
} else return null;
|
118 |
}
|
119 |
|
120 |
-
# Sets the speficied option key to a new value
|
121 |
function SetOption( $key, $value ) {
|
122 |
$this->options[$key] = $value;
|
123 |
}
|
124 |
|
125 |
-
# Saves the options to the database
|
126 |
function SaveOptions() {
|
127 |
$oldvalue = get_option( 'theme_my_login' );
|
128 |
if( $oldvalue == $this->options ) {
|
@@ -131,167 +123,101 @@ if (!class_exists('ThemeMyLogin')) {
|
|
131 |
}
|
132 |
|
133 |
function AddAdminPage(){
|
134 |
-
|
135 |
}
|
136 |
|
137 |
function AdminPage(){
|
138 |
require (WP_PLUGIN_DIR . '/theme-my-login/includes/admin-page.php');
|
139 |
}
|
140 |
|
141 |
-
function
|
142 |
-
global $
|
143 |
|
144 |
-
$
|
|
|
145 |
|
146 |
-
if ($
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
}
|
151 |
-
|
152 |
-
function ArgURL($permalink = '', $arg = array()) {
|
153 |
-
if (isset($arg)) :
|
154 |
-
$count = 1;
|
155 |
-
foreach($arg as $key => $value) :
|
156 |
-
if (strpos($permalink, '?') !== false) :
|
157 |
-
if ($count == 1)
|
158 |
-
$permalink .= $key . '=' . $value;
|
159 |
-
else
|
160 |
-
$permalink .= '&' . $key . '=' . $value;
|
161 |
-
else :
|
162 |
-
$permalink .= '?' . $key . '=' . $value;
|
163 |
-
endif;
|
164 |
-
$count++;
|
165 |
-
endforeach;
|
166 |
-
else :
|
167 |
-
$permalink = get_permalink( $this->GetOption('page_id') );
|
168 |
-
endif;
|
169 |
-
|
170 |
-
return $permalink;
|
171 |
}
|
172 |
|
173 |
function Init() {
|
174 |
global $pagenow;
|
175 |
-
|
176 |
-
$this->LoadOptions();
|
177 |
-
$permalink = $this->QueryURL();
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
$redirect_to = $this->ArgURL($permalink, $_GET);
|
182 |
-
wp_safe_redirect($redirect_to);
|
183 |
-
exit;
|
184 |
-
}
|
185 |
-
|
186 |
switch ($pagenow) {
|
187 |
case 'wp-register.php':
|
188 |
case 'wp-login.php':
|
189 |
-
|
190 |
-
$redirect_to = admin_url();
|
191 |
-
else
|
192 |
-
$redirect_to = $this->ArgURL($permalink, $_GET);
|
193 |
wp_safe_redirect($redirect_to);
|
194 |
exit;
|
195 |
-
|
196 |
-
case 'profile.php':
|
197 |
-
if ( $this->GetOption('theme_profile') && is_user_logged_in() && current_user_can('edit_posts') === false && !isset($_POST['from']) && $_POST['from'] != 'profile' ) {
|
198 |
-
$_GET['profile'] = true;
|
199 |
-
$redirect_to = $this->ArgURL($permalink, $_GET);
|
200 |
-
wp_safe_redirect($redirect_to);
|
201 |
-
exit;
|
202 |
-
}
|
203 |
-
break;
|
204 |
-
}
|
205 |
-
}
|
206 |
-
|
207 |
-
function ParseRequest() {
|
208 |
-
global $wp;
|
209 |
-
$is_login = false;
|
210 |
-
$page_id = isset($wp->query_vars['page_id']) ? $wp->query_vars['page_id'] : 0;
|
211 |
-
$pagename = isset($wp->query_vars['pagename']) ? $wp->query_vars['pagename'] : '';
|
212 |
-
|
213 |
-
if (isset($page_id) && $page_id == $this->GetOption('page_id'))
|
214 |
-
$is_login = true;
|
215 |
-
elseif (isset($pagename) && $pagename == 'login')
|
216 |
-
$is_login = true;
|
217 |
-
|
218 |
-
if ($is_login) {
|
219 |
-
if ($this->GetOption('theme_profile') && isset($_GET['profile']) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'update' && is_user_logged_in())
|
220 |
-
require (WP_PLUGIN_DIR . '/theme-my-login/includes/profile-actions.php');
|
221 |
-
else
|
222 |
-
require (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-actions.php');
|
223 |
}
|
224 |
}
|
225 |
|
226 |
function TheContent($content) {
|
227 |
-
if (strpos($content, '[theme-my-login]') !== false)
|
228 |
-
|
229 |
-
|
230 |
-
else
|
231 |
-
return $this->DisplayLogin();
|
232 |
-
} else {
|
233 |
return $content;
|
234 |
-
}
|
235 |
-
}
|
236 |
-
|
237 |
-
function DisplayProfile() {
|
238 |
-
require (WP_PLUGIN_DIR . '/theme-my-login/includes/profile-form.php');
|
239 |
}
|
240 |
|
241 |
function DisplayLogin() {
|
|
|
|
|
242 |
require (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-forms.php');
|
243 |
}
|
244 |
|
245 |
function WPHead() {
|
246 |
echo '<!-- Theme My Login Version ' . $this->version . ' -->' . "\n";
|
|
|
|
|
247 |
}
|
248 |
|
249 |
function WPTitle($title) {
|
250 |
-
if (is_page($this->GetOption('page_id'))) {
|
251 |
-
if (isset($_GET['profile']) && is_user_logged_in())
|
252 |
-
return str_replace('%blogname%', get_option('blogname'), $this->GetOption('profile_title'));
|
253 |
|
254 |
if (!isset($_GET['action']))
|
255 |
$_GET['action'] = 'login';
|
256 |
|
257 |
switch ($_GET['action']) {
|
258 |
case 'register':
|
259 |
-
return str_replace('
|
260 |
break;
|
261 |
case 'lostpassword':
|
262 |
case 'retrievepassword':
|
263 |
case 'resetpass':
|
264 |
case 'rp':
|
265 |
-
return str_replace('
|
266 |
break;
|
267 |
case 'login':
|
268 |
default:
|
269 |
-
return str_replace('
|
270 |
}
|
271 |
} return $title;
|
272 |
}
|
273 |
|
274 |
function TheTitle($title) {
|
275 |
if ($title == 'Login') {
|
276 |
-
if (isset($_GET['profile']) && is_user_logged_in())
|
277 |
-
return $this->GetOption('profile_text');
|
278 |
|
279 |
if (!isset($_GET['action']))
|
280 |
$_GET['action'] = 'login';
|
281 |
|
282 |
switch ($_GET['action']) {
|
283 |
case 'register':
|
284 |
-
return $this->GetOption('
|
285 |
break;
|
286 |
case 'lostpassword':
|
287 |
case 'retrievepassword':
|
288 |
case 'resetpass':
|
289 |
case 'rp':
|
290 |
-
return $this->GetOption('
|
291 |
break;
|
292 |
case 'login':
|
293 |
default:
|
294 |
-
return $this->GetOption('
|
295 |
}
|
296 |
} return $title;
|
297 |
}
|
@@ -301,6 +227,19 @@ if (!class_exists('ThemeMyLogin')) {
|
|
301 |
|
302 |
return $excludes;
|
303 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
}
|
305 |
}
|
306 |
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Theme My Login
|
4 |
+
Plugin URI: http://www.jfarthing.com/wordpress-plugins/theme-my-login-plugin
|
5 |
+
Description: Themes the WordPress login, registration and forgot password pages according to your theme.
|
6 |
+
Version: 2.2
|
7 |
Author: Jae Dub
|
8 |
+
Author URI: http://www.jfarthing.com
|
9 |
*/
|
10 |
|
11 |
global $wp_version;
|
26 |
if (!class_exists('ThemeMyLogin')) {
|
27 |
class ThemeMyLogin {
|
28 |
|
29 |
+
var $version = '2.2';
|
30 |
var $options = array();
|
31 |
+
var $permalink = '';
|
32 |
|
33 |
function ThemeMyLogin() {
|
34 |
$this->__construct();
|
35 |
}
|
36 |
|
37 |
function __construct() {
|
38 |
+
|
39 |
+
load_plugin_textdomain('theme-my-login', '/wp-content/plugins/theme-my-login/language');
|
40 |
+
|
41 |
register_activation_hook ( __FILE__, array( &$this, 'Activate' ) );
|
42 |
register_deactivation_hook ( __FILE__, array( &$this, 'Deactivate' ) );
|
43 |
|
50 |
add_filter('the_title', array(&$this, 'TheTitle'));
|
51 |
add_filter('wp_list_pages_excludes', array(&$this, 'ListPagesExcludes'));
|
52 |
add_filter('the_content', array(&$this, 'TheContent'));
|
53 |
+
add_filter('site_url', array(&$this, 'SiteURLFilter'), 10, 2);
|
54 |
+
|
55 |
+
$this->LoadOptions();
|
56 |
}
|
57 |
|
58 |
function Activate() {
|
71 |
} else $page_id = $theme_my_login->ID;
|
72 |
|
73 |
$this->SetOption('page_id', $page_id);
|
74 |
+
$this->SetOption('version', $this->version);
|
75 |
$this->SaveOptions();
|
76 |
}
|
77 |
|
78 |
function Deactivate() {
|
79 |
+
if ($this->GetOption('uninstall')) {
|
80 |
delete_option('theme_my_login');
|
81 |
wp_delete_post($this->GetOption('page_id'));
|
82 |
}
|
83 |
}
|
84 |
|
|
|
85 |
function InitOptions() {
|
86 |
+
$this->options['uninstall'] = 0;
|
87 |
+
$this->options['page_id'] = 0;
|
88 |
+
$this->options['login_title'] = __('Log In', 'theme-my-login');
|
89 |
+
$this->options['register_title'] = __('Register', 'theme-my-login');
|
90 |
+
$this->options['register_msg'] = __('A password will be e-mailed to you.', 'theme-my-login');
|
91 |
+
$this->options['register_complete'] = __('Registration complete. Please check your e-mail.', 'theme-my-login');
|
92 |
+
$this->options['password_title'] = __('Lost Password', 'theme-my-login');
|
93 |
+
$this->options['password_msg'] = __('Please enter your username or e-mail address. You will receive a new password via e-mail.', 'theme-my-login');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
|
|
|
96 |
function LoadOptions() {
|
97 |
|
98 |
$this->InitOptions();
|
105 |
} else update_option( 'theme_my_login', $this->options );
|
106 |
}
|
107 |
|
|
|
108 |
function GetOption( $key ) {
|
109 |
if ( array_key_exists( $key, $this->options ) ) {
|
110 |
return $this->options[$key];
|
111 |
} else return null;
|
112 |
}
|
113 |
|
|
|
114 |
function SetOption( $key, $value ) {
|
115 |
$this->options[$key] = $value;
|
116 |
}
|
117 |
|
|
|
118 |
function SaveOptions() {
|
119 |
$oldvalue = get_option( 'theme_my_login' );
|
120 |
if( $oldvalue == $this->options ) {
|
123 |
}
|
124 |
|
125 |
function AddAdminPage(){
|
126 |
+
add_options_page(__('Theme My Login', 'theme-my-login'), __('Theme My Login', 'theme-my-login'), 8, 'theme-my-login', array(&$this, 'AdminPage'));
|
127 |
}
|
128 |
|
129 |
function AdminPage(){
|
130 |
require (WP_PLUGIN_DIR . '/theme-my-login/includes/admin-page.php');
|
131 |
}
|
132 |
|
133 |
+
function ParseRequest() {
|
134 |
+
global $wp, $login_errors;
|
135 |
|
136 |
+
$page_id = isset($wp->query_vars['page_id']) ? $wp->query_vars['page_id'] : 0;
|
137 |
+
$pagename = isset($wp->query_vars['pagename']) ? $wp->query_vars['pagename'] : '';
|
138 |
|
139 |
+
if ( isset($page_id) && $page_id == $this->GetOption('page_id') || isset($pagename) && strtolower($pagename) == 'login' ) {
|
140 |
+
$login_errors = new WP_Error();
|
141 |
+
require (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-actions.php');
|
142 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
|
145 |
function Init() {
|
146 |
global $pagenow;
|
|
|
|
|
|
|
147 |
|
148 |
+
$this->permalink = get_permalink($this->GetOption('page_id'));
|
149 |
+
|
|
|
|
|
|
|
|
|
|
|
150 |
switch ($pagenow) {
|
151 |
case 'wp-register.php':
|
152 |
case 'wp-login.php':
|
153 |
+
$redirect_to = admin_url();
|
|
|
|
|
|
|
154 |
wp_safe_redirect($redirect_to);
|
155 |
exit;
|
156 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
}
|
159 |
|
160 |
function TheContent($content) {
|
161 |
+
if (strpos($content, '[theme-my-login]') !== false)
|
162 |
+
return $this->DisplayLogin();
|
163 |
+
else
|
|
|
|
|
|
|
164 |
return $content;
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
|
167 |
function DisplayLogin() {
|
168 |
+
global $login_errors;
|
169 |
+
|
170 |
require (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-forms.php');
|
171 |
}
|
172 |
|
173 |
function WPHead() {
|
174 |
echo '<!-- Theme My Login Version ' . $this->version . ' -->' . "\n";
|
175 |
+
echo '<link rel="stylesheet" type="text/css" href="' . WP_PLUGIN_URL . '/theme-my-login/theme-my-login.css">' . "\n";
|
176 |
+
echo '<!-- Theme My Login Version ' . $this->version . ' -->' . "\n";
|
177 |
}
|
178 |
|
179 |
function WPTitle($title) {
|
180 |
+
if ( is_page($this->GetOption('page_id')) ) {
|
|
|
|
|
181 |
|
182 |
if (!isset($_GET['action']))
|
183 |
$_GET['action'] = 'login';
|
184 |
|
185 |
switch ($_GET['action']) {
|
186 |
case 'register':
|
187 |
+
return str_replace('Login', $this->GetOption('register_title'), $title);
|
188 |
break;
|
189 |
case 'lostpassword':
|
190 |
case 'retrievepassword':
|
191 |
case 'resetpass':
|
192 |
case 'rp':
|
193 |
+
return str_replace('Login', $this->GetOption('password_title'), $title);
|
194 |
break;
|
195 |
case 'login':
|
196 |
default:
|
197 |
+
return str_replace('Login', $this->GetOption('login_title'), $title);
|
198 |
}
|
199 |
} return $title;
|
200 |
}
|
201 |
|
202 |
function TheTitle($title) {
|
203 |
if ($title == 'Login') {
|
|
|
|
|
204 |
|
205 |
if (!isset($_GET['action']))
|
206 |
$_GET['action'] = 'login';
|
207 |
|
208 |
switch ($_GET['action']) {
|
209 |
case 'register':
|
210 |
+
return $this->GetOption('register_title');
|
211 |
break;
|
212 |
case 'lostpassword':
|
213 |
case 'retrievepassword':
|
214 |
case 'resetpass':
|
215 |
case 'rp':
|
216 |
+
return $this->GetOption('password_title');
|
217 |
break;
|
218 |
case 'login':
|
219 |
default:
|
220 |
+
return $this->GetOption('login_title');
|
221 |
}
|
222 |
} return $title;
|
223 |
}
|
227 |
|
228 |
return $excludes;
|
229 |
}
|
230 |
+
|
231 |
+
function SiteURLFilter($url, $path) {
|
232 |
+
global $wp_rewrite;
|
233 |
+
|
234 |
+
if ( preg_match('/wp-login.php/', $url) ) {
|
235 |
+
$parsed_url = parse_url($url);
|
236 |
+
if ( isset($parsed_url['query']) )
|
237 |
+
$url = $wp_rewrite->using_permalinks() ? $this->permalink.'?'.$parsed_url['query'] : $this->permalink.'&'.$parsed_url['query'];
|
238 |
+
else
|
239 |
+
$url = $this->permalink;
|
240 |
+
}
|
241 |
+
return $url;
|
242 |
+
}
|
243 |
}
|
244 |
}
|
245 |
|