Version Description
- Added the option to require approval for new registrations
- Added the option to enable/disable plugin stylesheet
- Removed form input fields from label tags
- Dropped support for WordPress versions older than 2.6
Download this release
Release Info
Developer | jfarthing84 |
Plugin | Theme My Login |
Version | 4.3 |
Comparing to | |
See all releases |
Code changes from version 4.2.2 to 4.3
- admin/admin-email.php +111 -0
- admin/admin-general.php +40 -0
- admin/admin-links.php +60 -0
- admin/admin-redirection.php +31 -0
- admin/admin-template.php +75 -0
- admin/admin.php +153 -0
- classes/class.widget-new.php +18 -20
- classes/class.widget-old.php +24 -30
- classes/class.wp-login.php +50 -69
- css/theme-my-login-admin.css +16 -0
- css/theme-my-login-admin.css.php +0 -49
- css/theme-my-login.css +6 -0
- includes/admin-page.php +0 -397
- includes/compat.php +0 -145
- readme.txt +7 -0
- theme-my-login.php +422 -281
admin/admin-email.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<ul class="tabs-nav">
|
2 |
+
<li><a href="#fragment-5-1">General</a></li>
|
3 |
+
<li><a href="#fragment-5-2">New Registration</a></li>
|
4 |
+
<li><a href="#fragment-5-3">Password Retrieval</a></li>
|
5 |
+
<li><a href="#fragment-5-4">Password Reset</a></li>
|
6 |
+
<li><a href="#fragment-5-5">User Approval</a></li>
|
7 |
+
<li><a href="#fragment-5-6">User Denial</a></li>
|
8 |
+
</ul>
|
9 |
+
|
10 |
+
<div id="fragment-5-1" class="tabs-div">
|
11 |
+
<table class="form-table">
|
12 |
+
<tr valign="top">
|
13 |
+
<td>
|
14 |
+
<label for="email_from_name"><?php _e('From Name', 'theme-my-login'); ?></label><br />
|
15 |
+
<input name="email_from_name" type="text" id="email_from_name" value="<?php echo htmlspecialchars($ThemeMyLogin->options['email_from_name']); ?>" class="regular-text" />
|
16 |
+
</td>
|
17 |
+
</tr>
|
18 |
+
<tr valign="top">
|
19 |
+
<td>
|
20 |
+
<label for="email_from"><?php _e('From E-mail', 'theme-my-login'); ?></label><br />
|
21 |
+
<input name="email_from" type="text" id="email_from" value="<?php echo htmlspecialchars($ThemeMyLogin->options['email_from']); ?>" class="regular-text" />
|
22 |
+
</td>
|
23 |
+
</tr>
|
24 |
+
<tr valign="top">
|
25 |
+
<td>
|
26 |
+
<label for"email_content_type"><?php _e('E-mail Format', 'theme-my-login'); ?></label><br />
|
27 |
+
<select name="email_content_type" id="email_content_type">
|
28 |
+
<option value="text/plain"<?php if ('text/plain' == $ThemeMyLogin->options['email_content_type']) echo ' selected="selected"'; ?>>Plain Text</option>
|
29 |
+
<option value="text/html"<?php if ('text/html' == $ThemeMyLogin->options['email_content_type']) echo ' selected="selected"'; ?>>HTML</option>
|
30 |
+
</select>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
</table>
|
34 |
+
</div>
|
35 |
+
|
36 |
+
<div id="fragment-5-2" class="tabs-div">
|
37 |
+
<table class="form-table">
|
38 |
+
<tr>
|
39 |
+
<td>
|
40 |
+
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%, %user_ip%</em></p>
|
41 |
+
Subject<br />
|
42 |
+
<input name="registration_subject" type="text" id="registration_subject" value="<?php echo htmlspecialchars($ThemeMyLogin->options['registration_email']['subject']); ?>" class="full-text" /><br />
|
43 |
+
Message<br />
|
44 |
+
<textarea name="registration_message" id="registration_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['registration_email']['message']); ?></textarea><br />
|
45 |
+
<p>
|
46 |
+
<label for "registration_admin_disable"><input name="registration_admin_disable" type="checkbox" id="registration_admin_disable" value="1" <?php if ( $ThemeMyLogin->options['registration_email']['admin_disable'] ) { echo 'checked="checked"'; } ?> /> Disable Admin Notification</label>
|
47 |
+
<label for "registration_user_disable"><input name="registration_user_disable" type="checkbox" id="registration_user_disable" value="1" <?php if ( $ThemeMyLogin->options['registration_email']['user_disable'] ) { echo 'checked="checked"'; } ?> /> Disable User Notification</label>
|
48 |
+
</p>
|
49 |
+
</td>
|
50 |
+
</tr>
|
51 |
+
</table>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<div id="fragment-5-3" class="tabs-div">
|
55 |
+
<table class="form-table">
|
56 |
+
<tr>
|
57 |
+
<td>
|
58 |
+
<p><em>Avilable Variables: %blogname%, %siteurl%, %reseturl%, %user_login%, %user_email%, %user_ip%</em></p>
|
59 |
+
Subject<br />
|
60 |
+
<input name="retrieve_pass_subject" type="text" id="retrieve_pass_subject" value="<?php echo htmlspecialchars($ThemeMyLogin->options['retrieve_pass_email']['subject']); ?>" class="full-text" /><br />
|
61 |
+
Message<br />
|
62 |
+
<textarea name="retrieve_pass_message" id="retrieve_pass_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['retrieve_pass_email']['message']); ?></textarea><br />
|
63 |
+
</td>
|
64 |
+
</tr>
|
65 |
+
</table>
|
66 |
+
</div>
|
67 |
+
|
68 |
+
<div id="fragment-5-4" class="tabs-div">
|
69 |
+
<table class="form-table">
|
70 |
+
<tr>
|
71 |
+
<td>
|
72 |
+
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%, %user_ip%</em></p>
|
73 |
+
Subject<br />
|
74 |
+
<input name="reset_pass_subject" type="text" id="reset_pass_subject" value="<?php echo htmlspecialchars($ThemeMyLogin->options['reset_pass_email']['subject']); ?>" class="full-text" /><br />
|
75 |
+
Message<br />
|
76 |
+
<textarea name="reset_pass_message" id="reset_pass_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['reset_pass_email']['message']); ?></textarea><br />
|
77 |
+
<p>
|
78 |
+
<label for "reset_pass_admin_disable"><input name="reset_pass_admin_disable" type="checkbox" id="reset_pass_admin_disable" value="1" <?php if ( $ThemeMyLogin->options['reset_pass_email']['admin_disable'] ) { echo 'checked="checked"'; } ?> /> Disable Admin Notification</label>
|
79 |
+
</p>
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
</table>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<div id="fragment-5-5" class="tabs-div">
|
86 |
+
<table class="form-table">
|
87 |
+
<tr>
|
88 |
+
<td>
|
89 |
+
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%</em></p>
|
90 |
+
Subject<br />
|
91 |
+
<input name="user_approval_subject" type="text" id="user_approval_subject" value="<?php echo htmlspecialchars($ThemeMyLogin->options['user_approval_email']['subject']); ?>" class="full-text" /><br />
|
92 |
+
Message<br />
|
93 |
+
<textarea name="user_approval_message" id="user_approval_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['user_approval_email']['message']); ?></textarea><br />
|
94 |
+
</td>
|
95 |
+
</tr>
|
96 |
+
</table>
|
97 |
+
</div>
|
98 |
+
|
99 |
+
<div id="fragment-5-6" class="tabs-div">
|
100 |
+
<table class="form-table">
|
101 |
+
<tr>
|
102 |
+
<td>
|
103 |
+
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%</em></p>
|
104 |
+
Subject<br />
|
105 |
+
<input name="user_denial_subject" type="text" id="user_denial_subject" value="<?php echo htmlspecialchars($ThemeMyLogin->options['user_denial_email']['subject']); ?>" class="full-text" /><br />
|
106 |
+
Message<br />
|
107 |
+
<textarea name="user_denial_message" id="user_denial_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['user_denial_email']['message']); ?></textarea><br />
|
108 |
+
</td>
|
109 |
+
</tr>
|
110 |
+
</table>
|
111 |
+
</div>
|
admin/admin-general.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr valign="top">
|
3 |
+
<th scope="row"><?php _e('Plugin', 'theme-my-login'); ?></th>
|
4 |
+
<td>
|
5 |
+
<input name="uninstall" type="checkbox" id="uninstall" value="1" <?php if ( $ThemeMyLogin->options['uninstall'] ) { echo 'checked="checked"'; } ?> />
|
6 |
+
<label for="uninstall"><?php _e('Uninstall', 'theme-my-login'); ?></label>
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
<tr valign="top">
|
10 |
+
<th scope="row"><?php _e('Defaults', 'theme-my-login'); ?></th>
|
11 |
+
<td>
|
12 |
+
<input name="defaults" type="checkbox" id="defaults" value="1" />
|
13 |
+
<label for="defaults"><?php _e('Reset Defaults', 'theme-my-login'); ?></label>
|
14 |
+
</td>
|
15 |
+
</tr>
|
16 |
+
<tr valign="top">
|
17 |
+
<th scope="row"><?php _e('Page List', 'theme-my-login'); ?></th>
|
18 |
+
<td>
|
19 |
+
<input name="show_page" type="checkbox" id="show_page" value="1" <?php if ( $ThemeMyLogin->options['show_page'] ) { echo 'checked="checked"'; } ?> />
|
20 |
+
<label for="show_page"><?php _e('Show Login Page', 'theme-my-login'); ?></label>
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
<tr valign="top">
|
24 |
+
<th scope="row"><?php _e('Registration', 'theme-my-login'); ?></th>
|
25 |
+
<td>
|
26 |
+
<input name="custom_pass" type="checkbox" id="custom_pass" value="1" <?php if ( $ThemeMyLogin->options['custom_pass'] ) { echo 'checked="checked"'; } ?> />
|
27 |
+
<label for="custom_pass"><?php _e('Allow Users To Set Their Own Password', 'theme-my-login'); ?></label>
|
28 |
+
<br />
|
29 |
+
<input name="moderate_users" type="checkbox" id="moderate_users" value="1" <?php if ( $ThemeMyLogin->options['moderate_users'] ) { echo 'checked="checked"'; } ?> />
|
30 |
+
<label for="moderate_users"><?php _e('New Users Must Approved', 'theme-my-login'); ?></label>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
<tr valign="top">
|
34 |
+
<th scope="row"><label for="page_id"><?php _e('Page ID', 'theme-my-login'); ?></label></th>
|
35 |
+
<td>
|
36 |
+
<input name="page_id" type="text" id="page_id" value="<?php echo $ThemeMyLogin->options['page_id']; ?>" size="1" />
|
37 |
+
<span class="description"><strong>DO NOT</strong> change this unless you are <strong>ABSOLUTELY POSITIVE</strong> you know what you are doing!</span>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
</table>
|
admin/admin-links.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<ul class="tabs-nav">
|
2 |
+
<?php
|
3 |
+
$i = 1;
|
4 |
+
foreach ($user_roles as $role => $value) {
|
5 |
+
echo '<li><a href="#fragment-3-' . $i . '">' . ucwords($role) . '</a></li>' . "\n";
|
6 |
+
$i++;
|
7 |
+
}
|
8 |
+
?>
|
9 |
+
</ul>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
$i1 = 1;
|
13 |
+
foreach ($user_roles as $role => $value) {
|
14 |
+
?>
|
15 |
+
<div id="fragment-3-<?php echo $i1; ?>" class="tabs-div">
|
16 |
+
|
17 |
+
<table id="links-<?php echo $role; ?>" class="form-table link-table">
|
18 |
+
<?php $i2 = 0; ?>
|
19 |
+
<?php $alt = 'alternate'; ?>
|
20 |
+
<?php if ( is_array($links[$role]) ) { ?>
|
21 |
+
<?php foreach ( $links[$role] as $key => $data ) {
|
22 |
+
$alt = ('alternate' == $alt) ? '' : 'alternate';
|
23 |
+
?>
|
24 |
+
<tr id="link-row-<?php echo $i2; ?>" class="<?php echo $alt; ?>">
|
25 |
+
<td>
|
26 |
+
Title<br />
|
27 |
+
<input name="links[<?php echo $role; ?>][<?php echo $i2; ?>][title]" type="text" id="links[<?php echo $role; ?>][<?php echo $i2; ?>][title]" value="<?php echo htmlspecialchars($data['title']); ?>" class="regular-text link-title" /><br />
|
28 |
+
URL<br />
|
29 |
+
<input name="links[<?php echo $role; ?>][<?php echo $i2; ?>][url]" type="text" id="links[<?php echo $role; ?>][<?php echo $i2; ?>][url]" value="<?php echo $data['url']; ?>" class="extended-text link-url" /><br />
|
30 |
+
<p>
|
31 |
+
<a class="link remove <?php echo $role; ?>" href="" title="Remove This Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/remove.gif" /></a>
|
32 |
+
<a class="link add <?php echo $role; ?>" href="" title="Add Another Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/add.gif" /></a>
|
33 |
+
</p>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
<?php
|
37 |
+
$i2++;
|
38 |
+
}
|
39 |
+
} else { ?>
|
40 |
+
<tr id="link-row-0" class="">
|
41 |
+
<td>
|
42 |
+
Title<br />
|
43 |
+
<input name="links[<?php echo $role; ?>][0][title]" type="text" id="links[<?php echo $role; ?>][0][title]" value="" class="regular-text link-title" /><br />
|
44 |
+
URL<br />
|
45 |
+
<input name="links[<?php echo $role; ?>][0][url]" type="text" id="links[<?php echo $role; ?>][0][url]" value="" class="extended-text link-url" /><br />
|
46 |
+
<p>
|
47 |
+
<a class="link remove <?php echo $role; ?>" href="" title="Remove This Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/remove.gif" /></a>
|
48 |
+
<a class="link add <?php echo $role; ?>" href="" title="Add Another Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/add.gif" /></a>
|
49 |
+
</p>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
<?php } ?>
|
53 |
+
</table>
|
54 |
+
|
55 |
+
</div>
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$i1++;
|
59 |
+
}
|
60 |
+
?>
|
admin/admin-redirection.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<ul class="tabs-nav">
|
2 |
+
<?php
|
3 |
+
$i = 1;
|
4 |
+
foreach ($user_roles as $role => $value) {
|
5 |
+
echo '<li><a href="#fragment-4-' . $i . '">' . ucwords($role) . '</a></li>' . "\n";
|
6 |
+
$i++;
|
7 |
+
}
|
8 |
+
?>
|
9 |
+
</ul>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
$i1 = 1;
|
13 |
+
foreach ($user_roles as $role => $value) {
|
14 |
+
?>
|
15 |
+
<div id="fragment-4-<?php echo $i1; ?>" class="tabs-div">
|
16 |
+
|
17 |
+
<table id="redirection-<?php echo $role; ?>" class="form-table redirection-table">
|
18 |
+
<tr id="redirect-row-<?php echo $i2; ?>">
|
19 |
+
<td>
|
20 |
+
Log In URL<br />
|
21 |
+
<input name="redirects[<?php echo $role; ?>][login_url]" type="text" id="redirects[<?php echo $role; ?>][login_url]" value="<?php echo $redirects[$role]['login_url']; ?>" class="extended-text redirect-url" />
|
22 |
+
</td>
|
23 |
+
</tr>
|
24 |
+
</table>
|
25 |
+
|
26 |
+
</div>
|
27 |
+
|
28 |
+
<?php
|
29 |
+
$i1++;
|
30 |
+
}
|
31 |
+
?>
|
admin/admin-template.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<ul class="tabs-nav">
|
2 |
+
<li><a href="#fragment-2-1">General</a></li>
|
3 |
+
<li><a href="#fragment-2-2">Titles</a></li>
|
4 |
+
<li><a href="#fragment-2-3">Messages</a></li>
|
5 |
+
</ul>
|
6 |
+
|
7 |
+
<div id="fragment-2-1" class="tabs-div">
|
8 |
+
<table class="form-table">
|
9 |
+
<tr valign="top">
|
10 |
+
<th scope="row"><?php _e('Stylesheet', 'theme-my-login'); ?></th>
|
11 |
+
<td>
|
12 |
+
<input name="use_css" type="checkbox" id="use_css" value="1" <?php if ( $ThemeMyLogin->options['use_css'] ) { echo 'checked="checked"'; } ?> />
|
13 |
+
<label for="use_css"><?php _e('Use theme-my-login.css', 'theme-my-login'); ?></label>
|
14 |
+
</td>
|
15 |
+
</tr>
|
16 |
+
</table>
|
17 |
+
</div>
|
18 |
+
|
19 |
+
<div id="fragment-2-2" class="tabs-div">
|
20 |
+
<table class="form-table">
|
21 |
+
<tr valign="top">
|
22 |
+
<th scope="row"><label for="welcome_title"><?php _e('Welcome', 'theme-my-login'); ?></label></th>
|
23 |
+
<td>
|
24 |
+
<input name="welcome_title" type="text" id="welcome_title" value="<?php echo htmlspecialchars($ThemeMyLogin->options['welcome_title']); ?>" class="regular-text" />
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
<tr valign="top">
|
28 |
+
<th scope="row"><label for="login_title"><?php _e('Log In', 'theme-my-login'); ?></label></th>
|
29 |
+
<td>
|
30 |
+
<input name="login_title" type="text" id="login_title" value="<?php echo htmlspecialchars($ThemeMyLogin->options['login_title']); ?>" class="regular-text" />
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
<tr valign="top">
|
34 |
+
<th scope="row"><label for="register_title"><?php _e('Register', 'theme-my-login'); ?></label></th>
|
35 |
+
<td>
|
36 |
+
<input name="register_title" type="text" id="register_title" value="<?php echo htmlspecialchars($ThemeMyLogin->options['register_title']); ?>" class="regular-text" />
|
37 |
+
</td>
|
38 |
+
</tr>
|
39 |
+
<tr valign="top">
|
40 |
+
<th scope="row"><label for="lost_pass_title"><?php _e('Lost Password', 'theme-my-login'); ?></label></th>
|
41 |
+
<td>
|
42 |
+
<input name="lost_pass_title" type="text" id="lost_pass_title" value="<?php echo htmlspecialchars($ThemeMyLogin->options['lost_pass_title']); ?>" class="regular-text" />
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
<tr valign="top">
|
46 |
+
<th scope="row"><label for="logout_title"><?php _e('Log Out', 'theme-my-login'); ?></label></th>
|
47 |
+
<td>
|
48 |
+
<input name="logout_title" type="text" id="logout_title" value="<?php echo htmlspecialchars($ThemeMyLogin->options['logout_title']); ?>" class="regular-text" />
|
49 |
+
</td>
|
50 |
+
</tr>
|
51 |
+
</table>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<div id="fragment-2-3" class="tabs-div">
|
55 |
+
<table class="form-table">
|
56 |
+
<tr valign="top">
|
57 |
+
<th scope="row"><label for="register_message"><?php _e('Register', 'theme-my-login'); ?></label></th>
|
58 |
+
<td>
|
59 |
+
<input name="register_message" type="text" id="register_message" value="<?php echo htmlspecialchars($ThemeMyLogin->options['register_message']); ?>" class="extended-text" />
|
60 |
+
</td>
|
61 |
+
</tr>
|
62 |
+
<tr valign="top">
|
63 |
+
<th scope="row"><label for="success_message"><?php _e('Registration Complete', 'theme-my-login'); ?></label></th>
|
64 |
+
<td>
|
65 |
+
<input name="success_message" type="text" id="success_message" value="<?php echo htmlspecialchars($ThemeMyLogin->options['success_message']); ?>" class="extended-text" />
|
66 |
+
</td>
|
67 |
+
</tr>
|
68 |
+
<tr valign="top">
|
69 |
+
<th scope="row"><label for="lost_pass_message"><?php _e('Lost Password', 'theme-my-login'); ?></label></th>
|
70 |
+
<td>
|
71 |
+
<input name="lost_pass_message" type="text" id="lost_pass_message" value="<?php echo htmlspecialchars($ThemeMyLogin->options['lost_pass_message']); ?>" class="extended-text" />
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
</table>
|
75 |
+
</div>
|
admin/admin.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
global $ThemeMyLogin, $wp_roles, $wp_version;
|
4 |
+
$user_roles = $wp_roles->get_names();
|
5 |
+
|
6 |
+
if ( $_POST ) {
|
7 |
+
|
8 |
+
check_admin_referer('theme-my-login-settings');
|
9 |
+
|
10 |
+
$ThemeMyLogin->options['uninstall'] = isset($_POST['uninstall']) ? 1 : 0;
|
11 |
+
$ThemeMyLogin->options['show_page'] = isset($_POST['show_page']) ? 1 : 0;
|
12 |
+
$ThemeMyLogin->options['custom_pass'] = isset($_POST['custom_pass']) ? 1 : 0;
|
13 |
+
if ( isset($_POST['moderate_users']) ) {
|
14 |
+
$ThemeMyLogin->options['moderate_users'] = 1;
|
15 |
+
add_role('pending', 'Pending', array());
|
16 |
+
add_role('denied', 'Denied', array());
|
17 |
+
} else {
|
18 |
+
$ThemeMyLogin->options['moderate_users'] = 0;
|
19 |
+
remove_role('pending');
|
20 |
+
remove_role('denied');
|
21 |
+
}
|
22 |
+
$ThemeMyLogin->options['use_css'] = isset($_POST['use_css']) ? 1 : 0;
|
23 |
+
$ThemeMyLogin->options['page_id'] = (int) $_POST['page_id'];
|
24 |
+
$ThemeMyLogin->options['email_from_name'] = stripslashes($_POST['email_from_name']);
|
25 |
+
$ThemeMyLogin->options['email_from'] = stripslashes($_POST['email_from']);
|
26 |
+
$ThemeMyLogin->options['email_content_type'] = stripslashes($_POST['email_content_type']);
|
27 |
+
|
28 |
+
$ThemeMyLogin->options['welcome_title'] = stripslashes($_POST['welcome_title']);
|
29 |
+
$ThemeMyLogin->options['login_title'] = stripslashes($_POST['login_title']);
|
30 |
+
$ThemeMyLogin->options['register_title'] = stripslashes($_POST['register_title']);
|
31 |
+
$ThemeMyLogin->options['lost_pass_title'] = stripslashes($_POST['lost_pass_title']);
|
32 |
+
$ThemeMyLogin->options['logout_title'] = stripslashes($_POST['logout_title']);
|
33 |
+
|
34 |
+
$ThemeMyLogin->options['register_message'] = stripslashes($_POST['register_message']);
|
35 |
+
$ThemeMyLogin->options['success_message'] = stripslashes($_POST['success_message']);
|
36 |
+
$ThemeMyLogin->options['lost_pass_message'] = stripslashes($_POST['lost_pass_message']);
|
37 |
+
|
38 |
+
foreach ( $_POST['links'] as $role => $tmp ) {
|
39 |
+
foreach ( $tmp as $key => $data ) {
|
40 |
+
$links[$role][] = array('title' => $data['title'], 'url' => $data['url']);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
$ThemeMyLogin->options['links'] = $links;
|
44 |
+
|
45 |
+
foreach ( $_POST['redirects'] as $role => $data ) {
|
46 |
+
$redirects[$role] = array('login_url' => $data['login_url']);
|
47 |
+
}
|
48 |
+
$ThemeMyLogin->options['redirects'] = $redirects;
|
49 |
+
|
50 |
+
$ThemeMyLogin->options['retrieve_pass_email'] = array(
|
51 |
+
'subject' => stripslashes($_POST['retrieve_pass_subject']),
|
52 |
+
'message' => stripslashes($_POST['retrieve_pass_message'])
|
53 |
+
);
|
54 |
+
$ThemeMyLogin->options['reset_pass_email'] = array(
|
55 |
+
'subject' => stripslashes($_POST['reset_pass_subject']),
|
56 |
+
'message' => stripslashes($_POST['reset_pass_message']),
|
57 |
+
'admin_disable' => isset($_POST['reset_pass_admin_disable']) ? 1 : 0
|
58 |
+
);
|
59 |
+
$ThemeMyLogin->options['registration_email'] = array(
|
60 |
+
'subject' => stripslashes($_POST['registration_subject']),
|
61 |
+
'message' => stripslashes($_POST['registration_message']),
|
62 |
+
'admin_disable' => isset($_POST['registration_admin_disable']) ? 1 : 0,
|
63 |
+
'user_disable' => isset($_POST['registration_user_disable']) ? 1 : 0
|
64 |
+
);
|
65 |
+
$ThemeMyLogin->options['user_approval_email'] = array(
|
66 |
+
'subject' => stripslashes($_POST['user_approval_subject']),
|
67 |
+
'message' => stripslashes($_POST['user_approval_message'])
|
68 |
+
);
|
69 |
+
$ThemeMyLogin->options['user_denial_email'] = array(
|
70 |
+
'subject' => stripslashes($_POST['user_denial_subject']),
|
71 |
+
'message' => stripslashes($_POST['user_denial_message'])
|
72 |
+
);
|
73 |
+
|
74 |
+
$ThemeMyLogin->SaveOptions();
|
75 |
+
|
76 |
+
if ( isset($_POST['uninstall']) ) {
|
77 |
+
$info_message = __('To complete uninstall, deactivate this plugin. If you do not wish to uninstall, please uncheck the "Complete Uninstall" checkbox.', 'theme-my-login');
|
78 |
+
} elseif ( isset($_POST['defaults']) ) {
|
79 |
+
$ThemeMyLogin->options = '';
|
80 |
+
$ThemeMyLogin->InitOptions(true);
|
81 |
+
$info_message = __('All settings restored to default state.', 'theme-my-login');
|
82 |
+
} else $info_message =__('Settings saved.', 'theme-my-login');
|
83 |
+
}
|
84 |
+
|
85 |
+
$links = $ThemeMyLogin->options['links'];
|
86 |
+
$redirects = $ThemeMyLogin->options['redirects'];
|
87 |
+
|
88 |
+
?>
|
89 |
+
|
90 |
+
<div class="updated" style="background:#f0f8ff; border:1px solid #addae6">
|
91 |
+
<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>
|
92 |
+
</div>
|
93 |
+
|
94 |
+
<div class="wrap">
|
95 |
+
<?php if ( function_exists('screen_icon') ) screen_icon('options-general'); ?>
|
96 |
+
|
97 |
+
<h2><?php _e('Theme My Login Settings'); ?></h2>
|
98 |
+
|
99 |
+
<?php if ( isset($info_message) && !empty($info_message) ) : ?>
|
100 |
+
<div id="message" class="updated fade">
|
101 |
+
<p><strong><?php echo $info_message ?></strong></p>
|
102 |
+
</div>
|
103 |
+
<?php endif; ?>
|
104 |
+
|
105 |
+
<?php if( isset($error_message) && !empty($error_message) ) : ?>
|
106 |
+
<div id="message" class="error">
|
107 |
+
<p><strong><?php echo $error_message ?></strong></p>
|
108 |
+
</div>
|
109 |
+
<?php endif; ?>
|
110 |
+
|
111 |
+
<form id="theme-my-login-settings" action="" method="post">
|
112 |
+
<?php wp_nonce_field('theme-my-login-settings'); ?>
|
113 |
+
|
114 |
+
<div id="container" class="tabs">
|
115 |
+
|
116 |
+
<ul class="tabs-nav">
|
117 |
+
<li><a href="#fragment-1">General</a></li>
|
118 |
+
<li><a href="#fragment-2">Template</a></li>
|
119 |
+
<li><a href="#fragment-3">Links</a></li>
|
120 |
+
<li><a href="#fragment-4">Redirection</a></li>
|
121 |
+
<li><a href="#fragment-5">E-mail</a></li>
|
122 |
+
</ul>
|
123 |
+
|
124 |
+
<div id="fragment-1" class="tabs-div">
|
125 |
+
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-general.php'; ?>
|
126 |
+
</div>
|
127 |
+
|
128 |
+
<div id="fragment-2" class="tabs-div">
|
129 |
+
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-template.php'; ?>
|
130 |
+
</div>
|
131 |
+
|
132 |
+
<div id="fragment-3" class="tabs-div">
|
133 |
+
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-links.php'; ?>
|
134 |
+
</div>
|
135 |
+
|
136 |
+
<div id="fragment-4" class="tabs-div">
|
137 |
+
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-redirection.php'; ?>
|
138 |
+
</div>
|
139 |
+
|
140 |
+
<div id="fragment-5" class="tabs-div">
|
141 |
+
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-email.php'; ?>
|
142 |
+
</div>
|
143 |
+
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<?php if ( version_compare($wp_version, '2.7', '>=') ) : ?>
|
147 |
+
<p><input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /></p>
|
148 |
+
<?php else : ?>
|
149 |
+
<p><input type="submit" name="Submit" class="button" value="<?php _e('Save Changes'); ?>" /></p>
|
150 |
+
<?php endif; ?>
|
151 |
+
</form>
|
152 |
+
|
153 |
+
</div>
|
classes/class.widget-new.php
CHANGED
@@ -10,25 +10,23 @@ class ThemeMyLoginWidget extends WP_Widget {
|
|
10 |
|
11 |
function widget($args, $instance){
|
12 |
global $ThemeMyLogin;
|
13 |
-
|
14 |
-
$
|
15 |
-
|
16 |
-
echo $ThemeMyLogin->ThemeMyLoginShortcode($new_args);
|
17 |
}
|
18 |
|
19 |
function update($new_instance, $old_instance){
|
20 |
|
21 |
$instance = $old_instance;
|
22 |
$instance['default_action'] = $new_instance['default_action'];
|
23 |
-
$instance['
|
24 |
$instance['show_title'] = (empty($new_instance['show_title'])) ? false : true;
|
25 |
-
$instance['
|
26 |
$instance['show_reg_link'] = (empty($new_instance['show_reg_link'])) ? false: true;
|
27 |
$instance['show_pass_link'] = (empty($new_instance['show_pass_link'])) ? false: true;
|
28 |
$instance['show_gravatar'] = (empty($new_instance['show_gravatar'])) ? false : true;
|
29 |
$instance['gravatar_size'] = absint($new_instance['gravatar_size']);
|
30 |
-
$instance['
|
31 |
-
$instance['
|
32 |
|
33 |
return $instance;
|
34 |
}
|
@@ -39,15 +37,15 @@ class ThemeMyLoginWidget extends WP_Widget {
|
|
39 |
|
40 |
//Defaults
|
41 |
$defaults['default_action'] = 'login';
|
42 |
-
$defaults['
|
43 |
$defaults['show_title'] = 1;
|
44 |
-
$defaults['
|
45 |
$defaults['show_reg_link'] = 1;
|
46 |
$defaults['show_pass_link'] = 1;
|
47 |
$defaults['show_gravatar'] = 1;
|
48 |
$defaults['gravatar_size'] = 50;
|
49 |
-
$defaults['
|
50 |
-
$defaults['
|
51 |
|
52 |
$instance = wp_parse_args( (array) $instance, (array) $defaults );
|
53 |
$actions = array('login' => 'Login', 'register' => 'Register', 'lostpassword' => 'Lost Password');
|
@@ -57,12 +55,12 @@ class ThemeMyLoginWidget extends WP_Widget {
|
|
57 |
echo '<option value="' . $action . '"' . $is_selected . '>' . $title . '</option>';
|
58 |
}
|
59 |
echo '</select></p>' . "\n";
|
60 |
-
$is_checked = (empty($instance['
|
61 |
-
echo '<p><input name="' . $this->get_field_name('
|
62 |
$is_checked = (empty($instance['show_title'])) ? '' : 'checked="checked" ';
|
63 |
echo '<p><input name="' . $this->get_field_name('show_title') . '" type="checkbox" id="' . $this->get_field_id('show_title') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_title') . '">' . __('Show Title', 'theme-my-login') . '</label></p>' . "\n";
|
64 |
-
$is_checked = (empty($instance['
|
65 |
-
echo '<p><input name="' . $this->get_field_name('
|
66 |
$is_checked = (empty($instance['show_reg_link'])) ? '' : 'checked="checked" ';
|
67 |
echo '<p><input name="' . $this->get_field_name('show_reg_link') . '" type="checkbox" id="' . $this->get_field_id('show_reg_link') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_reg_link') . '">' . __('Show Register Link', 'theme-my-login') . '</label></p>' . "\n";
|
68 |
$is_checked = (empty($instance['show_pass_link'])) ? '' : 'checked="checked" ';
|
@@ -70,10 +68,10 @@ class ThemeMyLoginWidget extends WP_Widget {
|
|
70 |
$is_checked = (empty($instance['show_gravatar'])) ? '' : 'checked="checked" ';
|
71 |
echo '<p><input name="' . $this->get_field_name('show_gravatar') . '" type="checkbox" id="' . $this->get_field_id('show_gravatar') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_gravatar') . '">' . __('Show Gravatar', 'theme-my-login') . '</label></p>' . "\n";
|
72 |
echo '<p>' . __('Gravatar Size', 'theme-my-login') . ': <input name="' . $this->get_field_name('gravatar_size') . '" type="text" id="' . $this->get_field_id('gravatar_size') . '" value="' . $instance['gravatar_size'] . '" size="3" /> <label for="' . $this->get_field_id('gravatar_size') . '"></label></p>' . "\n";
|
73 |
-
$is_checked = (empty($instance['
|
74 |
-
echo '<p><input name="' . $this->get_field_name('
|
75 |
-
$is_checked = (empty($instance['
|
76 |
-
echo '<p><input name="' . $this->get_field_name('
|
77 |
}
|
78 |
|
79 |
}// END class
|
10 |
|
11 |
function widget($args, $instance){
|
12 |
global $ThemeMyLogin;
|
13 |
+
$args = array_merge($args, $instance);
|
14 |
+
echo $ThemeMyLogin->ThemeMyLoginShortcode($args);
|
|
|
|
|
15 |
}
|
16 |
|
17 |
function update($new_instance, $old_instance){
|
18 |
|
19 |
$instance = $old_instance;
|
20 |
$instance['default_action'] = $new_instance['default_action'];
|
21 |
+
$instance['logged_in_widget'] = (empty($new_instance['logged_in_widget'])) ? false : true;
|
22 |
$instance['show_title'] = (empty($new_instance['show_title'])) ? false : true;
|
23 |
+
$instance['show_log_link'] = (empty($new_instance['show_log_link'])) ? false: true;
|
24 |
$instance['show_reg_link'] = (empty($new_instance['show_reg_link'])) ? false: true;
|
25 |
$instance['show_pass_link'] = (empty($new_instance['show_pass_link'])) ? false: true;
|
26 |
$instance['show_gravatar'] = (empty($new_instance['show_gravatar'])) ? false : true;
|
27 |
$instance['gravatar_size'] = absint($new_instance['gravatar_size']);
|
28 |
+
$instance['register_widget'] = (empty($new_instance['register_widget'])) ? false : true;
|
29 |
+
$instance['lost_pass_widget'] = (empty($new_instance['lost_pass_widget'])) ? false : true;
|
30 |
|
31 |
return $instance;
|
32 |
}
|
37 |
|
38 |
//Defaults
|
39 |
$defaults['default_action'] = 'login';
|
40 |
+
$defaults['logged_in_widget'] = 1;
|
41 |
$defaults['show_title'] = 1;
|
42 |
+
$defaults['show_log_link'] = 1;
|
43 |
$defaults['show_reg_link'] = 1;
|
44 |
$defaults['show_pass_link'] = 1;
|
45 |
$defaults['show_gravatar'] = 1;
|
46 |
$defaults['gravatar_size'] = 50;
|
47 |
+
$defaults['register_widget'] = 1;
|
48 |
+
$defaults['lost_pass_widget'] = 1;
|
49 |
|
50 |
$instance = wp_parse_args( (array) $instance, (array) $defaults );
|
51 |
$actions = array('login' => 'Login', 'register' => 'Register', 'lostpassword' => 'Lost Password');
|
55 |
echo '<option value="' . $action . '"' . $is_selected . '>' . $title . '</option>';
|
56 |
}
|
57 |
echo '</select></p>' . "\n";
|
58 |
+
$is_checked = (empty($instance['logged_in_widget'])) ? '' : 'checked="checked" ';
|
59 |
+
echo '<p><input name="' . $this->get_field_name('logged_in_widget') . '" type="checkbox" id="' . $this->get_field_id('logged_in_widget') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('logged_in_widget') . '">' . __('Show When Logged In', 'theme-my-login') . '</label></p>' . "\n";
|
60 |
$is_checked = (empty($instance['show_title'])) ? '' : 'checked="checked" ';
|
61 |
echo '<p><input name="' . $this->get_field_name('show_title') . '" type="checkbox" id="' . $this->get_field_id('show_title') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_title') . '">' . __('Show Title', 'theme-my-login') . '</label></p>' . "\n";
|
62 |
+
$is_checked = (empty($instance['show_log_link'])) ? '' : 'checked="checked" ';
|
63 |
+
echo '<p><input name="' . $this->get_field_name('show_log_link') . '" type="checkbox" id="' . $this->get_field_id('show_log_link') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_log_link') . '">' . __('Show Login Link', 'theme-my-login') . '</label></p>' . "\n";
|
64 |
$is_checked = (empty($instance['show_reg_link'])) ? '' : 'checked="checked" ';
|
65 |
echo '<p><input name="' . $this->get_field_name('show_reg_link') . '" type="checkbox" id="' . $this->get_field_id('show_reg_link') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_reg_link') . '">' . __('Show Register Link', 'theme-my-login') . '</label></p>' . "\n";
|
66 |
$is_checked = (empty($instance['show_pass_link'])) ? '' : 'checked="checked" ';
|
68 |
$is_checked = (empty($instance['show_gravatar'])) ? '' : 'checked="checked" ';
|
69 |
echo '<p><input name="' . $this->get_field_name('show_gravatar') . '" type="checkbox" id="' . $this->get_field_id('show_gravatar') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_gravatar') . '">' . __('Show Gravatar', 'theme-my-login') . '</label></p>' . "\n";
|
70 |
echo '<p>' . __('Gravatar Size', 'theme-my-login') . ': <input name="' . $this->get_field_name('gravatar_size') . '" type="text" id="' . $this->get_field_id('gravatar_size') . '" value="' . $instance['gravatar_size'] . '" size="3" /> <label for="' . $this->get_field_id('gravatar_size') . '"></label></p>' . "\n";
|
71 |
+
$is_checked = (empty($instance['register_widget'])) ? '' : 'checked="checked" ';
|
72 |
+
echo '<p><input name="' . $this->get_field_name('register_widget') . '" type="checkbox" id="' . $this->get_field_id('register_widget') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('register_widget') . '">' . __('Allow Registration', 'theme-my-login') . '</label></p>' . "\n";
|
73 |
+
$is_checked = (empty($instance['lost_pass_widget'])) ? '' : 'checked="checked" ';
|
74 |
+
echo '<p><input name="' . $this->get_field_name('lost_pass_widget') . '" type="checkbox" id="' . $this->get_field_id('lost_pass_widget') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('lost_pass_widget') . '">' . __('Allow Password Recovery', 'theme-my-login') . '</label></p>' . "\n";
|
75 |
}
|
76 |
|
77 |
}// END class
|
classes/class.widget-old.php
CHANGED
@@ -14,11 +14,7 @@ class ThemeMyLoginWidget {
|
|
14 |
|
15 |
function Widget($args) {
|
16 |
global $ThemeMyLogin;
|
17 |
-
|
18 |
-
$new_args['widget'] = wp_parse_args($args);
|
19 |
-
|
20 |
-
echo $ThemeMyLogin->ThemeMyLoginShortcode($new_args);
|
21 |
-
|
22 |
}
|
23 |
|
24 |
function WidgetControl() {
|
@@ -27,47 +23,45 @@ class ThemeMyLoginWidget {
|
|
27 |
if ( $_POST['tml_submit'] ) {
|
28 |
|
29 |
$widget['default_action'] = $_POST['tml_default_action'];
|
30 |
-
$
|
31 |
-
$
|
32 |
-
$
|
33 |
-
$
|
34 |
-
$
|
35 |
-
$
|
36 |
-
$
|
37 |
-
$
|
38 |
-
$
|
39 |
-
//$ThemeMyLogin->options['widget'] = array_merge($ThemeMyLogin->options['widget'], $widget);
|
40 |
-
$ThemeMyLogin->SetOption('widget', $widget);
|
41 |
$ThemeMyLogin->SaveOptions();
|
42 |
|
43 |
}
|
44 |
|
45 |
-
$
|
46 |
|
47 |
$actions = array('login' => 'Login', 'register' => 'Register', 'lostpassword' => 'Lost Password');
|
48 |
echo '<p>Default Action<br /><select name="tml_default_action" id="tml_default_action">';
|
49 |
foreach ($actions as $action => $title) {
|
50 |
-
$is_selected = ($
|
51 |
echo '<option value="' . $action . '"' . $is_selected . '>' . $title . '</option>';
|
52 |
}
|
53 |
echo '</select></p>' . "\n";
|
54 |
-
$is_checked = (empty($
|
55 |
echo '<p><input name="tml_show_logged" type="checkbox" id="tml_show_logged" value="1" ' . $is_checked . '/> <label for="tml_show_logged">' . __('Show When Logged In', 'theme-my-login') . '</label></p>' . "\n";
|
56 |
-
$is_checked = (empty($
|
57 |
echo '<p><input name="tml_show_title" type="checkbox" id="tml_show_title" value="1" ' . $is_checked . '/> <label for="tml_show_title">' . __('Show Title', 'theme-my-login') . '</label></p>' . "\n";
|
58 |
-
$is_checked = (empty($
|
59 |
-
echo '<p><input name="
|
60 |
-
$is_checked = (empty($
|
61 |
echo '<p><input name="tml_show_reg_link" type="checkbox" id="tml_show_reg_link" value="1" ' . $is_checked . '/> <label for="tml_show_reg_link">' . __('Show Registration Link', 'theme-my-login') . '</label></p>' . "\n";
|
62 |
-
$is_checked = (empty($
|
63 |
echo '<p><input name="tml_show_pass_link" type="checkbox" id="tml_show_pass_link" value="1" ' . $is_checked . '/> <label for="tml_show_pass_link">' . __('Show Lost Password Link', 'theme-my-login') . '</label></p>' . "\n";
|
64 |
-
$is_checked = (empty($
|
65 |
echo '<p><input name="tml_show_gravatar" type="checkbox" id="tml_show_gravatar" value="1" ' . $is_checked . '/> <label for="tml_show_gravatar">' . __('Show Gravatar', 'theme-my-login') . '</label></p>' . "\n";
|
66 |
-
echo '<p>' . __('Gravatar Size', 'theme-my-login') . ': <input name="tml_gravatar_size" type="text" id="tml_gravatar_size" value="' . $
|
67 |
-
$is_checked = (empty($
|
68 |
-
echo '<p><input name="
|
69 |
-
$is_checked = (empty($
|
70 |
-
echo '<p><input name="
|
71 |
echo '<p><input type="hidden" id="tml_submit" name="tml_submit" value="1" /></p>' . "\n";
|
72 |
|
73 |
}
|
14 |
|
15 |
function Widget($args) {
|
16 |
global $ThemeMyLogin;
|
17 |
+
echo $ThemeMyLogin->ThemeMyLoginShortcode($args);
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
function WidgetControl() {
|
23 |
if ( $_POST['tml_submit'] ) {
|
24 |
|
25 |
$widget['default_action'] = $_POST['tml_default_action'];
|
26 |
+
$ThemeMyLogin->options['logged_in_widget'] = (empty($_POST['tml_show_logged'])) ? false : true;
|
27 |
+
$ThemeMyLogin->options['show_title'] = (empty($_POST['tml_show_title'])) ? false : true;
|
28 |
+
$ThemeMyLogin->options['show_log_link'] = (empty($_POST['tml_show_log_link'])) ? false: true;
|
29 |
+
$ThemeMyLogin->options['show_reg_link'] = (empty($_POST['tml_show_reg_link'])) ? false: true;
|
30 |
+
$ThemeMyLogin->options['show_pass_link'] = (empty($_POST['tml_show_pass_link'])) ? false: true;
|
31 |
+
$ThemeMyLogin->options['show_gravatar'] = (empty($_POST['tml_show_gravatar'])) ? false : true;
|
32 |
+
$ThemeMyLogin->options['gravatar_size'] = absint($_POST['tml_gravatar_size']);
|
33 |
+
$ThemeMyLogin->options['register_widget'] = (empty($_POST['tml_register_widget'])) ? false : true;
|
34 |
+
$ThemeMyLogin->options['lost_pass_widget'] = (empty($_POST['tml_lost_pass_widget'])) ? false : true;
|
|
|
|
|
35 |
$ThemeMyLogin->SaveOptions();
|
36 |
|
37 |
}
|
38 |
|
39 |
+
$ThemeMyLogin->options = $ThemeMyLogin->GetOption('widget');
|
40 |
|
41 |
$actions = array('login' => 'Login', 'register' => 'Register', 'lostpassword' => 'Lost Password');
|
42 |
echo '<p>Default Action<br /><select name="tml_default_action" id="tml_default_action">';
|
43 |
foreach ($actions as $action => $title) {
|
44 |
+
$is_selected = ($ThemeMyLogin->options['default_action'] == $action) ? ' selected="selected"' : '';
|
45 |
echo '<option value="' . $action . '"' . $is_selected . '>' . $title . '</option>';
|
46 |
}
|
47 |
echo '</select></p>' . "\n";
|
48 |
+
$is_checked = (empty($ThemeMyLogin->options['show_logged'])) ? '' : 'checked="checked" ';
|
49 |
echo '<p><input name="tml_show_logged" type="checkbox" id="tml_show_logged" value="1" ' . $is_checked . '/> <label for="tml_show_logged">' . __('Show When Logged In', 'theme-my-login') . '</label></p>' . "\n";
|
50 |
+
$is_checked = (empty($ThemeMyLogin->options['show_title'])) ? '' : 'checked="checked" ';
|
51 |
echo '<p><input name="tml_show_title" type="checkbox" id="tml_show_title" value="1" ' . $is_checked . '/> <label for="tml_show_title">' . __('Show Title', 'theme-my-login') . '</label></p>' . "\n";
|
52 |
+
$is_checked = (empty($ThemeMyLogin->options['show_login_link'])) ? '' : 'checked="checked" ';
|
53 |
+
echo '<p><input name="tml_show_login_link" type="checkbox" id="tml_show_login_link" value="1" ' . $is_checked . '/> <label for="tml_show_log_link">' . __('Show Login Link', 'theme-my-login') . '</label></p>' . "\n";
|
54 |
+
$is_checked = (empty($ThemeMyLogin->options['show_reg_link'])) ? '' : 'checked="checked" ';
|
55 |
echo '<p><input name="tml_show_reg_link" type="checkbox" id="tml_show_reg_link" value="1" ' . $is_checked . '/> <label for="tml_show_reg_link">' . __('Show Registration Link', 'theme-my-login') . '</label></p>' . "\n";
|
56 |
+
$is_checked = (empty($ThemeMyLogin->options['show_pass_link'])) ? '' : 'checked="checked" ';
|
57 |
echo '<p><input name="tml_show_pass_link" type="checkbox" id="tml_show_pass_link" value="1" ' . $is_checked . '/> <label for="tml_show_pass_link">' . __('Show Lost Password Link', 'theme-my-login') . '</label></p>' . "\n";
|
58 |
+
$is_checked = (empty($ThemeMyLogin->options['show_gravatar'])) ? '' : 'checked="checked" ';
|
59 |
echo '<p><input name="tml_show_gravatar" type="checkbox" id="tml_show_gravatar" value="1" ' . $is_checked . '/> <label for="tml_show_gravatar">' . __('Show Gravatar', 'theme-my-login') . '</label></p>' . "\n";
|
60 |
+
echo '<p>' . __('Gravatar Size', 'theme-my-login') . ': <input name="tml_gravatar_size" type="text" id="tml_gravatar_size" value="' . $ThemeMyLogin->options['gravatar_size'] . '" size="3" /> <label for="tml_gravatar_size"></label></p>' . "\n";
|
61 |
+
$is_checked = (empty($ThemeMyLogin->options['register_widget'])) ? '' : 'checked="checked" ';
|
62 |
+
echo '<p><input name="tml_register_widget" type="checkbox" id="tml_register_widget" value="1" ' . $is_checked . '/> <label for="tml_register_widget">' . __('Allow Registration', 'theme-my-login') . '</label></p>' . "\n";
|
63 |
+
$is_checked = (empty($ThemeMyLogin->options['lost_pass_widget'])) ? '' : 'checked="checked" ';
|
64 |
+
echo '<p><input name="tml_lost_pass_widget" type="checkbox" id="tml_lost_pass_widget" value="1" ' . $is_checked . '/> <label for="tml_lost_pass_widget">' . __('Allow Password Recovery', 'theme-my-login') . '</label></p>' . "\n";
|
65 |
echo '<p><input type="hidden" id="tml_submit" name="tml_submit" value="1" /></p>' . "\n";
|
66 |
|
67 |
}
|
classes/class.wp-login.php
CHANGED
@@ -49,9 +49,9 @@ if ( !class_exists('WPLogin') ) {
|
|
49 |
} else {
|
50 |
$this->redirect_to = admin_url();
|
51 |
}
|
52 |
-
|
53 |
$this->redirect_to = apply_filters('login_redirect', $this->redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', '');
|
54 |
-
|
55 |
// allow plugins to override the default actions, and to add extra actions if they want
|
56 |
do_action('login_form_' . $this->action);
|
57 |
|
@@ -88,23 +88,23 @@ if ( !class_exists('WPLogin') ) {
|
|
88 |
|
89 |
$this->LoadOptions($args);
|
90 |
|
91 |
-
$action = (isset($this->options['
|
92 |
if ( $instance == $this->instance || (empty($this->instance) && 'tml-main' == $instance) )
|
93 |
$action = $this->action;
|
94 |
|
95 |
ob_start();
|
96 |
-
echo $this->options['
|
97 |
if ( is_user_logged_in() ) {
|
98 |
-
if ( $this->options['
|
99 |
$user = new WP_User($user_ID);
|
100 |
$user_role = array_shift($user->roles);
|
101 |
$replace_this = array('/%user_login%/', '/%display_name%/');
|
102 |
$replace_with = array($user->user_login, $user->display_name);
|
103 |
-
$welcome = preg_replace($replace_this, $replace_with, $this->options['
|
104 |
-
if ( $this->options['
|
105 |
-
echo $this->options['
|
106 |
-
if ($this->options['
|
107 |
-
echo '<div class="login-avatar">' . get_avatar( $user_ID, $size = $this->options['
|
108 |
do_action('login_avatar', $current_user);
|
109 |
echo '<ul class="login-links">' . "\n";
|
110 |
foreach ($this->options['links'][$user_role] as $key => $data) {
|
@@ -119,8 +119,8 @@ if ( !class_exists('WPLogin') ) {
|
|
119 |
echo '</ul>' . "\n";
|
120 |
}
|
121 |
} else {
|
122 |
-
if ( $this->options['
|
123 |
-
echo $this->options['
|
124 |
if ( $instance == $this->instance || !empty($action) ) {
|
125 |
switch ($action) {
|
126 |
case 'lostpassword' :
|
@@ -139,7 +139,7 @@ if ( !class_exists('WPLogin') ) {
|
|
139 |
echo $this->LoginForm($instance);
|
140 |
}
|
141 |
}
|
142 |
-
echo $this->options['
|
143 |
$contents = ob_get_contents();
|
144 |
ob_end_clean();
|
145 |
return $contents;
|
@@ -150,21 +150,21 @@ if ( !class_exists('WPLogin') ) {
|
|
150 |
}
|
151 |
|
152 |
function GetTitle($instance) {
|
153 |
-
$action = (isset($this->options['
|
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['
|
160 |
break;
|
161 |
case 'lostpassword':
|
162 |
case 'retrievepassword':
|
163 |
-
return $this->options['
|
164 |
break;
|
165 |
case 'login':
|
166 |
default:
|
167 |
-
return $this->options['
|
168 |
break;
|
169 |
}
|
170 |
}
|
@@ -204,32 +204,30 @@ if ( !class_exists('WPLogin') ) {
|
|
204 |
}
|
205 |
|
206 |
function PageFooter($instance) {
|
207 |
-
$action = (isset($this->options['
|
208 |
if ( $instance == $this->instance || (empty($this->instance) && 'tml-main' == $instance) )
|
209 |
$action = $this->action;
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
if (
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
echo '<li><a href="' . $url . '">' . $this->options['titles']['register'] . '</a></li>' . "\n";
|
222 |
-
}
|
223 |
}
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
}
|
231 |
-
echo '</ul>' . "\n";
|
232 |
}
|
|
|
233 |
echo '</div>' . "\n";
|
234 |
}
|
235 |
|
@@ -248,7 +246,7 @@ if ( !class_exists('WPLogin') ) {
|
|
248 |
elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $this->errors->add('registerdisabled', __('User registration is currently not allowed.'));
|
249 |
elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) $this->errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
|
250 |
elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) $this->errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
|
251 |
-
elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) $this->errors->add('registered', $this->options['
|
252 |
|
253 |
$this->PageHeader($instance);
|
254 |
|
@@ -261,15 +259,15 @@ if ( !class_exists('WPLogin') ) {
|
|
261 |
?>
|
262 |
<form name="loginform" id="loginform-<?php echo $instance; ?>" action="<?php echo $this->GuessURL(array('instance' => $instance, 'action' => 'login')); ?>" method="post">
|
263 |
<p>
|
264 |
-
<label><?php _e('Username')
|
265 |
-
<input type="text" name="log" id="user_login-<?php echo $instance; ?>" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20"
|
266 |
</p>
|
267 |
<p>
|
268 |
-
<label><?php _e('Password')
|
269 |
-
<input type="password" name="pwd" id="user_pass-<?php echo $instance; ?>" class="input" value="" size="20"
|
270 |
</p>
|
271 |
<?php do_action('login_form', $instance); ?>
|
272 |
-
<p class="forgetmenot"><
|
273 |
<p class="submit">
|
274 |
<input type="submit" name="login-submit" id="login-submit-<?php echo $instance; ?>" value="<?php _e('Log In'); ?>" />
|
275 |
<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($this->redirect_to); ?>" />
|
@@ -302,15 +300,15 @@ if ( !class_exists('WPLogin') ) {
|
|
302 |
?>
|
303 |
<form name="registerform" id="registerform-<?php echo $instance; ?>" action="<?php echo $this->GuessURL(array('instance' => $instance, 'action' => 'register')); ?>" method="post">
|
304 |
<p>
|
305 |
-
<label><?php _e('Username')
|
306 |
-
<input type="text" name="user_login" id="user_login-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20"
|
307 |
</p>
|
308 |
<p>
|
309 |
-
<label><?php _e('E-mail')
|
310 |
-
<input type="text" name="user_email" id="user_email-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20"
|
311 |
</p>
|
312 |
<?php do_action('register_form', $instance); ?>
|
313 |
-
<p id="reg_passmail-<?php echo $instance; ?>"><?php echo $this->options['
|
314 |
<p class="submit">
|
315 |
<input type="submit" name="register-submit" id="register-submit-<?php echo $instance; ?>" value="<?php _e('Register'); ?>" />
|
316 |
</p>
|
@@ -326,13 +324,13 @@ if ( !class_exists('WPLogin') ) {
|
|
326 |
|
327 |
function RetrievePasswordForm($instance) {
|
328 |
do_action('lost_password', $instance);
|
329 |
-
$this->PageHeader($instance, $this->options['
|
330 |
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
331 |
?>
|
332 |
<form name="lostpasswordform" id="lostpasswordform-<?php echo $instance; ?>" action="<?php echo $this->GuessURL(array('instance' => $instance, 'action' => 'lostpassword')); ?>" method="post">
|
333 |
<p>
|
334 |
-
<label><?php _e('Username or E-mail:')
|
335 |
-
<input type="text" name="user_login" id="user_login-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20"
|
336 |
</p>
|
337 |
<?php do_action('lostpassword_form', $instance); ?>
|
338 |
<p class="submit">
|
@@ -593,7 +591,7 @@ if ( !class_exists('WPLogin') ) {
|
|
593 |
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
594 |
tml_remove_mail_filters();
|
595 |
|
596 |
-
if ( !$this->options['
|
597 |
wp_password_change_notification($user);
|
598 |
|
599 |
return true;
|
@@ -645,21 +643,4 @@ if ( !class_exists('WPLogin') ) {
|
|
645 |
}
|
646 |
}
|
647 |
|
648 |
-
if ( !function_exists('wp_generate_password') ) :
|
649 |
-
function wp_generate_password($length = 12, $special_chars = true) {
|
650 |
-
|
651 |
-
if ( isset($_POST['user_pw']) && '' != $_POST['user_pw'] )
|
652 |
-
return stripslashes($_POST['user_pw']);
|
653 |
-
|
654 |
-
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
655 |
-
if ( $special_chars )
|
656 |
-
$chars .= '!@#$%^&*()';
|
657 |
-
|
658 |
-
$password = '';
|
659 |
-
for ( $i = 0; $i < $length; $i++ )
|
660 |
-
$password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
|
661 |
-
return $password;
|
662 |
-
}
|
663 |
-
endif;
|
664 |
-
|
665 |
?>
|
49 |
} else {
|
50 |
$this->redirect_to = admin_url();
|
51 |
}
|
52 |
+
|
53 |
$this->redirect_to = apply_filters('login_redirect', $this->redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', '');
|
54 |
+
|
55 |
// allow plugins to override the default actions, and to add extra actions if they want
|
56 |
do_action('login_form_' . $this->action);
|
57 |
|
88 |
|
89 |
$this->LoadOptions($args);
|
90 |
|
91 |
+
$action = (isset($this->options['default_action'])) ? $this->options['default_action'] : 'login';
|
92 |
if ( $instance == $this->instance || (empty($this->instance) && 'tml-main' == $instance) )
|
93 |
$action = $this->action;
|
94 |
|
95 |
ob_start();
|
96 |
+
echo $this->options['before_widget'];
|
97 |
if ( is_user_logged_in() ) {
|
98 |
+
if ( $this->options['logged_in_widget'] ) {
|
99 |
$user = new WP_User($user_ID);
|
100 |
$user_role = array_shift($user->roles);
|
101 |
$replace_this = array('/%user_login%/', '/%display_name%/');
|
102 |
$replace_with = array($user->user_login, $user->display_name);
|
103 |
+
$welcome = preg_replace($replace_this, $replace_with, $this->options['welcome_title']);
|
104 |
+
if ( $this->options['show_title'] )
|
105 |
+
echo $this->options['before_title'] . $welcome . $this->options['after_title'] . "\n";
|
106 |
+
if ($this->options['show_gravatar'])
|
107 |
+
echo '<div class="login-avatar">' . get_avatar( $user_ID, $size = $this->options['gravatar_size'] ) . '</div>' . "\n";
|
108 |
do_action('login_avatar', $current_user);
|
109 |
echo '<ul class="login-links">' . "\n";
|
110 |
foreach ($this->options['links'][$user_role] as $key => $data) {
|
119 |
echo '</ul>' . "\n";
|
120 |
}
|
121 |
} else {
|
122 |
+
if ( $this->options['show_title'] )
|
123 |
+
echo $this->options['before_title'] . $this->GetTitle($instance) . $this->options['after_title'] . "\n";
|
124 |
if ( $instance == $this->instance || !empty($action) ) {
|
125 |
switch ($action) {
|
126 |
case 'lostpassword' :
|
139 |
echo $this->LoginForm($instance);
|
140 |
}
|
141 |
}
|
142 |
+
echo $this->options['after_widget'] . "\n";
|
143 |
$contents = ob_get_contents();
|
144 |
ob_end_clean();
|
145 |
return $contents;
|
150 |
}
|
151 |
|
152 |
function GetTitle($instance) {
|
153 |
+
$action = (isset($this->options['default_action'])) ? $this->options['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['register_title'];
|
160 |
break;
|
161 |
case 'lostpassword':
|
162 |
case 'retrievepassword':
|
163 |
+
return $this->options['lost_pass_title'];
|
164 |
break;
|
165 |
case 'login':
|
166 |
default:
|
167 |
+
return $this->options['login_title'];
|
168 |
break;
|
169 |
}
|
170 |
}
|
204 |
}
|
205 |
|
206 |
function PageFooter($instance) {
|
207 |
+
$action = (isset($this->options['default_action'])) ? $this->options['default_action'] : 'login';
|
208 |
if ( $instance == $this->instance || (empty($this->instance) && 'tml-main' == $instance) )
|
209 |
$action = $this->action;
|
210 |
|
211 |
+
echo '<ul class="links">' . "\n";
|
212 |
+
if ( $this->options['show_log_link'] && in_array($action, array('register', 'lostpassword')) || $action == 'login' && isset($_GET['checkemail']) && 'registered' != $_GET['checkemail'] ) {
|
213 |
+
$url = $this->GuessURL(array('instance' => $instance, 'action' => 'login'));
|
214 |
+
echo '<li><a href="' . $url . '">' . $this->options['login_title'] . '</a></li>' . "\n";
|
215 |
+
}
|
216 |
+
if ( $this->options['show_reg_link'] && get_option('users_can_register') ) {
|
217 |
+
if ( 'register' != $action ) {
|
218 |
+
$url = ($this->options['register_widget']) ? $this->GuessURL(array('instance' => $instance, 'action' => 'register')) : site_url('wp-login.php?action=register', 'login');
|
219 |
+
$url = apply_filters('login_footer_registration_link', $url);
|
220 |
+
echo '<li><a href="' . $url . '">' . $this->options['register_title'] . '</a></li>' . "\n";
|
|
|
|
|
221 |
}
|
222 |
+
}
|
223 |
+
if ( $this->options['show_pass_link'] ) {
|
224 |
+
if ( 'lostpassword' != $action ) {
|
225 |
+
$url = ($this->options['lost_pass_widget']) ? $this->GuessURL(array('instance' => $instance, 'action' => 'lostpassword')) : site_url('wp-login.php?action=lostpassword', 'login');
|
226 |
+
$url = apply_filters('login_footer_forgotpassword_link', $url);
|
227 |
+
echo '<li><a href="' . $url . '">' . $this->options['lost_pass_title'] . '</a></li>' . "\n";
|
228 |
}
|
|
|
229 |
}
|
230 |
+
echo '</ul>' . "\n";
|
231 |
echo '</div>' . "\n";
|
232 |
}
|
233 |
|
246 |
elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $this->errors->add('registerdisabled', __('User registration is currently not allowed.'));
|
247 |
elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) $this->errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
|
248 |
elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) $this->errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
|
249 |
+
elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) $this->errors->add('registered', $this->options['success_message'], 'message');
|
250 |
|
251 |
$this->PageHeader($instance);
|
252 |
|
259 |
?>
|
260 |
<form name="loginform" id="loginform-<?php echo $instance; ?>" action="<?php echo $this->GuessURL(array('instance' => $instance, 'action' => 'login')); ?>" method="post">
|
261 |
<p>
|
262 |
+
<label for="log"><?php _e('Username') ?></label>
|
263 |
+
<input type="text" name="log" id="user_login-<?php echo $instance; ?>" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20" />
|
264 |
</p>
|
265 |
<p>
|
266 |
+
<label for="pwd"><?php _e('Password') ?></label>
|
267 |
+
<input type="password" name="pwd" id="user_pass-<?php echo $instance; ?>" class="input" value="" size="20" />
|
268 |
</p>
|
269 |
<?php do_action('login_form', $instance); ?>
|
270 |
+
<p class="forgetmenot"><input name="rememberme" type="checkbox" id="rememberme-<?php echo $instance; ?>" value="forever" /> <label for="rememberme"><?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'); ?>" />
|
273 |
<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($this->redirect_to); ?>" />
|
300 |
?>
|
301 |
<form name="registerform" id="registerform-<?php echo $instance; ?>" action="<?php echo $this->GuessURL(array('instance' => $instance, 'action' => 'register')); ?>" method="post">
|
302 |
<p>
|
303 |
+
<label for="user_login"><?php _e('Username') ?></label>
|
304 |
+
<input type="text" name="user_login" id="user_login-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" />
|
305 |
</p>
|
306 |
<p>
|
307 |
+
<label for="user_email"><?php _e('E-mail') ?></label>
|
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" />
|
309 |
</p>
|
310 |
<?php do_action('register_form', $instance); ?>
|
311 |
+
<p id="reg_passmail-<?php echo $instance; ?>"><?php echo $this->options['register_message']; ?></p>
|
312 |
<p class="submit">
|
313 |
<input type="submit" name="register-submit" id="register-submit-<?php echo $instance; ?>" value="<?php _e('Register'); ?>" />
|
314 |
</p>
|
324 |
|
325 |
function RetrievePasswordForm($instance) {
|
326 |
do_action('lost_password', $instance);
|
327 |
+
$this->PageHeader($instance, $this->options['lost_pass_message']);
|
328 |
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
329 |
?>
|
330 |
<form name="lostpasswordform" id="lostpasswordform-<?php echo $instance; ?>" action="<?php echo $this->GuessURL(array('instance' => $instance, 'action' => 'lostpassword')); ?>" method="post">
|
331 |
<p>
|
332 |
+
<label for="user_login"><?php _e('Username or E-mail:') ?></label>
|
333 |
+
<input type="text" name="user_login" id="user_login-<?php echo $instance; ?>" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" />
|
334 |
</p>
|
335 |
<?php do_action('lostpassword_form', $instance); ?>
|
336 |
<p class="submit">
|
591 |
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
592 |
tml_remove_mail_filters();
|
593 |
|
594 |
+
if ( !$this->options['reset_pass_email']['admin_disable'] )
|
595 |
wp_password_change_notification($user);
|
596 |
|
597 |
return true;
|
643 |
}
|
644 |
}
|
645 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
?>
|
css/theme-my-login-admin.css
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#container { margin: 20px 0 5px 0; font-size: 12px; }
|
2 |
+
|
3 |
+
/*
|
4 |
+
#container ul { list-style: none; position: relative; }
|
5 |
+
#container li { position: relative; display: inline; }
|
6 |
+
#container li a { float: left; text-decoration: none; padding: .5em 1em; }
|
7 |
+
|
8 |
+
#container h3 { clear: both; }
|
9 |
+
*/
|
10 |
+
|
11 |
+
#container table input.regular-text { width: 25em; }
|
12 |
+
#container table input.extended-text { width: 40em; }
|
13 |
+
#container table input.full-text { width: 99%; }
|
14 |
+
#container table input.small-text { width: 50px; }
|
15 |
+
|
16 |
+
#container div div { font-size: 1em; }
|
css/theme-my-login-admin.css.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$version = ( isset($_GET['ver']) ) ? $_GET['ver'] : '';
|
4 |
-
|
5 |
-
header("Content-type: text/css");
|
6 |
-
|
7 |
-
?>
|
8 |
-
|
9 |
-
#container { margin: 20px 0 5px 0; font-size: 12px; }
|
10 |
-
|
11 |
-
/*
|
12 |
-
#container ul { list-style: none; position: relative; }
|
13 |
-
#container li { position: relative; display: inline; }
|
14 |
-
#container li a { float: left; text-decoration: none; padding: .5em 1em; }
|
15 |
-
|
16 |
-
#container h3 { clear: both; }
|
17 |
-
*/
|
18 |
-
|
19 |
-
#container table input.regular-text { width: 25em; }
|
20 |
-
#container table input.extended-text { width: 40em; }
|
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', '>=') ) : ?>
|
29 |
-
|
30 |
-
<?php elseif ( version_compare($version, '2.5', '>=') ) : ?>
|
31 |
-
|
32 |
-
.tabs {
|
33 |
-
height: auto;
|
34 |
-
max-height: auto;
|
35 |
-
}
|
36 |
-
|
37 |
-
.tabs .tabs-div {
|
38 |
-
height: auto;
|
39 |
-
max-height: auto;
|
40 |
-
margin-left: 0;
|
41 |
-
}
|
42 |
-
|
43 |
-
.tabs .tabs-div .tabs-div {
|
44 |
-
height: auto;
|
45 |
-
max-height: auto;
|
46 |
-
overflow: visible;
|
47 |
-
}
|
48 |
-
|
49 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/theme-my-login.css
CHANGED
@@ -6,10 +6,16 @@
|
|
6 |
padding: 5px;
|
7 |
border: 1px solid #c00;
|
8 |
background-color: #ffebe8;
|
|
|
9 |
}
|
10 |
|
11 |
.login p.message {
|
12 |
padding: 5px;
|
13 |
border: 1px solid #e6db55;
|
14 |
background-color: #ffffe0;
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
6 |
padding: 5px;
|
7 |
border: 1px solid #c00;
|
8 |
background-color: #ffebe8;
|
9 |
+
color: #333;
|
10 |
}
|
11 |
|
12 |
.login p.message {
|
13 |
padding: 5px;
|
14 |
border: 1px solid #e6db55;
|
15 |
background-color: #ffffe0;
|
16 |
+
color: #333;
|
17 |
+
}
|
18 |
+
|
19 |
+
.login form label {
|
20 |
+
display: block;
|
21 |
}
|
includes/admin-page.php
DELETED
@@ -1,397 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
global $ThemeMyLogin, $wp_roles, $wp_version;
|
4 |
-
$user_roles = $wp_roles->get_names();
|
5 |
-
|
6 |
-
if ( $_POST ) {
|
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']['page_id'] = (int) $_POST['general']['page_id'];
|
15 |
-
$ThemeMyLogin->options['general']['from_name'] = stripslashes($_POST['general']['from_name']);
|
16 |
-
$ThemeMyLogin->options['general']['from_email'] = stripslashes($_POST['general']['from_email']);
|
17 |
-
$ThemeMyLogin->options['general']['email_format'] = stripslashes($_POST['general']['email_format']);
|
18 |
-
|
19 |
-
$ThemeMyLogin->SetOption('titles', stripslashes_deep($_POST['titles']));
|
20 |
-
$ThemeMyLogin->SetOption('messages', stripslashes_deep($_POST['messages']));
|
21 |
-
|
22 |
-
foreach ( $_POST['links'] as $role => $tmp ) {
|
23 |
-
foreach ( $tmp as $key => $data ) {
|
24 |
-
$links[$role][] = array('title' => $data['title'], 'url' => $data['url']);
|
25 |
-
}
|
26 |
-
}
|
27 |
-
$ThemeMyLogin->SetOption('links', $links);
|
28 |
-
foreach ( $_POST['redirects'] as $role => $data ) {
|
29 |
-
$redirects[$role] = array('login_url' => $data['login_url']);
|
30 |
-
}
|
31 |
-
$ThemeMyLogin->SetOption('redirects', $redirects);
|
32 |
-
foreach ( $_POST['emails'] as $email => $data ) {
|
33 |
-
$emails[$email] = array('subject' => stripslashes($data['subject']), 'message' => stripslashes($data['message']));
|
34 |
-
}
|
35 |
-
$emails['newregistration']['admin-disable'] = ( isset($_POST['emails']['newregistration']['admin-disable']) ) ? 1 : 0;
|
36 |
-
$emails['newregistration']['user-disable'] = ( isset($_POST['emails']['newregistration']['user-disable']) ) ? 1 : 0;
|
37 |
-
$emails['resetpassword']['admin-disable'] = ( isset($_POST['emails']['resetpassword']['admin-disable']) ) ? 1 : 0;
|
38 |
-
$ThemeMyLogin->SetOption('emails', $emails);
|
39 |
-
$ThemeMyLogin->SaveOptions();
|
40 |
-
|
41 |
-
if ( isset($_POST['general']['uninstall']) ) {
|
42 |
-
$info_message = __('To complete uninstall, deactivate this plugin. If you do not wish to uninstall, please uncheck the "Complete Uninstall" checkbox.', 'theme-my-login');
|
43 |
-
} elseif ( isset($_POST['general']['defaults']) ) {
|
44 |
-
$ThemeMyLogin->options = '';
|
45 |
-
$ThemeMyLogin->InitOptions(true);
|
46 |
-
$info_message = __('All settings restored to default state.', 'theme-my-login');
|
47 |
-
} else $info_message =__('Settings saved.', 'theme-my-login');
|
48 |
-
}
|
49 |
-
|
50 |
-
$titles = $ThemeMyLogin->GetOption('titles');
|
51 |
-
$messages = $ThemeMyLogin->GetOption('messages');
|
52 |
-
$links = $ThemeMyLogin->GetOption('links');
|
53 |
-
$redirects = $ThemeMyLogin->GetOption('redirects');
|
54 |
-
$emails = $ThemeMyLogin->GetOption('emails');
|
55 |
-
|
56 |
-
?>
|
57 |
-
|
58 |
-
<div class="updated" style="background:#f0f8ff; border:1px solid #addae6">
|
59 |
-
<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>
|
60 |
-
</div>
|
61 |
-
|
62 |
-
<div class="wrap">
|
63 |
-
<?php if ( function_exists('screen_icon') ) screen_icon('options-general'); ?>
|
64 |
-
|
65 |
-
<h2><?php _e('Theme My Login Settings'); ?></h2>
|
66 |
-
|
67 |
-
<?php if ( isset($info_message) && !empty($info_message) ) : ?>
|
68 |
-
<div id="message" class="updated fade">
|
69 |
-
<p><strong><?php echo $info_message ?></strong></p>
|
70 |
-
</div>
|
71 |
-
<?php endif; ?>
|
72 |
-
|
73 |
-
<?php if( isset($error_message) && !empty($error_message) ) : ?>
|
74 |
-
<div id="message" class="error">
|
75 |
-
<p><strong><?php echo $error_message ?></strong></p>
|
76 |
-
</div>
|
77 |
-
<?php endif; ?>
|
78 |
-
|
79 |
-
<form id="theme-my-login-settings" action="" method="post">
|
80 |
-
<?php wp_nonce_field('theme-my-login-settings'); ?>
|
81 |
-
|
82 |
-
<div id="container" class="tabs">
|
83 |
-
|
84 |
-
<ul class="tabs-nav">
|
85 |
-
<li><a href="#fragment-1">General</a></li>
|
86 |
-
<li><a href="#fragment-2">Template</a></li>
|
87 |
-
<li><a href="#fragment-3">Links</a></li>
|
88 |
-
<li><a href="#fragment-4">Redirection</a></li>
|
89 |
-
<li><a href="#fragment-5">E-mail</a></li>
|
90 |
-
</ul>
|
91 |
-
|
92 |
-
<div id="fragment-1" class="tabs-div">
|
93 |
-
|
94 |
-
<table class="form-table">
|
95 |
-
<tr valign="top">
|
96 |
-
<th scope="row"><?php _e('Plugin', 'theme-my-login'); ?></th>
|
97 |
-
<td>
|
98 |
-
<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"'; } ?> />
|
99 |
-
<label for="general[uninstall]"><?php _e('Uninstall', 'theme-my-login'); ?></label>
|
100 |
-
</td>
|
101 |
-
</tr>
|
102 |
-
<tr valign="top">
|
103 |
-
<th scope="row"><?php _e('Defaults', 'theme-my-login'); ?></th>
|
104 |
-
<td>
|
105 |
-
<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"'; } ?> />
|
106 |
-
<label for="general[defaults]"><?php _e('Reset Defaults', 'theme-my-login'); ?></label>
|
107 |
-
</td>
|
108 |
-
</tr>
|
109 |
-
<tr valign="top">
|
110 |
-
<th scope="row"><?php _e('Page List', 'theme-my-login'); ?></th>
|
111 |
-
<td>
|
112 |
-
<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"'; } ?> />
|
113 |
-
<label for="general[show_page]"><?php _e('Show Login Page', 'theme-my-login'); ?></label>
|
114 |
-
</td>
|
115 |
-
</tr>
|
116 |
-
<tr valign="top">
|
117 |
-
<th scope="row"><?php _e('Registration', 'theme-my-login'); ?></th>
|
118 |
-
<td>
|
119 |
-
<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"'; } ?> />
|
120 |
-
<label for="general[custom_pass]"><?php _e('Allow Users To Set Their Own Password', 'theme-my-login'); ?></label>
|
121 |
-
</td>
|
122 |
-
</tr>
|
123 |
-
<tr valign="top">
|
124 |
-
<th scope="row"><label for="general[page_id]"><?php _e('Page ID', 'theme-my-login'); ?></label></th>
|
125 |
-
<td>
|
126 |
-
<input name="general[page_id]" type="text" id="general[page_id]" value="<?php echo $ThemeMyLogin->options['general']['page_id']; ?>" size="1" />
|
127 |
-
<span class="description"><strong>DO NOT</strong> change this unless you are <strong>ABSOLUTELY POSITIVE</strong> you know what you are doing!</span>
|
128 |
-
</td>
|
129 |
-
</tr>
|
130 |
-
</table>
|
131 |
-
|
132 |
-
</div>
|
133 |
-
|
134 |
-
<div id="fragment-2" class="tabs-div">
|
135 |
-
|
136 |
-
<ul class="tabs-nav">
|
137 |
-
<li><a href="#fragment-2-1">Titles</a></li>
|
138 |
-
<li><a href="#fragment-2-2">Messages</a></li>
|
139 |
-
</ul>
|
140 |
-
|
141 |
-
<div id="fragment-2-1" class="tabs-div">
|
142 |
-
<table class="form-table">
|
143 |
-
<tr valign="top">
|
144 |
-
<th scope="row"><label for="titles[welcome]"><?php _e('Welcome', 'theme-my-login'); ?></label></th>
|
145 |
-
<td>
|
146 |
-
<input name="titles[welcome]" type="text" id="titles[welcome]" value="<?php echo htmlspecialchars($titles['welcome']); ?>" class="regular-text" />
|
147 |
-
</td>
|
148 |
-
</tr>
|
149 |
-
<tr valign="top">
|
150 |
-
<th scope="row"><label for="titles[login]"><?php _e('Log In', 'theme-my-login'); ?></label></th>
|
151 |
-
<td>
|
152 |
-
<input name="titles[login]" type="text" id="titles[login]" value="<?php echo htmlspecialchars($titles['login']); ?>" class="regular-text" />
|
153 |
-
</td>
|
154 |
-
</tr>
|
155 |
-
<tr valign="top">
|
156 |
-
<th scope="row"><label for="titles[register]"><?php _e('Register', 'theme-my-login'); ?></label></th>
|
157 |
-
<td>
|
158 |
-
<input name="titles[register]" type="text" id="titles[register]" value="<?php echo htmlspecialchars($titles['register']); ?>" class="regular-text" />
|
159 |
-
</td>
|
160 |
-
</tr>
|
161 |
-
<tr valign="top">
|
162 |
-
<th scope="row"><label for="titles[lostpassword]"><?php _e('Lost Password', 'theme-my-login'); ?></label></th>
|
163 |
-
<td>
|
164 |
-
<input name="titles[lostpassword]" type="text" id="titles[lostpassword]" value="<?php echo htmlspecialchars($titles['lostpassword']); ?>" class="regular-text" />
|
165 |
-
</td>
|
166 |
-
</tr>
|
167 |
-
<tr valign="top">
|
168 |
-
<th scope="row"><label for="titles[logout]"><?php _e('Log Out', 'theme-my-login'); ?></label></th>
|
169 |
-
<td>
|
170 |
-
<input name="titles[logout]" type="text" id="titles[logout]" value="<?php echo htmlspecialchars($titles['logout']); ?>" class="regular-text" />
|
171 |
-
</td>
|
172 |
-
</tr>
|
173 |
-
</table>
|
174 |
-
</div>
|
175 |
-
|
176 |
-
<div id="fragment-2-2" class="tabs-div">
|
177 |
-
<table class="form-table">
|
178 |
-
<tr valign="top">
|
179 |
-
<th scope="row"><label for="register_msg"><?php _e('Register', 'theme-my-login'); ?></label></th>
|
180 |
-
<td>
|
181 |
-
<input name="messages[register]" type="text" id="messages[register]" value="<?php echo htmlspecialchars($messages['register']); ?>" class="extended-text" />
|
182 |
-
</td>
|
183 |
-
</tr>
|
184 |
-
<tr valign="top">
|
185 |
-
<th scope="row"><label for="register_complete"><?php _e('Registration Complete', 'theme-my-login'); ?></label></th>
|
186 |
-
<td>
|
187 |
-
<input name="messages[success]" type="text" id="messages[success]" value="<?php echo htmlspecialchars($messages['success']); ?>" class="extended-text" />
|
188 |
-
</td>
|
189 |
-
</tr>
|
190 |
-
<tr valign="top">
|
191 |
-
<th scope="row"><label for="password_msg"><?php _e('Lost Password', 'theme-my-login'); ?></label></th>
|
192 |
-
<td>
|
193 |
-
<input name="messages[lostpassword]" type="text" id="messages[lostpassword]" value="<?php echo htmlspecialchars($messages['lostpassword']); ?>" class="extended-text" />
|
194 |
-
</td>
|
195 |
-
</tr>
|
196 |
-
</table>
|
197 |
-
</div>
|
198 |
-
|
199 |
-
</div>
|
200 |
-
|
201 |
-
<div id="fragment-3" class="tabs-div">
|
202 |
-
|
203 |
-
<ul class="tabs-nav">
|
204 |
-
<?php
|
205 |
-
$i = 1;
|
206 |
-
foreach ($user_roles as $role => $value) {
|
207 |
-
echo '<li><a href="#fragment-3-' . $i . '">' . ucwords($role) . '</a></li>' . "\n";
|
208 |
-
$i++;
|
209 |
-
}
|
210 |
-
?>
|
211 |
-
</ul>
|
212 |
-
|
213 |
-
<?php
|
214 |
-
$i1 = 1;
|
215 |
-
foreach ($user_roles as $role => $value) {
|
216 |
-
?>
|
217 |
-
<div id="fragment-3-<?php echo $i1; ?>" class="tabs-div">
|
218 |
-
|
219 |
-
<table id="links-<?php echo $role; ?>" class="form-table link-table">
|
220 |
-
<?php $i2 = 0; ?>
|
221 |
-
<?php $alt = 'alternate'; ?>
|
222 |
-
<?php if ( is_array($links[$role]) ) { ?>
|
223 |
-
<?php foreach ( $links[$role] as $key => $data ) {
|
224 |
-
$alt = ('alternate' == $alt) ? '' : 'alternate';
|
225 |
-
?>
|
226 |
-
<tr id="link-row-<?php echo $i2; ?>" class="<?php echo $alt; ?>">
|
227 |
-
<td>
|
228 |
-
Title<br />
|
229 |
-
<input name="links[<?php echo $role; ?>][<?php echo $i2; ?>][title]" type="text" id="links[<?php echo $role; ?>][<?php echo $i2; ?>][title]" value="<?php echo htmlspecialchars($data['title']); ?>" class="regular-text link-title" /><br />
|
230 |
-
URL<br />
|
231 |
-
<input name="links[<?php echo $role; ?>][<?php echo $i2; ?>][url]" type="text" id="links[<?php echo $role; ?>][<?php echo $i2; ?>][url]" value="<?php echo $data['url']; ?>" class="extended-text link-url" /><br />
|
232 |
-
<p>
|
233 |
-
<a class="link remove <?php echo $role; ?>" href="" title="Remove This Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/remove.gif" /></a>
|
234 |
-
<a class="link add <?php echo $role; ?>" href="" title="Add Another Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/add.gif" /></a>
|
235 |
-
</p>
|
236 |
-
</td>
|
237 |
-
</tr>
|
238 |
-
<?php
|
239 |
-
$i2++;
|
240 |
-
}
|
241 |
-
} else { ?>
|
242 |
-
<tr id="link-row-0" class="">
|
243 |
-
<td>
|
244 |
-
Title<br />
|
245 |
-
<input name="links[<?php echo $role; ?>][0][title]" type="text" id="links[<?php echo $role; ?>][0][title]" value="" class="regular-text link-title" /><br />
|
246 |
-
URL<br />
|
247 |
-
<input name="links[<?php echo $role; ?>][0][url]" type="text" id="links[<?php echo $role; ?>][0][url]" value="" class="extended-text link-url" /><br />
|
248 |
-
<p>
|
249 |
-
<a class="link remove <?php echo $role; ?>" href="" title="Remove This Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/remove.gif" /></a>
|
250 |
-
<a class="link add <?php echo $role; ?>" href="" title="Add Another Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/add.gif" /></a>
|
251 |
-
</p>
|
252 |
-
</td>
|
253 |
-
</tr>
|
254 |
-
<?php } ?>
|
255 |
-
</table>
|
256 |
-
|
257 |
-
</div>
|
258 |
-
|
259 |
-
<?php
|
260 |
-
$i1++;
|
261 |
-
}
|
262 |
-
?>
|
263 |
-
|
264 |
-
</div>
|
265 |
-
|
266 |
-
<div id="fragment-4" class="tabs-div">
|
267 |
-
|
268 |
-
<ul class="tabs-nav">
|
269 |
-
<?php
|
270 |
-
$i = 1;
|
271 |
-
foreach ($user_roles as $role => $value) {
|
272 |
-
echo '<li><a href="#fragment-4-' . $i . '">' . ucwords($role) . '</a></li>' . "\n";
|
273 |
-
$i++;
|
274 |
-
}
|
275 |
-
?>
|
276 |
-
</ul>
|
277 |
-
|
278 |
-
<?php
|
279 |
-
$i1 = 1;
|
280 |
-
foreach ($user_roles as $role => $value) {
|
281 |
-
?>
|
282 |
-
<div id="fragment-4-<?php echo $i1; ?>" class="tabs-div">
|
283 |
-
|
284 |
-
<table id="redirection-<?php echo $role; ?>" class="form-table redirection-table">
|
285 |
-
<tr id="redirect-row-<?php echo $i2; ?>">
|
286 |
-
<td>
|
287 |
-
Log In URL<br />
|
288 |
-
<input name="redirects[<?php echo $role; ?>][login_url]" type="text" id="redirects[<?php echo $role; ?>][login_url]" value="<?php echo $redirects[$role]['login_url']; ?>" class="extended-text redirect-url" />
|
289 |
-
</td>
|
290 |
-
</tr>
|
291 |
-
</table>
|
292 |
-
|
293 |
-
</div>
|
294 |
-
|
295 |
-
<?php
|
296 |
-
$i1++;
|
297 |
-
}
|
298 |
-
?>
|
299 |
-
|
300 |
-
</div>
|
301 |
-
|
302 |
-
<div id="fragment-5" class="tabs-div">
|
303 |
-
|
304 |
-
<ul class="tabs-nav">
|
305 |
-
<li><a href="#fragment-5-1">General</a></li>
|
306 |
-
<li><a href="#fragment-5-2">New Registration</a></li>
|
307 |
-
<li><a href="#fragment-5-3">Password Retrieval</a></li>
|
308 |
-
<li><a href="#fragment-5-4">Password Reset</a></li>
|
309 |
-
</ul>
|
310 |
-
|
311 |
-
<div id="fragment-5-1" class="tabs-div">
|
312 |
-
<table class="form-table">
|
313 |
-
<tr valign="top">
|
314 |
-
<td>
|
315 |
-
<label for="general[from_name]"><?php _e('From Name', 'theme-my-login'); ?></label><br />
|
316 |
-
<input name="general[from_name]" type="text" id="general[from_name]" value="<?php echo htmlspecialchars($ThemeMyLogin->options['general']['from_name']); ?>" class="regular-text" />
|
317 |
-
</td>
|
318 |
-
</tr>
|
319 |
-
<tr valign="top">
|
320 |
-
<td>
|
321 |
-
<label for="general[from_email]"><?php _e('From E-mail', 'theme-my-login'); ?></label><br />
|
322 |
-
<input name="general[from_email]" type="text" id="general[from_email]" value="<?php echo htmlspecialchars($ThemeMyLogin->options['general']['from_email']); ?>" class="regular-text" />
|
323 |
-
</td>
|
324 |
-
</tr>
|
325 |
-
<tr valign="top">
|
326 |
-
<td>
|
327 |
-
<label for"general[email_format]"><?php _e('E-mail Format', 'theme-my-login'); ?></label><br />
|
328 |
-
<select name="general[email_format]" id="general[email_format]">
|
329 |
-
<option value="text/plain"<?php if ('text/plain' == $ThemeMyLogin->options['general']['email_format']) echo ' selected="selected"'; ?>>Plain Text</option>
|
330 |
-
<option value="text/html"<?php if ('text/html' == $ThemeMyLogin->options['general']['email_format']) echo ' selected="selected"'; ?>>HTML</option>
|
331 |
-
</select>
|
332 |
-
</td>
|
333 |
-
</tr>
|
334 |
-
</table>
|
335 |
-
</div>
|
336 |
-
|
337 |
-
<div id="fragment-5-2" class="tabs-div">
|
338 |
-
<table class="form-table">
|
339 |
-
<tr>
|
340 |
-
<td>
|
341 |
-
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%, %user_ip%</em></p>
|
342 |
-
Subject<br />
|
343 |
-
<input name="emails[newregistration][subject]" type="text" id="emails[newregistration][subject]" value="<?php echo htmlspecialchars($emails['newregistration']['subject']); ?>" class="full-text" /><br />
|
344 |
-
Message<br />
|
345 |
-
<textarea name="emails[newregistration][message]" id="emails[newregistration][message]" class="large-text"><?php echo htmlspecialchars($emails['newregistration']['message']); ?></textarea><br />
|
346 |
-
<p>
|
347 |
-
<label for "emails[newregistration][admin-disable]"><input name="emails[newregistration][admin-disable]" type="checkbox" id="emails[newregistration][admin-disable]" value="1" <?php if ( isset($emails['newregistration']['admin-disable']) && true == $emails['newregistration']['admin-disable'] ) { echo 'checked="checked"'; } ?> /> Disable Admin Notification</label>
|
348 |
-
<label for "emails[newregistration][user-disable]"><input name="emails[newregistration][user-disable]" type="checkbox" id="emails[newregistration][useradmin-disable]" value="1" <?php if ( isset($emails['newregistration']['user-disable']) && true == $emails['newregistration']['user-disable'] ) { echo 'checked="checked"'; } ?> /> Disable User Notification</label>
|
349 |
-
</p>
|
350 |
-
</td>
|
351 |
-
</tr>
|
352 |
-
</table>
|
353 |
-
</div>
|
354 |
-
|
355 |
-
<div id="fragment-5-3" class="tabs-div">
|
356 |
-
<table class="form-table">
|
357 |
-
<tr>
|
358 |
-
<td>
|
359 |
-
<p><em>Avilable Variables: %blogname%, %siteurl%, %reseturl%, %user_login%, %user_email%, %user_ip%</em></p>
|
360 |
-
Subject<br />
|
361 |
-
<input name="emails[retrievepassword][subject]" type="text" id="emails[retrievepassword][subject]" value="<?php echo htmlspecialchars($emails['retrievepassword']['subject']); ?>" class="full-text" /><br />
|
362 |
-
Message<br />
|
363 |
-
<textarea name="emails[retrievepassword][message]" id="emails[retrievepassword][message]" class="large-text"><?php echo htmlspecialchars($emails['retrievepassword']['message']); ?></textarea><br />
|
364 |
-
</td>
|
365 |
-
</tr>
|
366 |
-
</table>
|
367 |
-
</div>
|
368 |
-
|
369 |
-
<div id="fragment-5-4" class="tabs-div">
|
370 |
-
<table class="form-table">
|
371 |
-
<tr>
|
372 |
-
<td>
|
373 |
-
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%, %user_ip%</em></p>
|
374 |
-
Subject<br />
|
375 |
-
<input name="emails[resetpassword][subject]" type="text" id="emails[resetpassword][subject]" value="<?php echo htmlspecialchars($emails['resetpassword']['subject']); ?>" class="full-text" /><br />
|
376 |
-
Message<br />
|
377 |
-
<textarea name="emails[resetpassword][message]" id="emails[resetpassword][message]" class="large-text"><?php echo htmlspecialchars($emails['resetpassword']['message']); ?></textarea><br />
|
378 |
-
<p>
|
379 |
-
<label for "emails[resetpassword][admin-disable]"><input name="emails[resetpassword][admin-disable]" type="checkbox" id="emails[resetpassword][admin-disable]" value="1" <?php if ( isset($ThemeMyLogin->options['emails']['resetpassword']['admin-disable']) && true == $emails['resetpassword']['admin-disable'] ) { echo 'checked="checked"'; } ?> /> Disable Admin Notification</label>
|
380 |
-
</p>
|
381 |
-
</td>
|
382 |
-
</tr>
|
383 |
-
</table>
|
384 |
-
</div>
|
385 |
-
|
386 |
-
</div>
|
387 |
-
|
388 |
-
</div>
|
389 |
-
|
390 |
-
<?php if ( version_compare($wp_version, '2.7', '>=') ) : ?>
|
391 |
-
<p><input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /></p>
|
392 |
-
<?php else : ?>
|
393 |
-
<p><input type="submit" name="Submit" class="button" value="<?php _e('Save Changes'); ?>" /></p>
|
394 |
-
<?php endif; ?>
|
395 |
-
</form>
|
396 |
-
|
397 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/compat.php
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if ( !function_exists('is_ssl') ) :
|
3 |
-
function is_ssl() {
|
4 |
-
if ( isset($_SERVER['HTTPS']) ) {
|
5 |
-
if ( 'on' == strtolower($_SERVER['HTTPS']) )
|
6 |
-
return true;
|
7 |
-
if ( '1' == $_SERVER['HTTPS'] )
|
8 |
-
return true;
|
9 |
-
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
|
10 |
-
return true;
|
11 |
-
}
|
12 |
-
return false;
|
13 |
-
}
|
14 |
-
endif;
|
15 |
-
|
16 |
-
if ( !function_exists('site_url') ) :
|
17 |
-
function site_url($path = '', $scheme = null) {
|
18 |
-
// should the list of allowed schemes be maintained elsewhere?
|
19 |
-
$orig_scheme = $scheme;
|
20 |
-
if ( !in_array($scheme, array('http', 'https')) ) {
|
21 |
-
if ( ('login_post' == $scheme) && ( force_ssl_login() || force_ssl_admin() ) )
|
22 |
-
$scheme = 'https';
|
23 |
-
elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
|
24 |
-
$scheme = 'https';
|
25 |
-
elseif ( ('admin' == $scheme) && force_ssl_admin() )
|
26 |
-
$scheme = 'https';
|
27 |
-
else
|
28 |
-
$scheme = ( is_ssl() ? 'https' : 'http' );
|
29 |
-
}
|
30 |
-
|
31 |
-
$url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
|
32 |
-
|
33 |
-
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
|
34 |
-
$url .= '/' . ltrim($path, '/');
|
35 |
-
|
36 |
-
return apply_filters('site_url', $url, $path, $orig_scheme);
|
37 |
-
}
|
38 |
-
endif;
|
39 |
-
|
40 |
-
if ( !function_exists('admin_url') ) :
|
41 |
-
function admin_url($path = '') {
|
42 |
-
$url = site_url('wp-admin/', 'admin');
|
43 |
-
|
44 |
-
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
|
45 |
-
$url .= ltrim($path, '/');
|
46 |
-
|
47 |
-
return $url;
|
48 |
-
}
|
49 |
-
endif;
|
50 |
-
|
51 |
-
if ( !function_exists('includes_url') ) :
|
52 |
-
function includes_url($path = '') {
|
53 |
-
$url = site_url() . '/' . WPINC . '/';
|
54 |
-
|
55 |
-
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
|
56 |
-
$url .= ltrim($path, '/');
|
57 |
-
|
58 |
-
return $url;
|
59 |
-
}
|
60 |
-
endif;
|
61 |
-
|
62 |
-
if ( !function_exists('content_url') ) :
|
63 |
-
function content_url($path = '') {
|
64 |
-
$scheme = ( is_ssl() ? 'https' : 'http' );
|
65 |
-
$url = WP_CONTENT_URL;
|
66 |
-
if ( 0 === strpos($url, 'http') ) {
|
67 |
-
if ( is_ssl() )
|
68 |
-
$url = str_replace( 'http://', "{$scheme}://", $url );
|
69 |
-
}
|
70 |
-
|
71 |
-
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
|
72 |
-
$url .= '/' . ltrim($path, '/');
|
73 |
-
|
74 |
-
return $url;
|
75 |
-
}
|
76 |
-
endif;
|
77 |
-
|
78 |
-
if ( !function_exists('plugin_url') ) :
|
79 |
-
function plugins_url($path = '') {
|
80 |
-
$scheme = ( is_ssl() ? 'https' : 'http' );
|
81 |
-
$url = WP_PLUGIN_URL;
|
82 |
-
if ( 0 === strpos($url, 'http') ) {
|
83 |
-
if ( is_ssl() )
|
84 |
-
$url = str_replace( 'http://', "{$scheme}://", $url );
|
85 |
-
}
|
86 |
-
|
87 |
-
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
|
88 |
-
$url .= '/' . ltrim($path, '/');
|
89 |
-
|
90 |
-
return $url;
|
91 |
-
}
|
92 |
-
endif;
|
93 |
-
|
94 |
-
if ( !function_exists('force_ssl_login') ) :
|
95 |
-
function force_ssl_login($force = '') {
|
96 |
-
static $forced;
|
97 |
-
|
98 |
-
if ( '' != $force ) {
|
99 |
-
$old_forced = $forced;
|
100 |
-
$forced = $force;
|
101 |
-
return $old_forced;
|
102 |
-
}
|
103 |
-
|
104 |
-
return $forced;
|
105 |
-
}
|
106 |
-
endif;
|
107 |
-
|
108 |
-
if ( !function_exists('force_ssl_admin') ) :
|
109 |
-
function force_ssl_admin($force = '') {
|
110 |
-
static $forced;
|
111 |
-
|
112 |
-
if ( '' != $force ) {
|
113 |
-
$old_forced = $forced;
|
114 |
-
$forced = $force;
|
115 |
-
return $old_forced;
|
116 |
-
}
|
117 |
-
|
118 |
-
return $forced;
|
119 |
-
}
|
120 |
-
endif;
|
121 |
-
|
122 |
-
if ( !function_exists('wp_password_change_notification') ) :
|
123 |
-
function wp_password_change_notification(&$user) {
|
124 |
-
// send a copy of password change notification to the admin
|
125 |
-
// but check to see if it's the admin whose password we're changing, and skip this
|
126 |
-
if ( $user->user_email != get_option('admin_email') ) {
|
127 |
-
$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
|
128 |
-
wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message);
|
129 |
-
}
|
130 |
-
}
|
131 |
-
endif;
|
132 |
-
|
133 |
-
if ( !function_exists('wp_guess_url') ) :
|
134 |
-
function wp_guess_url() {
|
135 |
-
if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
|
136 |
-
$url = WP_SITEURL;
|
137 |
-
} else {
|
138 |
-
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
139 |
-
$url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
140 |
-
}
|
141 |
-
return $url;
|
142 |
-
}
|
143 |
-
endif;
|
144 |
-
|
145 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -23,6 +23,7 @@ This plugin themes the WordPress login, registration and forgot password pages a
|
|
23 |
* Customize user emails for registration and/or password recovery
|
24 |
* Send user emails in HTML format
|
25 |
* Allow users to set their own password upon registration
|
|
|
26 |
|
27 |
|
28 |
== Installation ==
|
@@ -38,6 +39,12 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
|
|
38 |
|
39 |
== Changelog ==
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
= 4.2.2 =
|
42 |
* Added the option to remove 'Register' and/or 'Lost Password' links
|
43 |
* Fixed a bug that sent e-mail from all plugins from this plugins setting
|
23 |
* Customize user emails for registration and/or password recovery
|
24 |
* Send user emails in HTML format
|
25 |
* Allow users to set their own password upon registration
|
26 |
+
* Optionally require users to be approved upon registration
|
27 |
|
28 |
|
29 |
== Installation ==
|
39 |
|
40 |
== Changelog ==
|
41 |
|
42 |
+
= 4.3 =
|
43 |
+
* Added the option to require approval for new registrations
|
44 |
+
* Added the option to enable/disable plugin stylesheet
|
45 |
+
* Removed form input fields from label tags
|
46 |
+
* Dropped support for WordPress versions older than 2.6
|
47 |
+
|
48 |
= 4.2.2 =
|
49 |
* Added the option to remove 'Register' and/or 'Lost Password' links
|
50 |
* Fixed a bug that sent e-mail from all plugins from this plugins setting
|
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
|
@@ -11,180 +11,71 @@ Text Domain: theme-my-login
|
|
11 |
|
12 |
global $wp_version;
|
13 |
|
14 |
-
require_once ('classes/class.plugin-shell.php');
|
15 |
require_once ('classes/class.wp-login.php');
|
16 |
|
17 |
-
if ($wp_version < '2.6') {
|
18 |
-
require (WP_PLUGIN_DIR . '/theme-my-login/includes/compat.php');
|
19 |
-
}
|
20 |
-
|
21 |
if (!class_exists('ThemeMyLogin')) {
|
22 |
-
class ThemeMyLogin
|
23 |
|
24 |
-
var $version = '4.
|
25 |
var $options = array();
|
26 |
var $permalink = '';
|
27 |
var $instances = 0;
|
28 |
|
29 |
function ThemeMyLogin() {
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
load_plugin_textdomain($this->plugin_textdomain, '/wp-content/plugins/theme-my-login/language');
|
34 |
-
|
35 |
-
register_activation_hook ( __FILE__, array( &$this, 'Activate' ) );
|
36 |
-
register_deactivation_hook ( __FILE__, array( &$this, 'Deactivate' ) );
|
37 |
-
|
38 |
-
$this->AddAdminPage('options', __('Theme My Login', 'theme-my-login'), __('Theme My Login', 'theme-my-login'), 8, '/theme-my-login/includes/admin-page.php');
|
39 |
-
|
40 |
-
$this->AddAction('init');
|
41 |
-
$this->AddAction('admin_init');
|
42 |
-
$this->AddAction('template_redirect');
|
43 |
-
|
44 |
-
$this->AddAction('register_form');
|
45 |
-
$this->AddAction('registration_errors');
|
46 |
-
|
47 |
-
$this->AddFilter('wp_head');
|
48 |
-
$this->AddFilter('wp_title');
|
49 |
-
$this->AddFilter('the_title');
|
50 |
-
$this->AddFilter('wp_list_pages');
|
51 |
-
$this->AddFilter('wp_list_pages_excludes');
|
52 |
-
$this->AddFilter('login_redirect', 'LoginRedirect', 10, 3);
|
53 |
-
$this->AddFilter('site_url', 'SiteURL', 10, 2);
|
54 |
-
$this->AddFilter('retrieve_password_title', 'RetrievePasswordTitle', 10, 2);
|
55 |
-
$this->AddFilter('retrieve_password_message', 'RetrievePasswordMessage', 10, 3);
|
56 |
-
$this->AddFilter('password_reset_title', 'PasswordResetTitle', 10, 2);
|
57 |
-
$this->AddFilter('password_reset_message', 'PasswordResetMessage', 10, 3);
|
58 |
-
|
59 |
-
$this->AddShortcode('theme-my-login-page');
|
60 |
-
$this->AddShortcode('theme-my-login');
|
61 |
-
|
62 |
-
$this->LoadOptions();
|
63 |
-
|
64 |
-
if ( !isset($this->options['general']['page_id']) || empty($this->options['general']['page_id']) ) {
|
65 |
-
$login_page = get_page_by_title('Login');
|
66 |
-
$this->options['general']['page_id'] = ( $login_page ) ? $login_page->ID : 0;
|
67 |
-
$this->SaveOptions();
|
68 |
-
}
|
69 |
-
|
70 |
-
$this->WPPluginShell();
|
71 |
-
|
72 |
-
}
|
73 |
-
|
74 |
-
function Activate() {
|
75 |
-
$insert = array(
|
76 |
-
'post_title' => 'Login',
|
77 |
-
'post_status' => 'publish',
|
78 |
-
'post_type' => 'page',
|
79 |
-
'post_author' => 1,
|
80 |
-
'post_content' => '[theme-my-login-page]',
|
81 |
-
'comment_status' => 'closed',
|
82 |
-
'ping_status' => 'closed'
|
83 |
-
);
|
84 |
-
|
85 |
-
$theme_my_login = get_page_by_title('Login');
|
86 |
-
if ( !$theme_my_login ) {
|
87 |
-
$page_id = wp_insert_post($insert);
|
88 |
-
} else {
|
89 |
-
$page_id = $theme_my_login->ID;
|
90 |
-
$insert['ID'] = $page_id;
|
91 |
-
$insert['post_content'] = str_replace('[theme-my-login]', '[theme-my-login-page]', $theme_my_login->post_content);
|
92 |
-
wp_update_post($insert);
|
93 |
-
}
|
94 |
-
|
95 |
-
$opts = get_option('theme_my_login');
|
96 |
-
if ( $opts ) {
|
97 |
-
if ( is_array($opts) ) {
|
98 |
-
if ( isset($opts['version']) && version_compare($opts['version'], '4.0', '<') ) {
|
99 |
-
delete_option('theme_my_login');
|
100 |
-
delete_option('widget_theme-my-login');
|
101 |
-
}
|
102 |
-
}
|
103 |
-
}
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
$this->SaveOptions();
|
108 |
-
}
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
delete_option('theme_my_login');
|
113 |
-
delete_option('widget_theme-my-login');
|
114 |
-
wp_delete_post($this->options['general']['page_id']);
|
115 |
-
}
|
116 |
-
}
|
117 |
|
118 |
-
|
|
|
119 |
|
120 |
-
|
121 |
-
$this->options['general']['uninstall'] = 0;
|
122 |
-
$this->options['general']['defaults'] = 0;
|
123 |
-
$this->options['general']['show_page'] = 0;
|
124 |
-
$this->options['general']['custom_pass'] = 0;
|
125 |
-
$this->options['general']['from_name'] = '';
|
126 |
-
$this->options['general']['from_email'] = '';
|
127 |
-
$this->options['general']['email_format'] = 'text/plain';
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
$this->options['messages']['lostpassword'] = __('Please enter your username or e-mail address. You will receive a new password via e-mail.');
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
$this->options['widget']['show_links'] = 1;
|
142 |
-
$this->options['widget']['show_reg_link'] = 1;
|
143 |
-
$this->options['widget']['show_pass_link'] = 1;
|
144 |
-
$this->options['widget']['registration'] = 1;
|
145 |
-
$this->options['widget']['lostpassword'] = 1;
|
146 |
-
$this->options['widget']['show_logged'] = 1;
|
147 |
-
$this->options['widget']['show_gravatar'] = 1;
|
148 |
-
$this->options['widget']['gravatar_size'] = 50;
|
149 |
-
$this->options['widget']['before_widget'] = '<li>';
|
150 |
-
$this->options['widget']['after_widget'] = '</li>';
|
151 |
-
$this->options['widget']['before_title'] = '<h2>';
|
152 |
-
$this->options['widget']['after_title'] = '</h2>';
|
153 |
|
154 |
-
|
155 |
-
$this->options['emails']['retrievepassword']['message'] = '';
|
156 |
-
$this->options['emails']['resetpassword']['subject'] = '';
|
157 |
-
$this->options['emails']['resetpassword']['message'] = '';
|
158 |
-
$this->options['emails']['resetpassword']['admin-disable'] = 0;
|
159 |
-
$this->options['emails']['newregistration']['subject'] = '';
|
160 |
-
$this->options['emails']['newregistration']['message'] = '';
|
161 |
-
$this->options['emails']['newregistration']['admin-disable'] = 0;
|
162 |
-
$this->options['emails']['newregistration']['user-disable'] = 0;
|
163 |
-
|
164 |
-
global $wp_roles;
|
165 |
-
if ( empty($wp_roles) )
|
166 |
-
$wp_roles = new WP_Roles();
|
167 |
-
|
168 |
-
$user_roles = $wp_roles->get_names();
|
169 |
-
foreach ( $user_roles as $role => $title ) {
|
170 |
-
$this->options['links'][$role][] = array('title' => 'Dashboard', 'url' => admin_url());
|
171 |
-
$this->options['links'][$role][] = array('title' => 'Profile', 'url' => admin_url('profile.php'));
|
172 |
-
$this->options['redirects'][$role] = array('login_url' => '', 'logout_url' => '');
|
173 |
-
}
|
174 |
|
175 |
-
|
|
|
|
|
|
|
|
|
176 |
$this->SaveOptions();
|
|
|
177 |
}
|
178 |
|
179 |
function Init() {
|
180 |
global $pagenow;
|
181 |
|
182 |
-
$this->permalink = get_permalink($this->options['
|
183 |
|
184 |
switch ( $pagenow ) {
|
185 |
case 'wp-register.php':
|
186 |
case 'wp-login.php':
|
187 |
-
if ( !empty($this->options['
|
188 |
$redirect_to = add_query_arg($_GET, $this->permalink);
|
189 |
wp_redirect($redirect_to);
|
190 |
exit();
|
@@ -192,80 +83,177 @@ if (!class_exists('ThemeMyLogin')) {
|
|
192 |
break;
|
193 |
}
|
194 |
|
195 |
-
if (
|
196 |
-
|
197 |
-
else
|
198 |
-
$this->AddStyle('theme-my-login', plugins_url('/theme-my-login/css/theme-my-login.css'));
|
199 |
|
200 |
}
|
201 |
|
202 |
function AdminInit() {
|
203 |
global $user_ID, $wp_version, $pagenow;
|
204 |
|
205 |
-
if ( 'options-general.php' == $pagenow
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
$
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
$this->AddAdminScript('jquery-ui-tabs', plugins_url('/theme-my-login/js/jquery/ui.tabs.js'), array('jquery', 'jquery-ui-core'), '1.7.2');
|
224 |
-
}
|
225 |
-
|
226 |
-
$this->AddAdminScript('theme-my-login-admin', plugins_url('/theme-my-login/js/theme-my-login-admin.js'));
|
227 |
-
|
228 |
-
$this->AddAdminStyle('theme-my-login-admin', plugins_url('/theme-my-login/css/theme-my-login-admin.css.php'));
|
229 |
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
|
|
|
|
|
|
241 |
}
|
242 |
|
243 |
-
|
244 |
add_action('admin_notices', array(&$this, 'PageEditNotice'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
}
|
247 |
|
248 |
function PageEditNotice() {
|
249 |
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>';
|
250 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
function TemplateRedirect() {
|
253 |
global $WPLogin;
|
254 |
|
255 |
-
if ( is_page($this->options['
|
256 |
$action = ( isset($_GET['action']) ) ? $_GET['action'] : '';
|
257 |
if ( is_user_logged_in() && 'logout' != $action ) {
|
258 |
-
wp_redirect(
|
259 |
exit();
|
260 |
}
|
261 |
}
|
262 |
-
|
263 |
-
if ( !is_admin() )
|
264 |
-
$WPLogin = new WPLogin('theme-my-login', $this->options);
|
265 |
}
|
266 |
|
267 |
function RegisterForm($instance) {
|
268 |
-
if (
|
269 |
?>
|
270 |
<p><label><?php _e('Password:');?> <br />
|
271 |
<input autocomplete="off" name="pass1" id="pass1-<?php echo $instance; ?>" class="input" size="20" value="" type="password" /></label><br />
|
@@ -276,7 +264,7 @@ if (!class_exists('ThemeMyLogin')) {
|
|
276 |
}
|
277 |
|
278 |
function RegistrationErrors($errors){
|
279 |
-
if (
|
280 |
if (empty($_POST['pass1']) || $_POST['pass1'] == '' || empty($_POST['pass2']) || $_POST['pass2'] == ''){
|
281 |
$errors->add('empty_password', __('<strong>ERROR</strong>: Please enter a password.'));
|
282 |
} elseif ($_POST['pass1'] !== $_POST['pass2']){
|
@@ -290,39 +278,55 @@ if (!class_exists('ThemeMyLogin')) {
|
|
290 |
|
291 |
return $errors;
|
292 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
function WPHead() {
|
295 |
-
|
296 |
-
do_action('login_head');
|
297 |
}
|
298 |
|
299 |
function WPTitle($title) {
|
300 |
global $WPLogin;
|
301 |
|
302 |
-
if ( is_page($this->options['
|
303 |
-
|
304 |
-
$titles = $this->GetOption('titles');
|
305 |
|
306 |
$action = ( isset($WPLogin->options['action']) ) ? $WPLogin->options['action'] : '';
|
307 |
if ( 'tml-main' == $WPLogin->instance || empty($WPLogin->instance) )
|
308 |
$action = $WPLogin->action;
|
309 |
|
310 |
if ( is_user_logged_in() )
|
311 |
-
return str_replace('Login', $
|
312 |
|
313 |
switch ($action) {
|
314 |
case 'register':
|
315 |
-
return str_replace('Login', $
|
316 |
break;
|
317 |
case 'lostpassword':
|
318 |
case 'retrievepassword':
|
319 |
case 'resetpass':
|
320 |
case 'rp':
|
321 |
-
return str_replace('Login', $
|
322 |
break;
|
323 |
case 'login':
|
324 |
default:
|
325 |
-
return str_replace('Login', $
|
326 |
}
|
327 |
} return $title;
|
328 |
}
|
@@ -334,11 +338,9 @@ if (!class_exists('ThemeMyLogin')) {
|
|
334 |
return $title;
|
335 |
|
336 |
if ( $title == 'Login' ) {
|
337 |
-
|
338 |
-
$titles = $this->GetOption('titles');
|
339 |
|
340 |
if ( is_user_logged_in() )
|
341 |
-
return $
|
342 |
|
343 |
$action = ( isset($WPLogin->options['action']) ) ? $WPLogin->options['action'] : '';
|
344 |
if ( 'tml-main' == $WPLogin->instance || empty($WPLogin->instance) )
|
@@ -346,17 +348,17 @@ if (!class_exists('ThemeMyLogin')) {
|
|
346 |
|
347 |
switch ($action) {
|
348 |
case 'register':
|
349 |
-
return $
|
350 |
break;
|
351 |
case 'lostpassword':
|
352 |
case 'retrievepassword':
|
353 |
case 'resetpass':
|
354 |
case 'rp':
|
355 |
-
return $
|
356 |
break;
|
357 |
case 'login':
|
358 |
default:
|
359 |
-
return $
|
360 |
}
|
361 |
} return $title;
|
362 |
}
|
@@ -364,19 +366,17 @@ if (!class_exists('ThemeMyLogin')) {
|
|
364 |
function WPListPages($pages) {
|
365 |
global $wp_version, $WPLogin;
|
366 |
|
367 |
-
if ( $this->options['
|
368 |
$redirect = $WPLogin->GuessURL();
|
369 |
$logout_url = ( version_compare($wp_version, '2.7', '>=') ) ? wp_logout_url($redirect) : site_url('wp-login.php?action=logout&redirect_to='.$redirect, 'login');
|
370 |
$pages = str_replace($this->permalink, $logout_url, $pages);
|
371 |
}
|
372 |
-
|
373 |
return $pages;
|
374 |
}
|
375 |
|
376 |
function WPListPagesExcludes($excludes) {
|
377 |
-
if ( !$this->options['
|
378 |
-
$excludes[] = $this->options['
|
379 |
-
|
380 |
return $excludes;
|
381 |
}
|
382 |
|
@@ -394,8 +394,8 @@ if (!class_exists('ThemeMyLogin')) {
|
|
394 |
}
|
395 |
|
396 |
if ( is_object($user) && !is_wp_error($user) ) {
|
397 |
-
$user_role =
|
398 |
-
$redirects = $this->
|
399 |
if ( '' != $redirects[$user_role]['login_url'] )
|
400 |
$redirect_to = $redirects[$user_role]['login_url'];
|
401 |
}
|
@@ -405,7 +405,7 @@ if (!class_exists('ThemeMyLogin')) {
|
|
405 |
function SiteURL($url, $path) {
|
406 |
global $wp_rewrite;
|
407 |
|
408 |
-
if ( !empty($this->options['
|
409 |
if ( preg_match('/wp-login.php/', $url) ) {
|
410 |
$parsed_url = parse_url($url);
|
411 |
if ( isset($parsed_url['query']) )
|
@@ -418,77 +418,58 @@ if (!class_exists('ThemeMyLogin')) {
|
|
418 |
}
|
419 |
|
420 |
function RetrievePasswordTitle($title, $user) {
|
421 |
-
if ( !empty($this->options['
|
422 |
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%reseturl%/', '/%user_login%/', '/%user_email%/', '/%user_ip%/');
|
423 |
$replace_with = array(get_option('blogname'), get_option('siteurl'), site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login'), $user->user_login, $user->user_email, $_SERVER['REMOTE_ADDR']);
|
424 |
-
$title = preg_replace($replace_this, $replace_with, $this->options['
|
425 |
}
|
426 |
return $title;
|
427 |
}
|
428 |
|
429 |
function RetrievePasswordMessage($message, $key, $user) {
|
430 |
-
if ( !empty($this->options['
|
431 |
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%reseturl%/', '/%user_login%/', '/%user_email%/', '/%key%/', '/%user_ip%/');
|
432 |
$replace_with = array(get_option('blogname'), get_option('siteurl'), site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login'), $user->user_login, $user->user_email, $key, $_SERVER['REMOTE_ADDR']);
|
433 |
-
$message = preg_replace($replace_this, $replace_with, $this->options['
|
434 |
}
|
435 |
return $message;
|
436 |
}
|
437 |
|
438 |
function PasswordResetTitle($title, $user) {
|
439 |
-
if ( !empty($this->options['
|
440 |
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_ip%/');
|
441 |
$replace_with = array(get_option('blogname'), get_option('siteurl'), $user->user_login, $user->user_email, $_SERVER['REMOTE_ADDR']);
|
442 |
-
$title = preg_replace($replace_this, $replace_with, $this->options['
|
443 |
}
|
444 |
return $title;
|
445 |
}
|
446 |
|
447 |
function PasswordResetMessage($message, $new_pass, $user) {
|
448 |
-
if ( !empty($this->options['
|
449 |
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_pass%/', '/%user_ip%/');
|
450 |
$replace_with = array(get_option('blogname'), get_option('siteurl'), $user->user_login, $user->user_email, $new_pass, $_SERVER['REMOTE_ADDR']);
|
451 |
-
$message = preg_replace($replace_this, $replace_with, $this->options['
|
452 |
}
|
453 |
return $message;
|
454 |
}
|
455 |
-
|
456 |
-
function WPMailContentType() {
|
457 |
-
return $this->options['general']['email_format'];
|
458 |
-
}
|
459 |
|
460 |
function ThemeMyLoginShortcode($args = array()) {
|
461 |
global $WPLogin;
|
462 |
|
463 |
-
$
|
464 |
-
|
465 |
-
$options = $this->options;
|
466 |
-
foreach ( $args as $key => $value ) {
|
467 |
-
if ( !is_array($value) ) {
|
468 |
-
if ( in_array($key, array('welcome', 'login', 'register', 'lostpassword', 'logout')) )
|
469 |
-
$options['titles'][$key] = $value;
|
470 |
-
elseif ( in_array($key, array('register', 'success', 'lostpassword')) )
|
471 |
-
$options['messages'][$key] = $value;
|
472 |
-
elseif ( in_array($key, array('instance', 'default_action', 'show_title', 'show_links', 'show_reg_link', 'show_pass_link', 'registration', 'lostpassword', 'show_logged', 'show_gravatar', 'gravatar_size', 'before_widget', 'after_widget', 'before_title', 'after_title')) )
|
473 |
-
$options['widget'][$key] = $value;
|
474 |
-
} else {
|
475 |
-
foreach ( $value as $k => $v )
|
476 |
-
$options[$key][$k] = $v;
|
477 |
-
}
|
478 |
-
}
|
479 |
|
480 |
-
$instance = ( isset($options['
|
481 |
|
482 |
return $WPLogin->Display($instance, $options);
|
483 |
}
|
484 |
|
485 |
|
486 |
function ThemeMyLoginPageShortcode($args = array()) {
|
487 |
-
$args['
|
488 |
-
$args['
|
489 |
-
$args['
|
490 |
-
$args['
|
491 |
-
$args['
|
492 |
return $this->ThemeMyLoginShortcode($args);
|
493 |
}
|
494 |
|
@@ -496,6 +477,137 @@ if (!class_exists('ThemeMyLogin')) {
|
|
496 |
$this->instances++;
|
497 |
return 'tml-' . $this->instances;
|
498 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
}
|
500 |
}
|
501 |
|
@@ -521,66 +633,95 @@ if (class_exists('ThemeMyLogin')) {
|
|
521 |
if ( !function_exists('wp_new_user_notification') ) :
|
522 |
function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
523 |
global $ThemeMyLogin, $wp_version;
|
524 |
-
|
525 |
$user = new WP_User($user_id);
|
526 |
-
|
527 |
$user_login = stripslashes($user->user_login);
|
528 |
$user_email = stripslashes($user->user_email);
|
529 |
-
|
530 |
-
if (
|
531 |
-
$message = sprintf(__('New user
|
532 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
533 |
-
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
|
|
|
|
|
534 |
|
535 |
-
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User
|
536 |
-
}
|
537 |
|
538 |
-
|
539 |
-
|
|
|
|
|
|
|
|
|
540 |
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
if (
|
548 |
-
$subject =
|
549 |
-
|
550 |
-
$
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
}
|
558 |
-
tml_apply_mail_filters();
|
559 |
-
wp_mail($user_email, $subject, $message);
|
560 |
-
tml_remove_mail_filters();
|
561 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
|
|
|
|
|
|
|
|
|
563 |
}
|
564 |
endif;
|
565 |
|
566 |
if ( !function_exists('tml_wp_mail_from') ) :
|
567 |
function tml_wp_mail_from($from) {
|
568 |
global $ThemeMyLogin;
|
569 |
-
return empty($ThemeMyLogin->options['
|
570 |
}
|
571 |
endif;
|
572 |
|
573 |
if ( !function_exists('tml_wp_mail_from_name') ) :
|
574 |
function tml_wp_mail_from_name($from_name) {
|
575 |
global $ThemeMyLogin;
|
576 |
-
return empty($ThemeMyLogin->options['
|
577 |
}
|
578 |
endif;
|
579 |
|
580 |
if ( !function_exists('tml_wp_mail_content_type') ) :
|
581 |
function tml_wp_mail_content_type() {
|
582 |
global $ThemeMyLogin;
|
583 |
-
return $ThemeMyLogin->options['
|
584 |
}
|
585 |
endif;
|
586 |
|
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.3
|
7 |
Author: Jeff Farthing
|
8 |
Author URI: http://www.jfarthing.com
|
9 |
Text Domain: theme-my-login
|
11 |
|
12 |
global $wp_version;
|
13 |
|
|
|
14 |
require_once ('classes/class.wp-login.php');
|
15 |
|
|
|
|
|
|
|
|
|
16 |
if (!class_exists('ThemeMyLogin')) {
|
17 |
+
class ThemeMyLogin {
|
18 |
|
19 |
+
var $version = '4.3';
|
20 |
var $options = array();
|
21 |
var $permalink = '';
|
22 |
var $instances = 0;
|
23 |
|
24 |
function ThemeMyLogin() {
|
25 |
|
26 |
+
load_plugin_textdomain('theme-my-login', '/wp-content/plugins/theme-my-login/language');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
register_activation_hook (__FILE__, array( &$this, 'Activate' ));
|
29 |
+
register_deactivation_hook (__FILE__, array( &$this, 'Deactivate' ));
|
|
|
|
|
30 |
|
31 |
+
add_action('init', array(&$this, 'Init'));
|
32 |
+
add_action('template_redirect', array(&$this, 'TemplateRedirect'));
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
add_action('register_form', array(&$this, 'RegisterForm'));
|
35 |
+
add_action('registration_errors', array(&$this, 'RegistrationErrors'));
|
36 |
|
37 |
+
add_action('authenticate', array(&$this, 'Authenticate'), 100, 3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
add_filter('allow_password_reset', array(&$this, 'AllowPasswordReset'), 10, 2);
|
40 |
+
|
41 |
+
add_filter('wp_head', array(&$this, 'WPHead'));
|
42 |
+
add_filter('wp_title', array(&$this, 'WPTitle'));
|
43 |
+
add_filter('the_title', array(&$this, 'TheTitle'));
|
44 |
+
add_filter('wp_list_pages', array(&$this, 'WPListPages'));
|
45 |
+
add_filter('wp_list_pages_excludes', array(&$this, 'WPListPagesExcludes'));
|
46 |
+
add_filter('login_redirect', array(&$this, 'LoginRedirect'), 10, 3);
|
47 |
+
add_filter('site_url', array(&$this, 'SiteURL'), 10, 2);
|
48 |
+
add_filter('retrieve_password_title', array(&$this, 'RetrievePasswordTitle'), 10, 2);
|
49 |
+
add_filter('retrieve_password_message', array(&$this, 'RetrievePasswordMessage'), 10, 3);
|
50 |
+
add_filter('password_reset_title', array(&$this, 'PasswordResetTitle'), 10, 2);
|
51 |
+
add_filter('password_reset_message', array(&$this, 'PasswordResetMessage'), 10, 3);
|
52 |
|
53 |
+
add_shortcode('theme-my-login-page', array(&$this, 'ThemeMyLoginPageShortcode'));
|
54 |
+
add_shortcode('theme-my-login', array(&$this, 'ThemeMyLoginShortcode'));
|
|
|
55 |
|
56 |
+
add_action('admin_init', array(&$this, 'AdminInit'));
|
57 |
+
add_action('admin_menu', array(&$this, 'AdminMenu'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
add_filter('user_row_actions', array(&$this, 'UserRowActions'), 10, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
+
$this->LoadOptions();
|
62 |
+
|
63 |
+
if ( empty($this->options['page_id']) ) {
|
64 |
+
$login_page = get_page_by_title('Login');
|
65 |
+
$this->options['page_id'] = ( $login_page ) ? $login_page->ID : 0;
|
66 |
$this->SaveOptions();
|
67 |
+
}
|
68 |
}
|
69 |
|
70 |
function Init() {
|
71 |
global $pagenow;
|
72 |
|
73 |
+
$this->permalink = get_permalink($this->options['page_id']);
|
74 |
|
75 |
switch ( $pagenow ) {
|
76 |
case 'wp-register.php':
|
77 |
case 'wp-login.php':
|
78 |
+
if ( !empty($this->options['page_id']) ) {
|
79 |
$redirect_to = add_query_arg($_GET, $this->permalink);
|
80 |
wp_redirect($redirect_to);
|
81 |
exit();
|
83 |
break;
|
84 |
}
|
85 |
|
86 |
+
if ( $this->options['use_css'] )
|
87 |
+
wp_enqueue_style('theme-my-login', plugins_url('/theme-my-login/css/theme-my-login.css'));
|
|
|
|
|
88 |
|
89 |
}
|
90 |
|
91 |
function AdminInit() {
|
92 |
global $user_ID, $wp_version, $pagenow;
|
93 |
|
94 |
+
if ( 'options-general.php' == $pagenow ) {
|
95 |
|
96 |
+
switch ( $_GET['page'] ) {
|
97 |
+
|
98 |
+
case 'theme-my-login/admin/admin.php' :
|
99 |
+
|
100 |
+
wp_enqueue_script('theme-my-login-admin', plugins_url('/theme-my-login/js/theme-my-login-admin.js'));
|
101 |
+
|
102 |
+
if ( version_compare($wp_version, '2.8', '>=') ) {
|
103 |
+
wp_enqueue_script('jquery-ui-tabs');
|
104 |
+
} else {
|
105 |
+
wp_deregister_script('jquery');
|
106 |
+
wp_deregister_script('jquery-ui-core');
|
107 |
+
wp_deregister_script('jquery-ui-tabs');
|
108 |
+
wp_enqueue_script('jquery', plugins_url('/theme-my-login/js/jquery/jquery.js'), false, '1.7.2');
|
109 |
+
wp_enquque_script('jquery-ui-core', plugins_url('/theme-my-login/js/jquery/ui.core.js'), array('jquery'), '1.7.2');
|
110 |
+
wp_enquque_script('jquery-ui-tabs', plugins_url('/theme-my-login/js/jquery/ui.tabs.js'), array('jquery', 'jquery-ui-core'), '1.7.2');
|
111 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
+
wp_enqueue_style('theme-my-login-admin', plugins_url('/theme-my-login/css/theme-my-login-admin.css'));
|
114 |
+
|
115 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
116 |
+
$admin_color = get_usermeta($user_ID, 'admin_color');
|
117 |
+
if ( 'classic' == $admin_color ) {
|
118 |
+
wp_enqueue_style('jquery-colors-classic', plugins_url('/theme-my-login/css/wp-colors-classic/wp-colors-classic.css'));
|
119 |
+
} else {
|
120 |
+
wp_enqueue_style('jquery-colors-fresh', plugins_url('/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css'));
|
121 |
+
}
|
122 |
+
} elseif ( version_compare($wp_version, '2.6', '>=') ) {
|
123 |
+
wp_enqueue_style('jquery-colors-classic', plugins_url('/theme-my-login/css/wp-colors-classic/wp-colors-classic.css'));
|
124 |
+
}
|
125 |
+
break;
|
126 |
+
|
127 |
}
|
128 |
|
129 |
+
} elseif ( 'page.php' == $pagenow && (isset($_REQUEST['post']) && $this->options['page_id'] == $_REQUEST['post']) ) {
|
130 |
add_action('admin_notices', array(&$this, 'PageEditNotice'));
|
131 |
+
} elseif ( 'users.php' == $pagenow && $this->options['moderate_users'] ) {
|
132 |
+
if ( isset($_GET['action']) && in_array($_GET['action'], array('approve', 'deny')) ) {
|
133 |
+
|
134 |
+
check_admin_referer('moderate-user');
|
135 |
+
|
136 |
+
$user = isset($_GET['user']) ? $_GET['user'] : '';
|
137 |
+
if ( !$user )
|
138 |
+
wp_die(__('You can’t edit that user.'));
|
139 |
+
|
140 |
+
if ( !current_user_can('edit_user', $user) )
|
141 |
+
wp_die(__('You can’t edit that user.'));
|
142 |
+
|
143 |
+
switch ( $_GET['action'] ) {
|
144 |
+
case 'approve' :
|
145 |
+
$user = new WP_User($user);
|
146 |
+
$user->set_role('subscriber');
|
147 |
+
|
148 |
+
$subject = $this->options['user_approval_email']['subject'];
|
149 |
+
$message = $this->options['user_approval_email']['message'];
|
150 |
+
|
151 |
+
$plaintext_pass = wp_generate_password();
|
152 |
+
wp_set_password($plaintext_pass, $user->ID);
|
153 |
+
|
154 |
+
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_pass%/');
|
155 |
+
$replace_with = array(get_option('blogname'), get_option('siteurl'), $user->user_login, $user->user_email, $plaintext_pass);
|
156 |
+
|
157 |
+
if ( !empty($subject) )
|
158 |
+
$subject = preg_replace($replace_this, $replace_with, $subject);
|
159 |
+
else
|
160 |
+
$subject = sprintf(__('[%s] Registration Approved'), get_option('blogname'));
|
161 |
+
if ( !empty($message) )
|
162 |
+
$message = preg_replace($replace_this, $replace_with, $message);
|
163 |
+
else {
|
164 |
+
$message = sprintf(__('You have been approved to access %s '."\r\n\r\n"), get_option('blogname'));
|
165 |
+
$message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n";
|
166 |
+
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n\r\n";
|
167 |
+
$message .= site_url('wp-login.php', 'login') . "\r\n";
|
168 |
+
}
|
169 |
+
tml_apply_mail_filters();
|
170 |
+
@wp_mail($user->user_email, $subject, $message);
|
171 |
+
tml_remove_mail_filters();
|
172 |
+
|
173 |
+
add_action('admin_notices', array(&$this, 'ApprovalNotice'));
|
174 |
+
break;
|
175 |
+
|
176 |
+
case 'deny' :
|
177 |
+
$user = new WP_User($user);
|
178 |
+
$user->set_role('denied');
|
179 |
+
|
180 |
+
$subject = $this->options['user_denial_email']['subject'];
|
181 |
+
$message = $this->options['user_denial_email']['message'];
|
182 |
+
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/');
|
183 |
+
$replace_with = array(get_option('blogname'), get_option('siteurl'), $user->user_login, $user->user_email);
|
184 |
+
|
185 |
+
if ( !empty($subject) )
|
186 |
+
$subject = preg_replace($replace_this, $replace_with, $subject);
|
187 |
+
else
|
188 |
+
$subject = sprintf(__('[%s] Registration Denied'), get_option('blogname'));
|
189 |
+
if ( !empty($message) )
|
190 |
+
$message = preg_replace($replace_this, $replace_with, $message);
|
191 |
+
else
|
192 |
+
$message = sprintf(__('You have been denied access to %s'), get_option('blogname'));
|
193 |
+
|
194 |
+
tml_apply_mail_filters();
|
195 |
+
@wp_mail($user->user_email, $subject, $message);
|
196 |
+
tml_remove_mail_filters();
|
197 |
+
|
198 |
+
add_action('admin_notices', array(&$this, 'DenialNotice'));
|
199 |
+
break;
|
200 |
+
|
201 |
+
}
|
202 |
+
}
|
203 |
}
|
204 |
}
|
205 |
|
206 |
function PageEditNotice() {
|
207 |
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>';
|
208 |
}
|
209 |
+
|
210 |
+
function ApprovalNotice() {
|
211 |
+
echo '<div id="message" class="updated fade"><p>' . __('User approved.') . '</p></div>';
|
212 |
+
}
|
213 |
+
|
214 |
+
function DenialNotice() {
|
215 |
+
echo '<div id="message" class="updated fade"><p>' . __('User denied.') . '</p></div>';
|
216 |
+
}
|
217 |
+
|
218 |
+
function AdminMenu() {
|
219 |
+
add_options_page(__('Theme My Login', 'theme-my-login'), __('Theme My Login', 'theme-my-login'), 8, 'theme-my-login/admin/admin.php');
|
220 |
+
}
|
221 |
+
|
222 |
+
function UserRowActions($actions, $user_object) {
|
223 |
+
global $current_user;
|
224 |
+
|
225 |
+
if ( $this->options['moderate_users'] ) {
|
226 |
+
$user_role = reset($user_object->roles);
|
227 |
+
if ( $current_user->ID != $user_object->ID ) {
|
228 |
+
if ( 'pending' == $user_role ) {
|
229 |
+
$approve['approve-user'] = '<a href="' . add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), wp_nonce_url("users.php?action=approve&user=$user_object->ID", 'moderate-user') ) . '">Approve</a>';
|
230 |
+
$approve['deny-user'] = '<a href="' . add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), wp_nonce_url("users.php?action=deny&user=$user_object->ID", 'moderate-user') ) . '">Deny</a>';
|
231 |
+
} elseif ( 'denied' == $user_role ) {
|
232 |
+
$approve['approve-user'] = '<a href="' . add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), wp_nonce_url("users.php?action=approve&user=$user_object->ID", 'moderate-user') ) . '">Approve</a>';
|
233 |
+
} else {
|
234 |
+
$approve['deny-user'] = '<a href="' . add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), wp_nonce_url("users.php?action=deny&user=$user_object->ID", 'moderate-user') ) . '">Deny</a>';
|
235 |
+
}
|
236 |
+
$actions = array_merge($approve, $actions);
|
237 |
+
}
|
238 |
+
}
|
239 |
+
return $actions;
|
240 |
+
}
|
241 |
|
242 |
function TemplateRedirect() {
|
243 |
global $WPLogin;
|
244 |
|
245 |
+
if ( is_page($this->options['page_id']) ) {
|
246 |
$action = ( isset($_GET['action']) ) ? $_GET['action'] : '';
|
247 |
if ( is_user_logged_in() && 'logout' != $action ) {
|
248 |
+
wp_redirect(get_option('siteurl'));
|
249 |
exit();
|
250 |
}
|
251 |
}
|
252 |
+
$WPLogin = new WPLogin('theme-my-login', $this->options);
|
|
|
|
|
253 |
}
|
254 |
|
255 |
function RegisterForm($instance) {
|
256 |
+
if ( $this->options['custom_pass'] ) {
|
257 |
?>
|
258 |
<p><label><?php _e('Password:');?> <br />
|
259 |
<input autocomplete="off" name="pass1" id="pass1-<?php echo $instance; ?>" class="input" size="20" value="" type="password" /></label><br />
|
264 |
}
|
265 |
|
266 |
function RegistrationErrors($errors){
|
267 |
+
if ( $this->options['custom_pass'] ) {
|
268 |
if (empty($_POST['pass1']) || $_POST['pass1'] == '' || empty($_POST['pass2']) || $_POST['pass2'] == ''){
|
269 |
$errors->add('empty_password', __('<strong>ERROR</strong>: Please enter a password.'));
|
270 |
} elseif ($_POST['pass1'] !== $_POST['pass2']){
|
278 |
|
279 |
return $errors;
|
280 |
}
|
281 |
+
|
282 |
+
function Authenticate($user, $username, $password) {
|
283 |
+
$user_data = get_userdatabylogin($username);
|
284 |
+
$user = new WP_User($user_data->ID);
|
285 |
+
$user_role = reset($user->roles);
|
286 |
+
if ( in_array($user_role, array('pending', 'denied')) ) {
|
287 |
+
return new WP_Error('pending', 'Your registration has not yet been approved.');
|
288 |
+
}
|
289 |
+
return $user;
|
290 |
+
}
|
291 |
+
|
292 |
+
function AllowPasswordReset($allow, $user_id) {
|
293 |
+
$user = new WP_User($user_id);
|
294 |
+
$user_role = reset($user->roles);
|
295 |
+
if ( in_array($user_role, array('pending', 'denied')) )
|
296 |
+
$allow = false;
|
297 |
+
|
298 |
+
return $allow;
|
299 |
+
}
|
300 |
|
301 |
function WPHead() {
|
302 |
+
do_action('login_head');
|
|
|
303 |
}
|
304 |
|
305 |
function WPTitle($title) {
|
306 |
global $WPLogin;
|
307 |
|
308 |
+
if ( is_page($this->options['page_id']) ) {
|
|
|
|
|
309 |
|
310 |
$action = ( isset($WPLogin->options['action']) ) ? $WPLogin->options['action'] : '';
|
311 |
if ( 'tml-main' == $WPLogin->instance || empty($WPLogin->instance) )
|
312 |
$action = $WPLogin->action;
|
313 |
|
314 |
if ( is_user_logged_in() )
|
315 |
+
return str_replace('Login', $this->options['logout_title'], $title);
|
316 |
|
317 |
switch ($action) {
|
318 |
case 'register':
|
319 |
+
return str_replace('Login', $this->options['register_title'], $title);
|
320 |
break;
|
321 |
case 'lostpassword':
|
322 |
case 'retrievepassword':
|
323 |
case 'resetpass':
|
324 |
case 'rp':
|
325 |
+
return str_replace('Login', $this->options['lost_pass_title'], $title);
|
326 |
break;
|
327 |
case 'login':
|
328 |
default:
|
329 |
+
return str_replace('Login', $this->options['login_title'], $title);
|
330 |
}
|
331 |
} return $title;
|
332 |
}
|
338 |
return $title;
|
339 |
|
340 |
if ( $title == 'Login' ) {
|
|
|
|
|
341 |
|
342 |
if ( is_user_logged_in() )
|
343 |
+
return $this->options['logout_title'];
|
344 |
|
345 |
$action = ( isset($WPLogin->options['action']) ) ? $WPLogin->options['action'] : '';
|
346 |
if ( 'tml-main' == $WPLogin->instance || empty($WPLogin->instance) )
|
348 |
|
349 |
switch ($action) {
|
350 |
case 'register':
|
351 |
+
return $this->options['register_title'];
|
352 |
break;
|
353 |
case 'lostpassword':
|
354 |
case 'retrievepassword':
|
355 |
case 'resetpass':
|
356 |
case 'rp':
|
357 |
+
return $this->options['lost_pass_title'];
|
358 |
break;
|
359 |
case 'login':
|
360 |
default:
|
361 |
+
return $this->options['login_title'];
|
362 |
}
|
363 |
} return $title;
|
364 |
}
|
366 |
function WPListPages($pages) {
|
367 |
global $wp_version, $WPLogin;
|
368 |
|
369 |
+
if ( $this->options['show_page'] && is_user_logged_in() ) {
|
370 |
$redirect = $WPLogin->GuessURL();
|
371 |
$logout_url = ( version_compare($wp_version, '2.7', '>=') ) ? wp_logout_url($redirect) : site_url('wp-login.php?action=logout&redirect_to='.$redirect, 'login');
|
372 |
$pages = str_replace($this->permalink, $logout_url, $pages);
|
373 |
}
|
|
|
374 |
return $pages;
|
375 |
}
|
376 |
|
377 |
function WPListPagesExcludes($excludes) {
|
378 |
+
if ( !$this->options['show_page'] )
|
379 |
+
$excludes[] = $this->options['page_id'];
|
|
|
380 |
return $excludes;
|
381 |
}
|
382 |
|
394 |
}
|
395 |
|
396 |
if ( is_object($user) && !is_wp_error($user) ) {
|
397 |
+
$user_role = reset($user->roles);
|
398 |
+
$redirects = $this->options['redirects'];
|
399 |
if ( '' != $redirects[$user_role]['login_url'] )
|
400 |
$redirect_to = $redirects[$user_role]['login_url'];
|
401 |
}
|
405 |
function SiteURL($url, $path) {
|
406 |
global $wp_rewrite;
|
407 |
|
408 |
+
if ( !empty($this->options['page_id']) ) {
|
409 |
if ( preg_match('/wp-login.php/', $url) ) {
|
410 |
$parsed_url = parse_url($url);
|
411 |
if ( isset($parsed_url['query']) )
|
418 |
}
|
419 |
|
420 |
function RetrievePasswordTitle($title, $user) {
|
421 |
+
if ( !empty($this->options['retrieve_pass_email']['subject']) ) {
|
422 |
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%reseturl%/', '/%user_login%/', '/%user_email%/', '/%user_ip%/');
|
423 |
$replace_with = array(get_option('blogname'), get_option('siteurl'), site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login'), $user->user_login, $user->user_email, $_SERVER['REMOTE_ADDR']);
|
424 |
+
$title = preg_replace($replace_this, $replace_with, $this->options['retrieve_pass_email']['subject']);
|
425 |
}
|
426 |
return $title;
|
427 |
}
|
428 |
|
429 |
function RetrievePasswordMessage($message, $key, $user) {
|
430 |
+
if ( !empty($this->options['retrieve_pass_email']['message']) ) {
|
431 |
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%reseturl%/', '/%user_login%/', '/%user_email%/', '/%key%/', '/%user_ip%/');
|
432 |
$replace_with = array(get_option('blogname'), get_option('siteurl'), site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login'), $user->user_login, $user->user_email, $key, $_SERVER['REMOTE_ADDR']);
|
433 |
+
$message = preg_replace($replace_this, $replace_with, $this->options['retrieve_pass_email']['message']);
|
434 |
}
|
435 |
return $message;
|
436 |
}
|
437 |
|
438 |
function PasswordResetTitle($title, $user) {
|
439 |
+
if ( !empty($this->options['reset_pass_email']['subject']) ) {
|
440 |
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_ip%/');
|
441 |
$replace_with = array(get_option('blogname'), get_option('siteurl'), $user->user_login, $user->user_email, $_SERVER['REMOTE_ADDR']);
|
442 |
+
$title = preg_replace($replace_this, $replace_with, $this->options['reset_pass_email']['subject']);
|
443 |
}
|
444 |
return $title;
|
445 |
}
|
446 |
|
447 |
function PasswordResetMessage($message, $new_pass, $user) {
|
448 |
+
if ( !empty($this->options['reset_pass_email']['message']) ) {
|
449 |
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_pass%/', '/%user_ip%/');
|
450 |
$replace_with = array(get_option('blogname'), get_option('siteurl'), $user->user_login, $user->user_email, $new_pass, $_SERVER['REMOTE_ADDR']);
|
451 |
+
$message = preg_replace($replace_this, $replace_with, $this->options['reset_pass_email']['message']);
|
452 |
}
|
453 |
return $message;
|
454 |
}
|
|
|
|
|
|
|
|
|
455 |
|
456 |
function ThemeMyLoginShortcode($args = array()) {
|
457 |
global $WPLogin;
|
458 |
|
459 |
+
$options = wp_parse_args($args, $this->options);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
|
461 |
+
$instance = ( isset($options['instance']) ) ? $options['instance'] : $this->NewInstance();
|
462 |
|
463 |
return $WPLogin->Display($instance, $options);
|
464 |
}
|
465 |
|
466 |
|
467 |
function ThemeMyLoginPageShortcode($args = array()) {
|
468 |
+
$args['instance'] = 'tml-main';
|
469 |
+
$args['default_action'] = 'login';
|
470 |
+
$args['show_title'] = '0';
|
471 |
+
$args['before_widget'] = '';
|
472 |
+
$args['after_widget'] = '';
|
473 |
return $this->ThemeMyLoginShortcode($args);
|
474 |
}
|
475 |
|
477 |
$this->instances++;
|
478 |
return 'tml-' . $this->instances;
|
479 |
}
|
480 |
+
|
481 |
+
function Activate() {
|
482 |
+
$insert = array(
|
483 |
+
'post_title' => 'Login',
|
484 |
+
'post_status' => 'publish',
|
485 |
+
'post_type' => 'page',
|
486 |
+
'post_author' => 1,
|
487 |
+
'post_content' => '[theme-my-login-page]',
|
488 |
+
'comment_status' => 'closed',
|
489 |
+
'ping_status' => 'closed'
|
490 |
+
);
|
491 |
+
|
492 |
+
$theme_my_login = get_page_by_title('Login');
|
493 |
+
if ( !$theme_my_login ) {
|
494 |
+
$page_id = wp_insert_post($insert);
|
495 |
+
} else {
|
496 |
+
$page_id = $theme_my_login->ID;
|
497 |
+
$insert['ID'] = $page_id;
|
498 |
+
$insert['post_content'] = str_replace('[theme-my-login]', '[theme-my-login-page]', $theme_my_login->post_content);
|
499 |
+
wp_update_post($insert);
|
500 |
+
}
|
501 |
+
|
502 |
+
$this->options['page_id'] = $page_id;
|
503 |
+
$this->options['version'] = $this->version;
|
504 |
+
update_option('theme_my_login', $this->options);
|
505 |
+
|
506 |
+
add_role('pending', 'Pending', array());
|
507 |
+
add_role('denied', 'Denied', array());
|
508 |
+
}
|
509 |
+
|
510 |
+
function Deactivate() {
|
511 |
+
if ( $this->options['uninstall'] ) {
|
512 |
+
delete_option('theme_my_login');
|
513 |
+
delete_option('widget_theme-my-login');
|
514 |
+
wp_delete_post($this->options['page_id']);
|
515 |
+
remove_role('pending');
|
516 |
+
remove_role('denied');
|
517 |
+
}
|
518 |
+
}
|
519 |
+
|
520 |
+
function InitOptions($save = false) {
|
521 |
+
|
522 |
+
// General
|
523 |
+
$this->options['page_id'] = 0;
|
524 |
+
$this->options['uninstall'] = 0;
|
525 |
+
$this->options['show_page'] = 0;
|
526 |
+
$this->options['custom_pass'] = 0;
|
527 |
+
$this->options['email_from'] = '';
|
528 |
+
$this->options['email_from_name'] = '';
|
529 |
+
$this->options['email_content_type'] = 'text/plain';
|
530 |
+
$this->options['use_css'] = 1;
|
531 |
+
|
532 |
+
// Titles
|
533 |
+
$this->options['welcome_title'] = __('Welcome') . ', %display_name%';
|
534 |
+
$this->options['login_title'] = __('Log In');
|
535 |
+
$this->options['register_title'] = __('Register');
|
536 |
+
$this->options['lost_pass_title'] = __('Lost Password');
|
537 |
+
$this->options['logout_title'] = __('Log Out');
|
538 |
+
|
539 |
+
// Messages
|
540 |
+
$this->options['register_message'] = __('A password will be e-mailed to you.');
|
541 |
+
$this->options['success_message'] = __('Registration complete. Please check your e-mail.');
|
542 |
+
$this->options['lost_pass_message'] = __('Please enter your username or e-mail address. You will receive a new password via e-mail.');
|
543 |
+
|
544 |
+
// Widget
|
545 |
+
$this->options['default_action'] = 'login';
|
546 |
+
$this->options['show_title'] = 1;
|
547 |
+
$this->options['show_log_link'] = 1;
|
548 |
+
$this->options['show_reg_link'] = 1;
|
549 |
+
$this->options['show_pass_link'] = 1;
|
550 |
+
$this->options['register_widget'] = 1;
|
551 |
+
$this->options['lost_pass_widget'] = 1;
|
552 |
+
$this->options['logged_in_widget'] = 1;
|
553 |
+
$this->options['show_gravatar'] = 1;
|
554 |
+
$this->options['gravatar_size'] = 50;
|
555 |
+
$this->options['before_widget'] = '<li>';
|
556 |
+
$this->options['after_widget'] = '</li>';
|
557 |
+
$this->options['before_title'] = '<h2>';
|
558 |
+
$this->options['after_title'] = '</h2>';
|
559 |
+
|
560 |
+
// E-mails
|
561 |
+
$this->options['retrieve_pass_email'] = array('subject' => '', 'message' => '');
|
562 |
+
$this->options['reset_pass_email'] = array('subject' => '', 'message' => '', 'admin_disable' => 0);
|
563 |
+
$this->options['registration_email'] = array('subject' => '', 'message' => '', 'admin_disable' => 0, 'user_disable' => 0);
|
564 |
+
$this->options['user_approval_email'] = array('subject' => '', 'message' => '');
|
565 |
+
$this->options['user_denial_email'] = array('subject' => '', 'message' => '');
|
566 |
+
|
567 |
+
// Links & Redirects
|
568 |
+
global $wp_roles;
|
569 |
+
if ( empty($wp_roles) )
|
570 |
+
$wp_roles = new WP_Roles();
|
571 |
+
$user_roles = $wp_roles->get_names();
|
572 |
+
foreach ( $user_roles as $role => $title ) {
|
573 |
+
$this->options['links'][$role][] = array('title' => 'Dashboard', 'url' => admin_url());
|
574 |
+
$this->options['links'][$role][] = array('title' => 'Profile', 'url' => admin_url('profile.php'));
|
575 |
+
$this->options['redirects'][$role] = array('login_url' => '', 'logout_url' => '');
|
576 |
+
}
|
577 |
+
|
578 |
+
if ( $save )
|
579 |
+
update_option('theme_my_login', $this->options);
|
580 |
+
|
581 |
+
}
|
582 |
+
|
583 |
+
function LoadOptions($options = '') {
|
584 |
+
|
585 |
+
$this->InitOptions();
|
586 |
+
|
587 |
+
$storedoptions = get_option('theme_my_login');
|
588 |
+
if ( $storedoptions && is_array( $storedoptions ) ) {
|
589 |
+
foreach ( $storedoptions as $key => $value ) {
|
590 |
+
$this->options[$key] = $value;
|
591 |
+
}
|
592 |
+
} else update_option('theme_my_login', $this->options);
|
593 |
+
}
|
594 |
+
|
595 |
+
function GetOption($key) {
|
596 |
+
if ( array_key_exists($key, $this->options) ) {
|
597 |
+
return $this->options[$key];
|
598 |
+
} else return null;
|
599 |
+
}
|
600 |
+
|
601 |
+
function SetOption($key, $value) {
|
602 |
+
$this->options[$key] = $value;
|
603 |
+
}
|
604 |
+
|
605 |
+
function SaveOptions() {
|
606 |
+
$oldvalue = get_option('theme_my_login');
|
607 |
+
if( $oldvalue == $this->options ) {
|
608 |
+
return true;
|
609 |
+
} else return update_option('theme_my_login', $this->options);
|
610 |
+
}
|
611 |
}
|
612 |
}
|
613 |
|
633 |
if ( !function_exists('wp_new_user_notification') ) :
|
634 |
function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
635 |
global $ThemeMyLogin, $wp_version;
|
636 |
+
|
637 |
$user = new WP_User($user_id);
|
638 |
+
|
639 |
$user_login = stripslashes($user->user_login);
|
640 |
$user_email = stripslashes($user->user_email);
|
641 |
+
|
642 |
+
if ( $ThemeMyLogin->options['moderate_users'] ) {
|
643 |
+
$message = sprintf(__('New user requires approval on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
|
644 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
645 |
+
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n\r\n";
|
646 |
+
$message .= __('To approve or deny this user:', 'theme-my-login') . "\r\n";
|
647 |
+
$message .= admin_url('users.php');
|
648 |
|
649 |
+
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Awaiting Approval'), get_option('blogname')), $message);
|
|
|
650 |
|
651 |
+
$user->set_role('pending');
|
652 |
+
} else {
|
653 |
+
if ( !$ThemeMyLogin->options['registration_email']['admin_disable'] ) {
|
654 |
+
$message = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
|
655 |
+
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
656 |
+
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
|
657 |
|
658 |
+
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
|
659 |
+
}
|
660 |
+
|
661 |
+
if ( empty($plaintext_pass) )
|
662 |
+
return;
|
663 |
+
|
664 |
+
if ( !$ThemeMyLogin->options['registration_email']['user_disable'] ) {
|
665 |
+
$subject = $ThemeMyLogin->options['registration_email']['subject'];
|
666 |
+
$message = $ThemeMyLogin->options['registration_email']['message'];
|
667 |
+
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_pass%/', '/%user_ip%/');
|
668 |
+
$replace_with = array(get_option('blogname'), get_option('siteurl'), $user->user_login, $user->user_email, $plaintext_pass, $_SERVER['REMOTE_ADDR']);
|
669 |
+
|
670 |
+
if ( !empty($subject) )
|
671 |
+
$subject = preg_replace($replace_this, $replace_with, $subject);
|
672 |
+
else
|
673 |
+
$subject = sprintf(__('[%s] Your username and password'), get_option('blogname'));
|
674 |
+
if ( !empty($message) )
|
675 |
+
$message = preg_replace($replace_this, $replace_with, $message);
|
676 |
+
else {
|
677 |
+
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
|
678 |
+
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
|
679 |
+
$message .= ( version_compare($wp_version, '2.7', '>=') ) ? wp_login_url() . "\r\n" : site_url('wp-login.php', 'login') . "\r\n";
|
680 |
+
}
|
681 |
+
tml_apply_mail_filters();
|
682 |
+
wp_mail($user_email, $subject, $message);
|
683 |
+
tml_remove_mail_filters();
|
684 |
}
|
|
|
|
|
|
|
685 |
}
|
686 |
+
}
|
687 |
+
endif;
|
688 |
+
|
689 |
+
if ( !function_exists('wp_generate_password') ) :
|
690 |
+
function wp_generate_password($length = 12, $special_chars = true) {
|
691 |
+
global $ThemeMyLogin;
|
692 |
+
|
693 |
+
if ( $ThemeMyLogin->options['custom_pass'] && isset($_POST['user_pw']) && '' != $_POST['user_pw'] )
|
694 |
+
return stripslashes($_POST['user_pw']);
|
695 |
+
|
696 |
+
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
697 |
+
if ( $special_chars )
|
698 |
+
$chars .= '!@#$%^&*()';
|
699 |
|
700 |
+
$password = '';
|
701 |
+
for ( $i = 0; $i < $length; $i++ )
|
702 |
+
$password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
|
703 |
+
return $password;
|
704 |
}
|
705 |
endif;
|
706 |
|
707 |
if ( !function_exists('tml_wp_mail_from') ) :
|
708 |
function tml_wp_mail_from($from) {
|
709 |
global $ThemeMyLogin;
|
710 |
+
return empty($ThemeMyLogin->options['email_from']) ? $from : $ThemeMyLogin->options['email_from'];
|
711 |
}
|
712 |
endif;
|
713 |
|
714 |
if ( !function_exists('tml_wp_mail_from_name') ) :
|
715 |
function tml_wp_mail_from_name($from_name) {
|
716 |
global $ThemeMyLogin;
|
717 |
+
return empty($ThemeMyLogin->options['email_from_name']) ? $from_name : $ThemeMyLogin->options['email_from_name'];
|
718 |
}
|
719 |
endif;
|
720 |
|
721 |
if ( !function_exists('tml_wp_mail_content_type') ) :
|
722 |
function tml_wp_mail_content_type() {
|
723 |
global $ThemeMyLogin;
|
724 |
+
return $ThemeMyLogin->options['email_content_type'];
|
725 |
}
|
726 |
endif;
|
727 |
|