Version Description
- Implemented custom user passwords
- Implemented custom e-mail from name & address
- Removed template tag & shortcode restriction on main login page
Download this release
Release Info
Developer | jfarthing84 |
Plugin | Theme My Login |
Version | 4.1 |
Comparing to | |
See all releases |
Code changes from version 4.0 to 4.1
- classes/class.plugin-shell.php +4 -3
- classes/class.widget-new.php +4 -2
- classes/class.widget-old.php +2 -0
- classes/class.wp-login.php +29 -30
- css/theme-my-login-admin.css.php +2 -0
- css/theme-my-login.css +1 -1
- includes/admin-page.php +42 -17
- readme.txt +6 -0
- theme-my-login.php +97 -65
classes/class.plugin-shell.php
CHANGED
@@ -161,8 +161,9 @@ if ( !class_exists('WPPluginShell')) {
|
|
161 |
$this->footer_code .= $code;
|
162 |
}
|
163 |
|
164 |
-
function SetMailFrom($email, $name =
|
165 |
-
|
|
|
166 |
if (!empty($name))
|
167 |
$this->mail_from['name'] = $name;
|
168 |
}
|
@@ -262,7 +263,7 @@ if ( !class_exists('WPPluginShell')) {
|
|
262 |
}
|
263 |
|
264 |
function _WPMailFromName_($from_name) {
|
265 |
-
return (empty($this->mail_from['name'])) ? $
|
266 |
}
|
267 |
|
268 |
function _handle_enqueues($type, $to_enqueue) {
|
161 |
$this->footer_code .= $code;
|
162 |
}
|
163 |
|
164 |
+
function SetMailFrom($email = '', $name = '') {
|
165 |
+
if (!empty($email))
|
166 |
+
$this->mail_from['email'] = $email;
|
167 |
if (!empty($name))
|
168 |
$this->mail_from['name'] = $name;
|
169 |
}
|
263 |
}
|
264 |
|
265 |
function _WPMailFromName_($from_name) {
|
266 |
+
return (empty($this->mail_from['name'])) ? $from_name : $this->mail_from['name'];
|
267 |
}
|
268 |
|
269 |
function _handle_enqueues($type, $to_enqueue) {
|
classes/class.widget-new.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
|
|
|
3 |
class ThemeMyLoginWidget extends WP_Widget {
|
4 |
|
5 |
function ThemeMyLoginWidget(){
|
@@ -10,8 +11,6 @@ class ThemeMyLoginWidget extends WP_Widget {
|
|
10 |
function widget($args, $instance){
|
11 |
global $ThemeMyLogin;
|
12 |
|
13 |
-
$WPLogin = new WPLogin('theme-my-login');
|
14 |
-
|
15 |
$new_args['widget'] = array_merge($args, $instance);
|
16 |
|
17 |
if (!is_page($ThemeMyLogin->GetOption('page_id'))) {
|
@@ -72,10 +71,13 @@ class ThemeMyLoginWidget extends WP_Widget {
|
|
72 |
}
|
73 |
|
74 |
}// END class
|
|
|
75 |
|
|
|
76 |
function ThemeMyLoginWidgetInit() {
|
77 |
register_widget('ThemeMyLoginWidget');
|
78 |
}
|
|
|
79 |
add_action('widgets_init', 'ThemeMyLoginWidgetInit');
|
80 |
|
81 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
if ( !class_exists('ThemeMyLoginWidget') ) :
|
4 |
class ThemeMyLoginWidget extends WP_Widget {
|
5 |
|
6 |
function ThemeMyLoginWidget(){
|
11 |
function widget($args, $instance){
|
12 |
global $ThemeMyLogin;
|
13 |
|
|
|
|
|
14 |
$new_args['widget'] = array_merge($args, $instance);
|
15 |
|
16 |
if (!is_page($ThemeMyLogin->GetOption('page_id'))) {
|
71 |
}
|
72 |
|
73 |
}// END class
|
74 |
+
endif;
|
75 |
|
76 |
+
if ( !function_exists('ThemeMyLoginWidgetInit') ) :
|
77 |
function ThemeMyLoginWidgetInit() {
|
78 |
register_widget('ThemeMyLoginWidget');
|
79 |
}
|
80 |
+
endif;
|
81 |
add_action('widgets_init', 'ThemeMyLoginWidgetInit');
|
82 |
|
83 |
?>
|
classes/class.widget-old.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
|
|
|
3 |
class ThemeMyLoginWidget {
|
4 |
|
5 |
function ThemeMyLoginWidget() {
|
@@ -66,6 +67,7 @@ class ThemeMyLoginWidget {
|
|
66 |
}
|
67 |
|
68 |
}
|
|
|
69 |
|
70 |
if (class_exists('ThemeMyLoginWidget')) {
|
71 |
$ThemeMyLoginWidget = new ThemeMyLoginWidget();
|
1 |
<?php
|
2 |
|
3 |
+
if ( !function_exists('ThemeMyLoginWidget') ) :
|
4 |
class ThemeMyLoginWidget {
|
5 |
|
6 |
function ThemeMyLoginWidget() {
|
67 |
}
|
68 |
|
69 |
}
|
70 |
+
endif;
|
71 |
|
72 |
if (class_exists('ThemeMyLoginWidget')) {
|
73 |
$ThemeMyLoginWidget = new ThemeMyLoginWidget();
|
classes/class.wp-login.php
CHANGED
@@ -89,7 +89,7 @@ if ( !class_exists('WPLogin') ) {
|
|
89 |
$this->LoadOptions($args);
|
90 |
|
91 |
$action = (isset($this->options['widget']['default_action'])) ? $this->options['widget']['default_action'] : 'login';
|
92 |
-
if ($instance == $this->instance)
|
93 |
$action = $this->action;
|
94 |
|
95 |
ob_start();
|
@@ -112,7 +112,7 @@ if ( !class_exists('WPLogin') ) {
|
|
112 |
}
|
113 |
do_action('login_links', $current_user);
|
114 |
$redirect = $this->GuessURL();
|
115 |
-
if ($wp_version
|
116 |
echo '<li><a href="' . wp_logout_url($redirect) . '">' . __('Log Out') . '</a></li>' . "\n";
|
117 |
else
|
118 |
echo '<li><a href="' . site_url('wp-login.php?action=logout&redirect_to='.$redirect, 'login') . '">' . __('Log Out') . '</a></li>' . "\n";
|
@@ -121,7 +121,7 @@ if ( !class_exists('WPLogin') ) {
|
|
121 |
} else {
|
122 |
if ( $this->options['widget']['show_title'] )
|
123 |
echo $this->options['widget']['before_title'] . $this->GetTitle($instance) . $this->options['widget']['after_title'] . "\n";
|
124 |
-
if ($instance == $this->instance || !empty($action)) {
|
125 |
switch ($action) {
|
126 |
case 'lostpassword' :
|
127 |
case 'retrievepassword' :
|
@@ -151,9 +151,9 @@ if ( !class_exists('WPLogin') ) {
|
|
151 |
|
152 |
function GetTitle($instance) {
|
153 |
$action = (isset($this->options['widget']['default_action'])) ? $this->options['widget']['default_action'] : 'login';
|
154 |
-
if ($instance == $this->instance)
|
155 |
$action = $this->action;
|
156 |
-
|
157 |
switch ($action) {
|
158 |
case 'register':
|
159 |
return $this->options['titles']['register'];
|
@@ -182,7 +182,7 @@ if ( !class_exists('WPLogin') ) {
|
|
182 |
unset($error);
|
183 |
}
|
184 |
|
185 |
-
if ( $instance == $this->instance || $this->
|
186 |
if ( $this->errors->get_error_code() ) {
|
187 |
$errors = '';
|
188 |
$messages = '';
|
@@ -205,7 +205,7 @@ if ( !class_exists('WPLogin') ) {
|
|
205 |
|
206 |
function PageFooter($instance) {
|
207 |
$action = (isset($this->options['widget']['default_action'])) ? $this->options['widget']['default_action'] : 'login';
|
208 |
-
if ($instance == $this->instance)
|
209 |
$action = $this->action;
|
210 |
|
211 |
if ( isset($this->options['widget']['show_links']) && true == $this->options['widget']['show_links'] ) {
|
@@ -266,7 +266,7 @@ if ( !class_exists('WPLogin') ) {
|
|
266 |
<label><?php _e('Password') ?><br />
|
267 |
<input type="password" name="pwd" id="user_pass-<?php echo $instance; ?>" class="input" value="" size="20" /></label>
|
268 |
</p>
|
269 |
-
<?php do_action('login_form'); ?>
|
270 |
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme-<?php echo $instance; ?>" value="forever" /> <?php _e('Remember Me'); ?></label></p>
|
271 |
<p class="submit">
|
272 |
<input type="submit" name="login-submit" id="login-submit-<?php echo $instance; ?>" value="<?php _e('Log In'); ?>" />
|
@@ -307,7 +307,7 @@ if ( !class_exists('WPLogin') ) {
|
|
307 |
<label><?php _e('E-mail') ?><br />
|
308 |
<input type="text" name="user_email" id="user_email-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" /></label>
|
309 |
</p>
|
310 |
-
<?php do_action('register_form'); ?>
|
311 |
<p id="reg_passmail-<?php echo $instance; ?>"><?php echo $this->options['messages']['register']; ?></p>
|
312 |
<p class="submit">
|
313 |
<input type="submit" name="register-submit" id="register-submit-<?php echo $instance; ?>" value="<?php _e('Register'); ?>" />
|
@@ -323,7 +323,7 @@ if ( !class_exists('WPLogin') ) {
|
|
323 |
}
|
324 |
|
325 |
function RetrievePasswordForm($instance) {
|
326 |
-
do_action('lost_password');
|
327 |
$this->PageHeader($instance, $this->options['messages']['lostpassword']);
|
328 |
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
329 |
?>
|
@@ -332,7 +332,7 @@ if ( !class_exists('WPLogin') ) {
|
|
332 |
<label><?php _e('Username or E-mail:') ?><br />
|
333 |
<input type="text" name="user_login" id="user_login-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" /></label>
|
334 |
</p>
|
335 |
-
<?php do_action('lostpassword_form'); ?>
|
336 |
<p class="submit">
|
337 |
<input type="submit" name="lostpassword-submit" id="lostpassword-submit-<?php echo $instance; ?>" value="<?php _e('Get New Password'); ?>" />
|
338 |
</p>
|
@@ -424,16 +424,7 @@ if ( !class_exists('WPLogin') ) {
|
|
424 |
}
|
425 |
}
|
426 |
}
|
427 |
-
|
428 |
-
if ( !empty( $_REQUEST['redirect_to'] ) ) {
|
429 |
-
$this->redirect_to = $_REQUEST['redirect_to'];
|
430 |
-
// Redirect to https if user wants ssl
|
431 |
-
if ( $this->secure_cookie && false !== strpos($this->redirect_to, 'wp-admin') )
|
432 |
-
$this->redirect_to = preg_replace('|^http://|', 'https://', $this->redirect_to);
|
433 |
-
} else {
|
434 |
-
$this->redirect_to = admin_url();
|
435 |
-
}
|
436 |
-
*/
|
437 |
if ( !$this->secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() )
|
438 |
$this->secure_cookie = false;
|
439 |
|
@@ -487,15 +478,6 @@ if ( !class_exists('WPLogin') ) {
|
|
487 |
}
|
488 |
|
489 |
function GuessURL($args = array()) {
|
490 |
-
/*
|
491 |
-
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
|
492 |
-
|
493 |
-
if ($_SERVER["SERVER_PORT"] != "80") {
|
494 |
-
$url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
495 |
-
} else {
|
496 |
-
$url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
497 |
-
}
|
498 |
-
*/
|
499 |
$keys = array('action', 'checkemail', 'error', 'loggedout', 'registered', 'redirect_to', 'updated', 'key');
|
500 |
$url = remove_query_arg($keys);
|
501 |
|
@@ -657,4 +639,21 @@ if ( !class_exists('WPLogin') ) {
|
|
657 |
}
|
658 |
}
|
659 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
?>
|
89 |
$this->LoadOptions($args);
|
90 |
|
91 |
$action = (isset($this->options['widget']['default_action'])) ? $this->options['widget']['default_action'] : 'login';
|
92 |
+
if ( $instance == $this->instance || (empty($this->instance) && 'tml-main' == $instance) )
|
93 |
$action = $this->action;
|
94 |
|
95 |
ob_start();
|
112 |
}
|
113 |
do_action('login_links', $current_user);
|
114 |
$redirect = $this->GuessURL();
|
115 |
+
if ( version_compare($wp_version, '2.7', '>=') )
|
116 |
echo '<li><a href="' . wp_logout_url($redirect) . '">' . __('Log Out') . '</a></li>' . "\n";
|
117 |
else
|
118 |
echo '<li><a href="' . site_url('wp-login.php?action=logout&redirect_to='.$redirect, 'login') . '">' . __('Log Out') . '</a></li>' . "\n";
|
121 |
} else {
|
122 |
if ( $this->options['widget']['show_title'] )
|
123 |
echo $this->options['widget']['before_title'] . $this->GetTitle($instance) . $this->options['widget']['after_title'] . "\n";
|
124 |
+
if ( $instance == $this->instance || !empty($action) ) {
|
125 |
switch ($action) {
|
126 |
case 'lostpassword' :
|
127 |
case 'retrievepassword' :
|
151 |
|
152 |
function GetTitle($instance) {
|
153 |
$action = (isset($this->options['widget']['default_action'])) ? $this->options['widget']['default_action'] : 'login';
|
154 |
+
if ( $instance == $this->instance || (empty($this->instance) && 'tml-main' == $instance) )
|
155 |
$action = $this->action;
|
156 |
+
|
157 |
switch ($action) {
|
158 |
case 'register':
|
159 |
return $this->options['titles']['register'];
|
182 |
unset($error);
|
183 |
}
|
184 |
|
185 |
+
if ( $instance == $this->instance || (empty($this->instance) && 'tml-main' == $instance) ) {
|
186 |
if ( $this->errors->get_error_code() ) {
|
187 |
$errors = '';
|
188 |
$messages = '';
|
205 |
|
206 |
function PageFooter($instance) {
|
207 |
$action = (isset($this->options['widget']['default_action'])) ? $this->options['widget']['default_action'] : 'login';
|
208 |
+
if ( $instance == $this->instance || (empty($this->instance) && 'tml-main' == $instance) )
|
209 |
$action = $this->action;
|
210 |
|
211 |
if ( isset($this->options['widget']['show_links']) && true == $this->options['widget']['show_links'] ) {
|
266 |
<label><?php _e('Password') ?><br />
|
267 |
<input type="password" name="pwd" id="user_pass-<?php echo $instance; ?>" class="input" value="" size="20" /></label>
|
268 |
</p>
|
269 |
+
<?php do_action('login_form', $instance); ?>
|
270 |
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme-<?php echo $instance; ?>" value="forever" /> <?php _e('Remember Me'); ?></label></p>
|
271 |
<p class="submit">
|
272 |
<input type="submit" name="login-submit" id="login-submit-<?php echo $instance; ?>" value="<?php _e('Log In'); ?>" />
|
307 |
<label><?php _e('E-mail') ?><br />
|
308 |
<input type="text" name="user_email" id="user_email-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" /></label>
|
309 |
</p>
|
310 |
+
<?php do_action('register_form', $instance); ?>
|
311 |
<p id="reg_passmail-<?php echo $instance; ?>"><?php echo $this->options['messages']['register']; ?></p>
|
312 |
<p class="submit">
|
313 |
<input type="submit" name="register-submit" id="register-submit-<?php echo $instance; ?>" value="<?php _e('Register'); ?>" />
|
323 |
}
|
324 |
|
325 |
function RetrievePasswordForm($instance) {
|
326 |
+
do_action('lost_password', $instance);
|
327 |
$this->PageHeader($instance, $this->options['messages']['lostpassword']);
|
328 |
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
329 |
?>
|
332 |
<label><?php _e('Username or E-mail:') ?><br />
|
333 |
<input type="text" name="user_login" id="user_login-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" /></label>
|
334 |
</p>
|
335 |
+
<?php do_action('lostpassword_form', $instance); ?>
|
336 |
<p class="submit">
|
337 |
<input type="submit" name="lostpassword-submit" id="lostpassword-submit-<?php echo $instance; ?>" value="<?php _e('Get New Password'); ?>" />
|
338 |
</p>
|
424 |
}
|
425 |
}
|
426 |
}
|
427 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
if ( !$this->secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() )
|
429 |
$this->secure_cookie = false;
|
430 |
|
478 |
}
|
479 |
|
480 |
function GuessURL($args = array()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
$keys = array('action', 'checkemail', 'error', 'loggedout', 'registered', 'redirect_to', 'updated', 'key');
|
482 |
$url = remove_query_arg($keys);
|
483 |
|
639 |
}
|
640 |
}
|
641 |
|
642 |
+
if ( !function_exists('wp_generate_password') ) :
|
643 |
+
function wp_generate_password($length = 12, $special_chars = true) {
|
644 |
+
|
645 |
+
if ( isset($_POST['user_pw']) && '' != $_POST['user_pw'] )
|
646 |
+
return stripslashes($_POST['user_pw']);
|
647 |
+
|
648 |
+
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
649 |
+
if ( $special_chars )
|
650 |
+
$chars .= '!@#$%^&*()';
|
651 |
+
|
652 |
+
$password = '';
|
653 |
+
for ( $i = 0; $i < $length; $i++ )
|
654 |
+
$password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
|
655 |
+
return $password;
|
656 |
+
}
|
657 |
+
endif;
|
658 |
+
|
659 |
?>
|
css/theme-my-login-admin.css.php
CHANGED
@@ -21,6 +21,8 @@ header("Content-type: text/css");
|
|
21 |
#container table input.full-text { width: 99%; }
|
22 |
#container table input.small-text { width: 50px; }
|
23 |
|
|
|
|
|
24 |
<?php if ( version_compare($version, '2.8', '>=') ) : ?>
|
25 |
|
26 |
<?php elseif ( version_compare($version, '2.7', '>=') ) : ?>
|
21 |
#container table input.full-text { width: 99%; }
|
22 |
#container table input.small-text { width: 50px; }
|
23 |
|
24 |
+
#container div div { font-size: 1em; }
|
25 |
+
|
26 |
<?php if ( version_compare($version, '2.8', '>=') ) : ?>
|
27 |
|
28 |
<?php elseif ( version_compare($version, '2.7', '>=') ) : ?>
|
css/theme-my-login.css
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
border: 1px solid #ff0000;
|
8 |
background-color: #f08080;
|
9 |
}
|
10 |
-
.login p.error a:link
|
11 |
color: #333333;
|
12 |
}
|
13 |
|
7 |
border: 1px solid #ff0000;
|
8 |
background-color: #f08080;
|
9 |
}
|
10 |
+
.login p.error a:link {
|
11 |
color: #333333;
|
12 |
}
|
13 |
|
includes/admin-page.php
CHANGED
@@ -7,15 +7,16 @@ if ( $_POST ) {
|
|
7 |
|
8 |
check_admin_referer('theme-my-login-settings');
|
9 |
|
10 |
-
$ThemeMyLogin->options['general']['uninstall'] = isset($_POST['general']['uninstall']);
|
11 |
-
$ThemeMyLogin->options['general']['defaults'] = isset($_POST['general']['defaults']);
|
12 |
-
$ThemeMyLogin->options['general']['show_page'] = isset($_POST['general']['show_page']);
|
|
|
|
|
|
|
13 |
|
14 |
$ThemeMyLogin->SetOption('titles', stripslashes_deep($_POST['titles']));
|
15 |
$ThemeMyLogin->SetOption('messages', stripslashes_deep($_POST['messages']));
|
16 |
|
17 |
-
$ThemeMyLogin->SetOption('widget_allow_register', isset($_POST['widget_allow_register']));
|
18 |
-
$ThemeMyLogin->SetOption('widget_allow_password', isset($_POST['widget_allow_password']));
|
19 |
foreach ( $_POST['links'] as $role => $tmp ) {
|
20 |
foreach ( $tmp as $key => $data ) {
|
21 |
$links[$role][] = array('title' => $data['title'], 'url' => $data['url']);
|
@@ -28,11 +29,10 @@ if ( $_POST ) {
|
|
28 |
$ThemeMyLogin->SetOption('redirects', $redirects);
|
29 |
foreach ( $_POST['emails'] as $email => $data ) {
|
30 |
$emails[$email] = array('subject' => stripslashes($data['subject']), 'message' => stripslashes($data['message']));
|
31 |
-
if ( isset($data['admin-disable']) )
|
32 |
-
$emails[$email]['admin-disable'] = $data['admin-disable'];
|
33 |
-
if ( isset($data['user-disable']) )
|
34 |
-
$emails[$email]['user-disable'] = $data['user-disable'];
|
35 |
}
|
|
|
|
|
|
|
36 |
$ThemeMyLogin->SetOption('emails', $emails);
|
37 |
$ThemeMyLogin->SaveOptions();
|
38 |
|
@@ -93,24 +93,31 @@ $emails = $ThemeMyLogin->GetOption('emails');
|
|
93 |
<tr valign="top">
|
94 |
<th scope="row"><?php _e('Plugin', 'theme-my-login'); ?></th>
|
95 |
<td>
|
96 |
-
<input name="general[uninstall]" type="checkbox" id="general[uninstall]" value="1" <?php if ($ThemeMyLogin->options['general']['uninstall']) { echo 'checked="checked"'; } ?> />
|
97 |
<label for="general[uninstall]"><?php _e('Uninstall', 'theme-my-login'); ?></label>
|
98 |
</td>
|
99 |
</tr>
|
100 |
<tr valign="top">
|
101 |
<th scope="row"><?php _e('Defaults', 'theme-my-login'); ?></th>
|
102 |
<td>
|
103 |
-
<input name="general[defaults]" type="checkbox" id="general[defaults]" value="1" <?php if ($ThemeMyLogin->options['general']['defaults']) { echo 'checked="checked"'; } ?> />
|
104 |
<label for="general[defaults]"><?php _e('Reset Defaults', 'theme-my-login'); ?></label>
|
105 |
</td>
|
106 |
</tr>
|
107 |
<tr valign="top">
|
108 |
<th scope="row"><?php _e('Page List', 'theme-my-login'); ?></th>
|
109 |
<td>
|
110 |
-
<input name="general[show_page]" type="checkbox" id="general[show_page]" value="1" <?php if ($ThemeMyLogin->options['general']['show_page']) { echo 'checked="checked"'; } ?> />
|
111 |
<label for="general[show_page]"><?php _e('Show Login Page', 'theme-my-login'); ?></label>
|
112 |
</td>
|
113 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
</table>
|
115 |
|
116 |
</div>
|
@@ -272,12 +279,30 @@ $emails = $ThemeMyLogin->GetOption('emails');
|
|
272 |
<div id="fragment-5" class="tabs-div">
|
273 |
|
274 |
<ul class="tabs-nav">
|
275 |
-
<li><a href="#fragment-5-1">
|
276 |
-
<li><a href="#fragment-5-2">
|
277 |
-
<li><a href="#fragment-5-3">Password
|
|
|
278 |
</ul>
|
279 |
|
280 |
<div id="fragment-5-1" class="tabs-div">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
<table class="form-table">
|
282 |
<tr>
|
283 |
<td>
|
@@ -295,7 +320,7 @@ $emails = $ThemeMyLogin->GetOption('emails');
|
|
295 |
</table>
|
296 |
</div>
|
297 |
|
298 |
-
<div id="fragment-5-
|
299 |
<table class="form-table">
|
300 |
<tr>
|
301 |
<td>
|
@@ -309,7 +334,7 @@ $emails = $ThemeMyLogin->GetOption('emails');
|
|
309 |
</table>
|
310 |
</div>
|
311 |
|
312 |
-
<div id="fragment-5-
|
313 |
<table class="form-table">
|
314 |
<tr>
|
315 |
<td>
|
7 |
|
8 |
check_admin_referer('theme-my-login-settings');
|
9 |
|
10 |
+
$ThemeMyLogin->options['general']['uninstall'] = ( isset($_POST['general']['uninstall']) ) ? 1 : 0;
|
11 |
+
$ThemeMyLogin->options['general']['defaults'] = ( isset($_POST['general']['defaults']) ) ? 1 : 0;
|
12 |
+
$ThemeMyLogin->options['general']['show_page'] = ( isset($_POST['general']['show_page']) ) ? 1 : 0;
|
13 |
+
$ThemeMyLogin->options['general']['custom_pass'] = ( isset($_POST['general']['custom_pass']) ) ? 1 : 0;
|
14 |
+
$ThemeMyLogin->options['general']['from_name'] = stripslashes($_POST['general']['from_name']);
|
15 |
+
$ThemeMyLogin->options['general']['from_email'] = stripslashes($_POST['general']['from_email']);
|
16 |
|
17 |
$ThemeMyLogin->SetOption('titles', stripslashes_deep($_POST['titles']));
|
18 |
$ThemeMyLogin->SetOption('messages', stripslashes_deep($_POST['messages']));
|
19 |
|
|
|
|
|
20 |
foreach ( $_POST['links'] as $role => $tmp ) {
|
21 |
foreach ( $tmp as $key => $data ) {
|
22 |
$links[$role][] = array('title' => $data['title'], 'url' => $data['url']);
|
29 |
$ThemeMyLogin->SetOption('redirects', $redirects);
|
30 |
foreach ( $_POST['emails'] as $email => $data ) {
|
31 |
$emails[$email] = array('subject' => stripslashes($data['subject']), 'message' => stripslashes($data['message']));
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
+
$emails['newregistration']['admin-disable'] = ( isset($_POST['emails']['newregistration']['admin-disable']) ) ? 1 : 0;
|
34 |
+
$emails['newregistration']['user-disable'] = ( isset($_POST['emails']['newregistration']['user-disable']) ) ? 1 : 0;
|
35 |
+
$emails['resetpassword']['admin-disable'] = ( isset($_POST['emails']['resetpassword']['admin-disable']) ) ? 1 : 0;
|
36 |
$ThemeMyLogin->SetOption('emails', $emails);
|
37 |
$ThemeMyLogin->SaveOptions();
|
38 |
|
93 |
<tr valign="top">
|
94 |
<th scope="row"><?php _e('Plugin', 'theme-my-login'); ?></th>
|
95 |
<td>
|
96 |
+
<input name="general[uninstall]" type="checkbox" id="general[uninstall]" value="1" <?php if ( isset($ThemeMyLogin->options['general']['uninstall']) && true == $ThemeMyLogin->options['general']['uninstall'] ) { echo 'checked="checked"'; } ?> />
|
97 |
<label for="general[uninstall]"><?php _e('Uninstall', 'theme-my-login'); ?></label>
|
98 |
</td>
|
99 |
</tr>
|
100 |
<tr valign="top">
|
101 |
<th scope="row"><?php _e('Defaults', 'theme-my-login'); ?></th>
|
102 |
<td>
|
103 |
+
<input name="general[defaults]" type="checkbox" id="general[defaults]" value="1" <?php if ( isset($ThemeMyLogin->options['general']['defaults']) && true == $ThemeMyLogin->options['general']['defaults'] ) { echo 'checked="checked"'; } ?> />
|
104 |
<label for="general[defaults]"><?php _e('Reset Defaults', 'theme-my-login'); ?></label>
|
105 |
</td>
|
106 |
</tr>
|
107 |
<tr valign="top">
|
108 |
<th scope="row"><?php _e('Page List', 'theme-my-login'); ?></th>
|
109 |
<td>
|
110 |
+
<input name="general[show_page]" type="checkbox" id="general[show_page]" value="1" <?php if ( isset($ThemeMyLogin->options['general']['show_page']) && $ThemeMyLogin->options['general']['show_page'] ) { echo 'checked="checked"'; } ?> />
|
111 |
<label for="general[show_page]"><?php _e('Show Login Page', 'theme-my-login'); ?></label>
|
112 |
</td>
|
113 |
</tr>
|
114 |
+
<tr valign="top">
|
115 |
+
<th scope="row"><?php _e('Registration', 'theme-my-login'); ?></th>
|
116 |
+
<td>
|
117 |
+
<input name="general[custom_pass]" type="checkbox" id="general[custom_pass]" value="1" <?php if ( isset($ThemeMyLogin->options['general']['custom_pass']) && true == $ThemeMyLogin->options['general']['custom_pass'] ) { echo 'checked="checked"'; } ?> />
|
118 |
+
<label for="general[custom_pass]"><?php _e('Allow Users To Set Their Own Password', 'theme-my-login'); ?></label>
|
119 |
+
</td>
|
120 |
+
</tr>
|
121 |
</table>
|
122 |
|
123 |
</div>
|
279 |
<div id="fragment-5" class="tabs-div">
|
280 |
|
281 |
<ul class="tabs-nav">
|
282 |
+
<li><a href="#fragment-5-1">General</a></li>
|
283 |
+
<li><a href="#fragment-5-2">New Registration</a></li>
|
284 |
+
<li><a href="#fragment-5-3">Password Retrieval</a></li>
|
285 |
+
<li><a href="#fragment-5-4">Password Reset</a></li>
|
286 |
</ul>
|
287 |
|
288 |
<div id="fragment-5-1" class="tabs-div">
|
289 |
+
<table class="form-table">
|
290 |
+
<tr valign="top">
|
291 |
+
<td>
|
292 |
+
<label for="general[from_name]"><?php _e('From Name', 'theme-my-login'); ?></label><br />
|
293 |
+
<input name="general[from_name]" type="text" id="general[from_name]" value="<?php echo htmlspecialchars($ThemeMyLogin->options['general']['from_name']); ?>" class="regular-text" />
|
294 |
+
</td>
|
295 |
+
</tr>
|
296 |
+
<tr valign="top">
|
297 |
+
<td>
|
298 |
+
<label for="general[from_email]"><?php _e('From E-mail', 'theme-my-login'); ?></label><br />
|
299 |
+
<input name="general[from_email]" type="text" id="general[from_email]" value="<?php echo htmlspecialchars($ThemeMyLogin->options['general']['from_email']); ?>" class="regular-text" />
|
300 |
+
</td>
|
301 |
+
</tr>
|
302 |
+
</table>
|
303 |
+
</div>
|
304 |
+
|
305 |
+
<div id="fragment-5-2" class="tabs-div">
|
306 |
<table class="form-table">
|
307 |
<tr>
|
308 |
<td>
|
320 |
</table>
|
321 |
</div>
|
322 |
|
323 |
+
<div id="fragment-5-3" class="tabs-div">
|
324 |
<table class="form-table">
|
325 |
<tr>
|
326 |
<td>
|
334 |
</table>
|
335 |
</div>
|
336 |
|
337 |
+
<div id="fragment-5-4" class="tabs-div">
|
338 |
<table class="form-table">
|
339 |
<tr>
|
340 |
<td>
|
readme.txt
CHANGED
@@ -21,6 +21,7 @@ This plugin themes the WordPress login, registration and forgot password pages a
|
|
21 |
* Show gravatar to users who are logged in
|
22 |
* Assign custom links to users who are logged in based on their role
|
23 |
* Customize user emails for registration and/or password recovery
|
|
|
24 |
|
25 |
|
26 |
== Installation ==
|
@@ -36,6 +37,11 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
|
|
36 |
|
37 |
== Changelog ==
|
38 |
|
|
|
|
|
|
|
|
|
|
|
39 |
= 4.0 =
|
40 |
* Implemented custom links for logged in users based on role
|
41 |
* Implemented custom redirection upon log in based on role
|
21 |
* Show gravatar to users who are logged in
|
22 |
* Assign custom links to users who are logged in based on their role
|
23 |
* Customize user emails for registration and/or password recovery
|
24 |
+
* Allow users to set their own password upon registration
|
25 |
|
26 |
|
27 |
== Installation ==
|
37 |
|
38 |
== Changelog ==
|
39 |
|
40 |
+
= 4.1 =
|
41 |
+
* Implemented custom user passwords
|
42 |
+
* Implemented custom e-mail from name & address
|
43 |
+
* Removed template tag & shortcode restriction on main login page
|
44 |
+
|
45 |
= 4.0 =
|
46 |
* Implemented custom links for logged in users based on role
|
47 |
* Implemented custom redirection upon log in based on role
|
theme-my-login.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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: 4.
|
7 |
Author: Jeff Farthing
|
8 |
Author URI: http://www.jfarthing.com
|
9 |
Text Domain: theme-my-login
|
@@ -21,7 +21,7 @@ if ($wp_version < '2.6') {
|
|
21 |
if (!class_exists('ThemeMyLogin')) {
|
22 |
class ThemeMyLogin extends WPPluginShell {
|
23 |
|
24 |
-
var $version = '4.
|
25 |
var $options = array();
|
26 |
var $permalink = '';
|
27 |
var $instances = 0;
|
@@ -36,9 +36,13 @@ if (!class_exists('ThemeMyLogin')) {
|
|
36 |
register_activation_hook ( __FILE__, array( &$this, 'Activate' ) );
|
37 |
register_deactivation_hook ( __FILE__, array( &$this, 'Deactivate' ) );
|
38 |
|
39 |
-
$this->AddAction('parse_request');
|
40 |
$this->AddAction('init');
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
$this->AddFilter('wp_head');
|
43 |
$this->AddFilter('wp_title');
|
44 |
$this->AddFilter('the_title');
|
@@ -86,6 +90,8 @@ if (!class_exists('ThemeMyLogin')) {
|
|
86 |
|
87 |
$this->LoadOptions();
|
88 |
|
|
|
|
|
89 |
$this->WPPluginShell();
|
90 |
|
91 |
}
|
@@ -124,18 +130,23 @@ if (!class_exists('ThemeMyLogin')) {
|
|
124 |
}
|
125 |
|
126 |
function Deactivate() {
|
127 |
-
if ( $this->
|
128 |
delete_option('theme_my_login');
|
129 |
wp_delete_post($this->options['general']['page_id']);
|
130 |
}
|
131 |
}
|
132 |
|
133 |
function InitOptions($save = false) {
|
134 |
-
|
|
|
|
|
|
|
135 |
$this->options['general']['uninstall'] = 0;
|
136 |
$this->options['general']['defaults'] = 0;
|
137 |
$this->options['general']['show_page'] = 0;
|
138 |
-
$this->options['general']['
|
|
|
|
|
139 |
|
140 |
$this->options['titles']['welcome'] = __('Welcome') . ', %display_name%';
|
141 |
$this->options['titles']['login'] = __('Log In');
|
@@ -148,7 +159,6 @@ if (!class_exists('ThemeMyLogin')) {
|
|
148 |
$this->options['messages']['lostpassword'] = __('Please enter your username or e-mail address. You will receive a new password via e-mail.');
|
149 |
|
150 |
$this->options['widget']['default_action'] = 'login';
|
151 |
-
$this->options['widget']['show_all_msgs'] = 0;
|
152 |
$this->options['widget']['show_title'] = 1;
|
153 |
$this->options['widget']['show_links'] = 1;
|
154 |
$this->options['widget']['registration'] = 1;
|
@@ -185,29 +195,13 @@ if (!class_exists('ThemeMyLogin')) {
|
|
185 |
if ( $save )
|
186 |
$this->SaveOptions();
|
187 |
}
|
188 |
-
|
189 |
-
function ParseRequest() {
|
190 |
-
global $WPLogin, $wp;
|
191 |
-
|
192 |
-
$page_id = isset($wp->query_vars['page_id']) ? $wp->query_vars['page_id'] : 0;
|
193 |
-
$pagename = isset($wp->query_vars['pagename']) ? $wp->query_vars['pagename'] : '';
|
194 |
-
|
195 |
-
if ( isset($page_id) && $page_id == $this->options['general']['page_id'] || isset($pagename) && strtolower($pagename) == 'login' ) {
|
196 |
-
if ( is_user_logged_in() && 'logout' != $_GET['action'] ) {
|
197 |
-
wp_redirect(get_bloginfo('home'));
|
198 |
-
exit();
|
199 |
-
}
|
200 |
-
}
|
201 |
-
if ( strpos($_SERVER['REQUEST_URI'], '/wp-admin') === false )
|
202 |
-
$WPLogin = new WPLogin('theme-my-login', $this->options);
|
203 |
-
}
|
204 |
|
205 |
function Init() {
|
206 |
-
global $
|
207 |
-
|
208 |
-
$this->permalink = get_permalink($this->options['general']['page_id']);
|
209 |
|
210 |
-
|
|
|
|
|
211 |
case 'wp-register.php':
|
212 |
case 'wp-login.php':
|
213 |
$redirect_to = add_query_arg($_GET, $this->permalink);
|
@@ -215,23 +209,76 @@ if (!class_exists('ThemeMyLogin')) {
|
|
215 |
exit();
|
216 |
break;
|
217 |
}
|
|
|
|
|
|
|
|
|
218 |
|
219 |
-
if (
|
220 |
$admin_color = get_usermeta($user_ID, 'admin_color');
|
221 |
if ( 'classic' == $admin_color ) {
|
222 |
$this->AddAdminStyle('jquery-colors-classic', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-classic/wp-colors-classic.css');
|
223 |
} else {
|
224 |
$this->AddAdminStyle('jquery-colors-fresh', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css');
|
225 |
}
|
226 |
-
} elseif (
|
227 |
$this->AddAdminStyle('jquery-colors-fresh', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css');
|
228 |
-
} elseif (
|
229 |
$this->AddAdminStyle('jquery-colors-classic', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-classic/wp-colors-classic.css');
|
230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
|
233 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
if ( !is_admin() )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
do_action('login_head');
|
236 |
}
|
237 |
|
@@ -243,7 +290,7 @@ if (!class_exists('ThemeMyLogin')) {
|
|
243 |
$titles = $this->GetOption('titles');
|
244 |
|
245 |
$action = ( isset($WPLogin->options['action']) ) ? $WPLogin->options['action'] : '';
|
246 |
-
if ( 'tml-
|
247 |
$action = $WPLogin->action;
|
248 |
|
249 |
if ( is_user_logged_in() )
|
@@ -278,9 +325,9 @@ if (!class_exists('ThemeMyLogin')) {
|
|
278 |
|
279 |
if ( is_user_logged_in() )
|
280 |
return $titles['logout'];
|
281 |
-
|
282 |
$action = ( isset($WPLogin->options['action']) ) ? $WPLogin->options['action'] : '';
|
283 |
-
if ( 'tml-
|
284 |
$action = $WPLogin->action;
|
285 |
|
286 |
switch ($action) {
|
@@ -390,16 +437,10 @@ if (!class_exists('ThemeMyLogin')) {
|
|
390 |
return $message;
|
391 |
}
|
392 |
|
393 |
-
function ThemeMyLoginShortcode($args =
|
394 |
global $WPLogin;
|
395 |
|
396 |
-
|
397 |
-
$WPLogin = new WPLogin();
|
398 |
-
|
399 |
-
if ( is_page($this->options['general']['page_id']) && !$is_page )
|
400 |
-
return;
|
401 |
-
|
402 |
-
$instance = ( isset($args['instance']) ) ? $args['instance'] : $this->NewInstance();
|
403 |
|
404 |
$options = $this->options;
|
405 |
foreach ( $args as $key => $value ) {
|
@@ -408,37 +449,26 @@ if (!class_exists('ThemeMyLogin')) {
|
|
408 |
$options['titles'][$key] = $value;
|
409 |
elseif ( in_array($key, array('register', 'success', 'lostpassword')) )
|
410 |
$options['messages'][$key] = $value;
|
411 |
-
elseif ( in_array($key, array('
|
412 |
$options['widget'][$key] = $value;
|
413 |
} else {
|
414 |
foreach ( $value as $k => $v )
|
415 |
$options[$key][$k] = $v;
|
416 |
}
|
417 |
}
|
418 |
-
|
419 |
-
|
420 |
-
if ( isset($args[$type]) )
|
421 |
-
$options[$type] = array_merge($tmp, $args[$type]);
|
422 |
-
else
|
423 |
-
$options[$type] = $tmp;
|
424 |
-
}
|
425 |
-
*/
|
426 |
|
427 |
return $WPLogin->Display($instance, $options);
|
428 |
}
|
429 |
|
430 |
|
431 |
-
function ThemeMyLoginPageShortcode($args =
|
|
|
432 |
$args['widget']['default_action'] = 'login';
|
433 |
$args['widget']['show_title'] = '0';
|
434 |
-
$args['widget']['show_all_msgs'] = '1';
|
435 |
$args['widget']['before_widget'] = '';
|
436 |
$args['widget']['after_widget'] = '';
|
437 |
-
return $this->ThemeMyLoginShortcode($args, true);
|
438 |
-
}
|
439 |
-
|
440 |
-
function TemplateTag($args = '') {
|
441 |
-
$args = wp_parse_args($args);
|
442 |
return $this->ThemeMyLoginShortcode($args);
|
443 |
}
|
444 |
|
@@ -455,20 +485,22 @@ if (class_exists('ThemeMyLogin')) {
|
|
455 |
$ThemeMyLogin = new ThemeMyLogin();
|
456 |
|
457 |
if ( version_compare($wp_version, '2.8', '>=') ) {
|
458 |
-
|
459 |
} else {
|
460 |
-
|
461 |
}
|
462 |
|
|
|
463 |
function theme_my_login($args = '') {
|
464 |
global $ThemeMyLogin;
|
465 |
|
466 |
-
echo $ThemeMyLogin->
|
467 |
}
|
468 |
-
|
|
|
469 |
if ( !function_exists('wp_new_user_notification') ) :
|
470 |
function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
471 |
-
global $ThemeMyLogin;
|
472 |
|
473 |
$user = new WP_User($user_id);
|
474 |
|
@@ -501,7 +533,7 @@ if (class_exists('ThemeMyLogin')) {
|
|
501 |
else {
|
502 |
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
|
503 |
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
|
504 |
-
$message .= wp_login_url() . "\r\n";
|
505 |
}
|
506 |
|
507 |
wp_mail($user_email, $subject, $message);
|
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: 4.1
|
7 |
Author: Jeff Farthing
|
8 |
Author URI: http://www.jfarthing.com
|
9 |
Text Domain: theme-my-login
|
21 |
if (!class_exists('ThemeMyLogin')) {
|
22 |
class ThemeMyLogin extends WPPluginShell {
|
23 |
|
24 |
+
var $version = '4.1';
|
25 |
var $options = array();
|
26 |
var $permalink = '';
|
27 |
var $instances = 0;
|
36 |
register_activation_hook ( __FILE__, array( &$this, 'Activate' ) );
|
37 |
register_deactivation_hook ( __FILE__, array( &$this, 'Deactivate' ) );
|
38 |
|
|
|
39 |
$this->AddAction('init');
|
40 |
+
$this->AddAction('admin_init');
|
41 |
+
$this->AddAction('template_redirect');
|
42 |
+
|
43 |
+
$this->AddAction('register_form');
|
44 |
+
$this->AddAction('registration_errors');
|
45 |
+
|
46 |
$this->AddFilter('wp_head');
|
47 |
$this->AddFilter('wp_title');
|
48 |
$this->AddFilter('the_title');
|
90 |
|
91 |
$this->LoadOptions();
|
92 |
|
93 |
+
$this->SetMailFrom($this->options['general']['from_email'], $this->options['general']['from_name']);
|
94 |
+
|
95 |
$this->WPPluginShell();
|
96 |
|
97 |
}
|
130 |
}
|
131 |
|
132 |
function Deactivate() {
|
133 |
+
if ( $this->options['general']['uninstall'] ) {
|
134 |
delete_option('theme_my_login');
|
135 |
wp_delete_post($this->options['general']['page_id']);
|
136 |
}
|
137 |
}
|
138 |
|
139 |
function InitOptions($save = false) {
|
140 |
+
|
141 |
+
$login_page = get_page_by_title('login');
|
142 |
+
$this->options['general']['page_id'] = ( $login_page ) ? $login_page->ID : 0;
|
143 |
+
|
144 |
$this->options['general']['uninstall'] = 0;
|
145 |
$this->options['general']['defaults'] = 0;
|
146 |
$this->options['general']['show_page'] = 0;
|
147 |
+
$this->options['general']['custom_pass'] = 0;
|
148 |
+
$this->options['general']['from_name'] = '';
|
149 |
+
$this->options['general']['from_email'] = '';
|
150 |
|
151 |
$this->options['titles']['welcome'] = __('Welcome') . ', %display_name%';
|
152 |
$this->options['titles']['login'] = __('Log In');
|
159 |
$this->options['messages']['lostpassword'] = __('Please enter your username or e-mail address. You will receive a new password via e-mail.');
|
160 |
|
161 |
$this->options['widget']['default_action'] = 'login';
|
|
|
162 |
$this->options['widget']['show_title'] = 1;
|
163 |
$this->options['widget']['show_links'] = 1;
|
164 |
$this->options['widget']['registration'] = 1;
|
195 |
if ( $save )
|
196 |
$this->SaveOptions();
|
197 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
function Init() {
|
200 |
+
global $pagenow;
|
|
|
|
|
201 |
|
202 |
+
$this->permalink = get_permalink($this->options['general']['page_id']);
|
203 |
+
|
204 |
+
switch ( $pagenow ) {
|
205 |
case 'wp-register.php':
|
206 |
case 'wp-login.php':
|
207 |
$redirect_to = add_query_arg($_GET, $this->permalink);
|
209 |
exit();
|
210 |
break;
|
211 |
}
|
212 |
+
}
|
213 |
+
|
214 |
+
function AdminInit() {
|
215 |
+
global $user_ID, $wp_version, $pagenow;
|
216 |
|
217 |
+
if ( version_compare($wp_version, '2.8', '>=') ) {
|
218 |
$admin_color = get_usermeta($user_ID, 'admin_color');
|
219 |
if ( 'classic' == $admin_color ) {
|
220 |
$this->AddAdminStyle('jquery-colors-classic', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-classic/wp-colors-classic.css');
|
221 |
} else {
|
222 |
$this->AddAdminStyle('jquery-colors-fresh', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css');
|
223 |
}
|
224 |
+
} elseif ( version_compare($wp_version, '2.7', '>=') ) {
|
225 |
$this->AddAdminStyle('jquery-colors-fresh', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css');
|
226 |
+
} elseif ( version_compare($wp_version, '2.5', '>=') ) {
|
227 |
$this->AddAdminStyle('jquery-colors-classic', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-classic/wp-colors-classic.css');
|
228 |
}
|
229 |
+
|
230 |
+
if ( 'page.php' == $pagenow && (isset($_REQUEST['post']) && $this->options['general']['page_id'] == $_REQUEST['post']) )
|
231 |
+
add_action('admin_notices', array(&$this, 'PageEditNotice'));
|
232 |
+
}
|
233 |
+
|
234 |
+
function PageEditNotice() {
|
235 |
+
echo '<div class="error"><p>' . __('NOTICE: This page is integral to the operation of Theme My Login. <strong>DO NOT</strong> edit the title or remove the short code from the contents.') . '</p></div>';
|
236 |
}
|
237 |
|
238 |
+
function TemplateRedirect() {
|
239 |
+
global $WPLogin;
|
240 |
+
|
241 |
+
if ( is_page($this->options['general']['page_id']) ) {
|
242 |
+
$action = ( isset($_GET['action']) ) ? $_GET['action'] : '';
|
243 |
+
if ( is_user_logged_in() && 'logout' != $action ) {
|
244 |
+
wp_redirect(get_bloginfo('home'));
|
245 |
+
exit();
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
if ( !is_admin() )
|
250 |
+
$WPLogin = new WPLogin('theme-my-login', $this->options);
|
251 |
+
}
|
252 |
+
|
253 |
+
function RegisterForm($instance) {
|
254 |
+
if ( isset($this->options['general']['custom_pass']) && true == $this->options['general']['custom_pass'] ) {
|
255 |
+
?>
|
256 |
+
<p><label><?php _e('Password:');?> <br />
|
257 |
+
<input autocomplete="off" name="pass1" id="pass1-<?php echo $instance; ?>" class="input" size="20" value="" type="password" /></label><br />
|
258 |
+
<label><?php _e('Confirm Password:');?> <br />
|
259 |
+
<input autocomplete="off" name="pass2" id="pass2-<?php echo $instance; ?>" class="input" size="20" value="" type="password" /></label></p>
|
260 |
+
<?php
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
function RegistrationErrors($errors){
|
265 |
+
if ( isset($this->options['general']['custom_pass']) && true == $this->options['general']['custom_pass'] ) {
|
266 |
+
if (empty($_POST['pass1']) || $_POST['pass1'] == '' || empty($_POST['pass2']) || $_POST['pass2'] == ''){
|
267 |
+
$errors->add('empty_password', __('<strong>ERROR</strong>: Please enter a password.'));
|
268 |
+
} elseif ($_POST['pass1'] !== $_POST['pass2']){
|
269 |
+
$errors->add('password_mismatch', __('<strong>ERROR</strong>: Your passwords do not match.'));
|
270 |
+
} elseif (strlen($_POST['pass1'])<6){
|
271 |
+
$errors->add('password_length', __('<strong>ERROR</strong>: Your password must be at least 6 characters in length.'));
|
272 |
+
} else {
|
273 |
+
$_POST['user_pw'] = $_POST['pass1'];
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
return $errors;
|
278 |
+
}
|
279 |
+
|
280 |
+
function WPHead() {
|
281 |
+
if ( !is_admin() && $this->instances > 0 )
|
282 |
do_action('login_head');
|
283 |
}
|
284 |
|
290 |
$titles = $this->GetOption('titles');
|
291 |
|
292 |
$action = ( isset($WPLogin->options['action']) ) ? $WPLogin->options['action'] : '';
|
293 |
+
if ( 'tml-main' == $WPLogin->instance || empty($WPLogin->instance) )
|
294 |
$action = $WPLogin->action;
|
295 |
|
296 |
if ( is_user_logged_in() )
|
325 |
|
326 |
if ( is_user_logged_in() )
|
327 |
return $titles['logout'];
|
328 |
+
|
329 |
$action = ( isset($WPLogin->options['action']) ) ? $WPLogin->options['action'] : '';
|
330 |
+
if ( 'tml-main' == $WPLogin->instance || empty($WPLogin->instance) )
|
331 |
$action = $WPLogin->action;
|
332 |
|
333 |
switch ($action) {
|
437 |
return $message;
|
438 |
}
|
439 |
|
440 |
+
function ThemeMyLoginShortcode($args = array()) {
|
441 |
global $WPLogin;
|
442 |
|
443 |
+
$args = wp_parse_args($args);
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
|
445 |
$options = $this->options;
|
446 |
foreach ( $args as $key => $value ) {
|
449 |
$options['titles'][$key] = $value;
|
450 |
elseif ( in_array($key, array('register', 'success', 'lostpassword')) )
|
451 |
$options['messages'][$key] = $value;
|
452 |
+
elseif ( in_array($key, array('instance', 'default_action', 'show_title', 'show_links', 'registration', 'lostpassword', 'show_logged', 'show_gravatar', 'gravatar_size', 'before_widget', 'after_widget', 'before_title', 'after_title')) )
|
453 |
$options['widget'][$key] = $value;
|
454 |
} else {
|
455 |
foreach ( $value as $k => $v )
|
456 |
$options[$key][$k] = $v;
|
457 |
}
|
458 |
}
|
459 |
+
|
460 |
+
$instance = ( isset($options['widget']['instance']) ) ? $options['widget']['instance'] : $this->NewInstance();
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
|
462 |
return $WPLogin->Display($instance, $options);
|
463 |
}
|
464 |
|
465 |
|
466 |
+
function ThemeMyLoginPageShortcode($args = array()) {
|
467 |
+
$args['widget']['instance'] = 'tml-main';
|
468 |
$args['widget']['default_action'] = 'login';
|
469 |
$args['widget']['show_title'] = '0';
|
|
|
470 |
$args['widget']['before_widget'] = '';
|
471 |
$args['widget']['after_widget'] = '';
|
|
|
|
|
|
|
|
|
|
|
472 |
return $this->ThemeMyLoginShortcode($args);
|
473 |
}
|
474 |
|
485 |
$ThemeMyLogin = new ThemeMyLogin();
|
486 |
|
487 |
if ( version_compare($wp_version, '2.8', '>=') ) {
|
488 |
+
require_once (WP_PLUGIN_DIR . '/theme-my-login/classes/class.widget-new.php');
|
489 |
} else {
|
490 |
+
require_once (WP_PLUGIN_DIR . '/theme-my-login/classes/class.widget-old.php');
|
491 |
}
|
492 |
|
493 |
+
if ( !function_exists('theme_my_login') ) :
|
494 |
function theme_my_login($args = '') {
|
495 |
global $ThemeMyLogin;
|
496 |
|
497 |
+
echo $ThemeMyLogin->ThemeMyLoginShortcode($args);
|
498 |
}
|
499 |
+
endif;
|
500 |
+
|
501 |
if ( !function_exists('wp_new_user_notification') ) :
|
502 |
function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
503 |
+
global $ThemeMyLogin, $wp_version;
|
504 |
|
505 |
$user = new WP_User($user_id);
|
506 |
|
533 |
else {
|
534 |
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
|
535 |
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
|
536 |
+
$message .= ( version_compare($wp_version, '2.7', '>=') ) ? wp_login_url() . "\r\n" : site_url('wp-login.php', 'login') . "\r\n";
|
537 |
}
|
538 |
|
539 |
wp_mail($user_email, $subject, $message);
|