Version Description
- Rewrite code in a modular fashion in order to speed up plugin
- Convert custom e-mails, passwords, redirection, user links and user moderation to "modules"
- Add the option to enable/disable link rewriting, widget and template tag
- Simplify/optimize admin tabs style
- Remember current admin tab after save
- When using custom passwords, allow users to set their own password upon reset
- When using custom redirection, specify redirection type per user role/per link type
- New ajax interface for user links admin
- Theme My Profile now merged into module
Download this release
Release Info
Developer | jfarthing84 |
Plugin | Theme My Login |
Version | 5.0 |
Comparing to | |
See all releases |
Code changes from version 4.4 to 5.0
- admin/admin-email.php +0 -125
- admin/admin-general.php +0 -30
- admin/admin-links.php +0 -66
- admin/admin-redirection.php +0 -52
- admin/admin.php +0 -128
- admin/css/colors-classic.css +71 -0
- admin/css/colors-fresh.css +71 -0
- admin/css/theme-my-login-admin.css +10 -0
- admin/images/menu-bits-vs.gif +0 -0
- admin/images/menu-bits.gif +0 -0
- admin/includes/admin.php +205 -0
- admin/includes/module.php +123 -0
- admin/js/theme-my-login-admin.js +16 -0
- admin/options-basic.php +34 -0
- admin/options-modules.php +14 -0
- admin/options-optimization.php +15 -0
- admin/options.php +87 -0
- css/theme-my-login-admin.css +0 -16
- css/wp-colors-classic/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- css/wp-colors-classic/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- css/wp-colors-classic/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- css/wp-colors-classic/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- css/wp-colors-classic/images/ui-bg_glass_75_eaf3fa_1x400.png +0 -0
- css/wp-colors-classic/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- css/wp-colors-classic/images/ui-bg_highlight-soft_75_bbd8e7_1x100.png +0 -0
- css/wp-colors-classic/images/ui-icons_222222_256x240.png +0 -0
- css/wp-colors-classic/images/ui-icons_2e83ff_256x240.png +0 -0
- css/wp-colors-classic/images/ui-icons_454545_256x240.png +0 -0
- css/wp-colors-classic/images/ui-icons_888888_256x240.png +0 -0
- css/wp-colors-classic/images/ui-icons_cd0a0a_256x240.png +0 -0
- css/wp-colors-classic/wp-colors-classic.css +0 -428
- css/wp-colors-fresh/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- css/wp-colors-fresh/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- css/wp-colors-fresh/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- css/wp-colors-fresh/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- css/wp-colors-fresh/images/ui-bg_glass_75_f1f1f1_1x400.png +0 -0
- css/wp-colors-fresh/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- css/wp-colors-fresh/images/ui-bg_highlight-soft_75_dfdfdf_1x100.png +0 -0
- css/wp-colors-fresh/images/ui-icons_222222_256x240.png +0 -0
- css/wp-colors-fresh/images/ui-icons_2e83ff_256x240.png +0 -0
- css/wp-colors-fresh/images/ui-icons_454545_256x240.png +0 -0
- css/wp-colors-fresh/images/ui-icons_888888_256x240.png +0 -0
- css/wp-colors-fresh/images/ui-icons_cd0a0a_256x240.png +0 -0
- css/wp-colors-fresh/wp-colors-fresh.css +0 -428
- images/add.gif +0 -0
- images/remove.gif +0 -0
- includes/class.php +140 -0
- includes/functions.php +79 -281
- includes/hook-functions.php +86 -0
- includes/login-actions.php +144 -0
- includes/login-functions.php +185 -0
- includes/pluggable-functions.php +86 -0
- includes/template-functions.php +284 -0
- includes/widget.php +28 -40
- js/theme-my-login-admin.js +0 -40
- modules/custom-email/admin/admin.php +38 -0
- modules/custom-email/admin/options-general.php +23 -0
- modules/custom-email/admin/options-new-user.php +14 -0
- modules/custom-email/admin/options-reset-pass.php +14 -0
- modules/custom-email/admin/options-retrieve-pass.php +11 -0
- modules/custom-email/custom-email.php +58 -0
- modules/custom-email/includes/hook-functions.php +115 -0
- modules/custom-passwords/custom-passwords.php +29 -0
- modules/custom-passwords/functions.php +58 -0
- modules/custom-passwords/hook-functions.php +113 -0
- modules/custom-redirection/admin.php +41 -0
- modules/custom-redirection/custom-redirection.php +42 -0
- modules/custom-redirection/hook-functions.php +75 -0
- modules/custom-user-links/admin/admin.css +85 -0
- modules/custom-user-links/admin/admin.php +277 -0
- modules/custom-user-links/custom-user-links.php +64 -0
- modules/themed-profiles/includes/hook-functions.php +26 -0
- modules/themed-profiles/includes/template-functions.php +167 -0
- modules/themed-profiles/themed-profiles.css +39 -0
- modules/themed-profiles/themed-profiles.php +66 -0
- modules/user-moderation/admin/admin.php +93 -0
- modules/user-moderation/admin/options-user-activation-email.php +11 -0
- modules/user-moderation/admin/options-user-approval-email.php +11 -0
- modules/user-moderation/admin/options-user-denial-email.php +11 -0
- modules/user-moderation/includes/email-functions.php +65 -0
- modules/user-moderation/includes/functions.php +159 -0
- modules/user-moderation/includes/hook-functions.php +79 -0
- modules/user-moderation/user-moderation.php +87 -0
- readme.txt +21 -6
- css/theme-my-login.css → theme-my-login.css +0 -0
- theme-my-login.php +91 -971
admin/admin-email.php
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
<ul class="tabs-nav">
|
2 |
-
<li><a href="#fragment-4-1">General</a></li>
|
3 |
-
<li><a href="#fragment-4-2">New Registration</a></li>
|
4 |
-
<li><a href="#fragment-4-3">Password Retrieval</a></li>
|
5 |
-
<li><a href="#fragment-4-4">Password Reset</a></li>
|
6 |
-
<li><a href="#fragment-4-5">E-mail Confirmation</a></li>
|
7 |
-
<li><a href="#fragment-4-6">User Approval</a></li>
|
8 |
-
<li><a href="#fragment-4-7">User Denial</a></li>
|
9 |
-
</ul>
|
10 |
-
|
11 |
-
<div id="fragment-4-1" class="tabs-div">
|
12 |
-
<table class="form-table">
|
13 |
-
<tr valign="top">
|
14 |
-
<td>
|
15 |
-
<label for="email_from_name"><?php _e('From Name', 'theme-my-login'); ?></label><br />
|
16 |
-
<input name="email_from_name" type="text" id="email_from_name" value="<?php echo htmlspecialchars($ThemeMyLogin->options['email_from_name']); ?>" class="regular-text" />
|
17 |
-
</td>
|
18 |
-
</tr>
|
19 |
-
<tr valign="top">
|
20 |
-
<td>
|
21 |
-
<label for="email_from"><?php _e('From E-mail', 'theme-my-login'); ?></label><br />
|
22 |
-
<input name="email_from" type="text" id="email_from" value="<?php echo htmlspecialchars($ThemeMyLogin->options['email_from']); ?>" class="regular-text" />
|
23 |
-
</td>
|
24 |
-
</tr>
|
25 |
-
<tr valign="top">
|
26 |
-
<td>
|
27 |
-
<label for"email_content_type"><?php _e('E-mail Format', 'theme-my-login'); ?></label><br />
|
28 |
-
<select name="email_content_type" id="email_content_type">
|
29 |
-
<option value="text/plain"<?php if ('text/plain' == $ThemeMyLogin->options['email_content_type']) echo ' selected="selected"'; ?>>Plain Text</option>
|
30 |
-
<option value="text/html"<?php if ('text/html' == $ThemeMyLogin->options['email_content_type']) echo ' selected="selected"'; ?>>HTML</option>
|
31 |
-
</select>
|
32 |
-
</td>
|
33 |
-
</tr>
|
34 |
-
</table>
|
35 |
-
</div>
|
36 |
-
|
37 |
-
<div id="fragment-4-2" class="tabs-div">
|
38 |
-
<table class="form-table">
|
39 |
-
<tr>
|
40 |
-
<td>
|
41 |
-
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%, %user_ip%</em></p>
|
42 |
-
Subject<br />
|
43 |
-
<input name="registration_subject" type="text" id="registration_subject" value="<?php echo htmlspecialchars($ThemeMyLogin->options['registration_email']['subject']); ?>" class="full-text" /><br />
|
44 |
-
Message<br />
|
45 |
-
<textarea name="registration_message" id="registration_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['registration_email']['message']); ?></textarea><br />
|
46 |
-
<p>
|
47 |
-
<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>
|
48 |
-
</p>
|
49 |
-
</td>
|
50 |
-
</tr>
|
51 |
-
</table>
|
52 |
-
</div>
|
53 |
-
|
54 |
-
<div id="fragment-4-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-4-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-4-5" class="tabs-div">
|
86 |
-
<table class="form-table">
|
87 |
-
<tr>
|
88 |
-
<td>
|
89 |
-
<p><em>Avilable Variables: %blogname%, %siteurl%, %confirmurl%, %user_login%, %user_email%, %user_pass%, %user_ip%</em></p>
|
90 |
-
Subject<br />
|
91 |
-
<input name="confirmation_subject" type="text" id="confirmation_subject" value="<?php echo htmlspecialchars($ThemeMyLogin->options['confirmation_email']['subject']); ?>" class="full-text" /><br />
|
92 |
-
Message<br />
|
93 |
-
<textarea name="confirmation_message" id="confirmation_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['confirmation_email']['message']); ?></textarea><br />
|
94 |
-
</td>
|
95 |
-
</tr>
|
96 |
-
</table>
|
97 |
-
</div>
|
98 |
-
|
99 |
-
<div id="fragment-4-6" class="tabs-div">
|
100 |
-
<table class="form-table">
|
101 |
-
<tr>
|
102 |
-
<td>
|
103 |
-
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%</em></p>
|
104 |
-
Subject<br />
|
105 |
-
<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 />
|
106 |
-
Message<br />
|
107 |
-
<textarea name="user_approval_message" id="user_approval_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['user_approval_email']['message']); ?></textarea><br />
|
108 |
-
</td>
|
109 |
-
</tr>
|
110 |
-
</table>
|
111 |
-
</div>
|
112 |
-
|
113 |
-
<div id="fragment-4-7" class="tabs-div">
|
114 |
-
<table class="form-table">
|
115 |
-
<tr>
|
116 |
-
<td>
|
117 |
-
<p><em>Avilable Variables: %blogname%, %siteurl%, %user_login%, %user_email%</em></p>
|
118 |
-
Subject<br />
|
119 |
-
<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 />
|
120 |
-
Message<br />
|
121 |
-
<textarea name="user_denial_message" id="user_denial_message" class="large-text"><?php echo htmlspecialchars($ThemeMyLogin->options['user_denial_email']['message']); ?></textarea><br />
|
122 |
-
</td>
|
123 |
-
</tr>
|
124 |
-
</table>
|
125 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/admin-general.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<table class="form-table">
|
2 |
-
<tr valign="top">
|
3 |
-
<th scope="row"><?php _e('Passwords', 'theme-my-login'); ?></th>
|
4 |
-
<td>
|
5 |
-
<input name="custom_pass" type="radio" id="custom_pass_off" value="0" <?php if ( 0 == $ThemeMyLogin->options['custom_pass'] ) { echo 'checked="checked"'; } ?> />
|
6 |
-
<label for="custom_pass_off"><?php _e('Auto-Generated', 'theme-my-login'); ?></label><br />
|
7 |
-
<input name="custom_pass" type="radio" id="custom_pass_on" value="1" <?php if ( 1 == $ThemeMyLogin->options['custom_pass'] ) { echo 'checked="checked"'; } ?> />
|
8 |
-
<label for="custom_pass_on"><?php _e('Custom', 'theme-my-login'); ?></label><br />
|
9 |
-
</td>
|
10 |
-
</tr>
|
11 |
-
<tr valign="top">
|
12 |
-
<th scope="row"><?php _e('User Moderation', 'theme-my-login'); ?></th>
|
13 |
-
<td>
|
14 |
-
<input name="moderation" type="radio" id="moderation_none" value="none" <?php if ( 'none' == $ThemeMyLogin->options['moderation'] ) { echo 'checked="checked"'; } ?> />
|
15 |
-
<label for="moderation_none"><?php _e('None', 'theme-my-login'); ?></label><br />
|
16 |
-
<input name="moderation" type="radio" id="moderation_email" value="email" <?php if ( 'email' == $ThemeMyLogin->options['moderation'] ) { echo 'checked="checked"'; } ?> />
|
17 |
-
<label for="moderation_email"><?php _e('E-mail Confirmation', 'theme-my-login'); ?></label><br />
|
18 |
-
<input name="moderation" type="radio" id="moderation_admin" value="admin" <?php if ( 'admin' == $ThemeMyLogin->options['moderation'] ) { echo 'checked="checked"'; } ?> />
|
19 |
-
<label for="moderation_admin"><?php _e('Admin Approval', 'theme-my-login'); ?></label>
|
20 |
-
</td>
|
21 |
-
</tr>
|
22 |
-
<tr valign="top">
|
23 |
-
<th scope="row"><?php _e('Stylesheet', 'theme-my-login'); ?></th>
|
24 |
-
<td>
|
25 |
-
<input name="use_css" type="checkbox" id="use_css" value="1" <?php if ( $ThemeMyLogin->options['use_css'] ) { echo 'checked="checked"'; } ?> />
|
26 |
-
<label for="use_css"><?php _e('Use theme-my-login.css', 'theme-my-login'); ?></label>
|
27 |
-
<p class="description"><?php _e('In order to keep changes between upgrades, you can store your customized "theme-my-login.css" in your current theme directory.', 'theme-my-login'); ?></p>
|
28 |
-
</td>
|
29 |
-
</tr>
|
30 |
-
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/admin-links.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<ul class="tabs-nav">
|
2 |
-
<?php
|
3 |
-
$i = 1;
|
4 |
-
foreach ($user_roles as $role => $value) {
|
5 |
-
if ( 'pending' == $role )
|
6 |
-
continue;
|
7 |
-
echo '<li><a href="#fragment-2-' . $i . '">' . ucwords($role) . '</a></li>' . "\n";
|
8 |
-
$i++;
|
9 |
-
}
|
10 |
-
?>
|
11 |
-
</ul>
|
12 |
-
|
13 |
-
<?php
|
14 |
-
$i1 = 1;
|
15 |
-
foreach ($user_roles as $role => $value) {
|
16 |
-
if ( 'pending' == $role )
|
17 |
-
continue;
|
18 |
-
?>
|
19 |
-
<div id="fragment-2-<?php echo $i1; ?>" class="tabs-div">
|
20 |
-
|
21 |
-
<p class="description"><?php _e('These links will show up in the widget when a user is logged in, according to their role.', 'theme-my-login'); ?></p>
|
22 |
-
|
23 |
-
<table id="links-<?php echo $role; ?>" class="form-table link-table">
|
24 |
-
<?php $i2 = 0; ?>
|
25 |
-
<?php $alt = 'alternate'; ?>
|
26 |
-
<?php if ( is_array($links[$role]) ) { ?>
|
27 |
-
<?php foreach ( $links[$role] as $key => $data ) {
|
28 |
-
$alt = ('alternate' == $alt) ? '' : 'alternate';
|
29 |
-
?>
|
30 |
-
<tr id="link-row-<?php echo $i2; ?>" class="<?php echo $alt; ?>">
|
31 |
-
<td>
|
32 |
-
Title<br />
|
33 |
-
<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 />
|
34 |
-
URL<br />
|
35 |
-
<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 />
|
36 |
-
<p>
|
37 |
-
<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>
|
38 |
-
<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>
|
39 |
-
</p>
|
40 |
-
</td>
|
41 |
-
</tr>
|
42 |
-
<?php
|
43 |
-
$i2++;
|
44 |
-
}
|
45 |
-
} else { ?>
|
46 |
-
<tr id="link-row-0" class="">
|
47 |
-
<td>
|
48 |
-
Title<br />
|
49 |
-
<input name="links[<?php echo $role; ?>][0][title]" type="text" id="links[<?php echo $role; ?>][0][title]" value="" class="regular-text link-title" /><br />
|
50 |
-
URL<br />
|
51 |
-
<input name="links[<?php echo $role; ?>][0][url]" type="text" id="links[<?php echo $role; ?>][0][url]" value="" class="extended-text link-url" /><br />
|
52 |
-
<p>
|
53 |
-
<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>
|
54 |
-
<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>
|
55 |
-
</p>
|
56 |
-
</td>
|
57 |
-
</tr>
|
58 |
-
<?php } ?>
|
59 |
-
</table>
|
60 |
-
|
61 |
-
</div>
|
62 |
-
|
63 |
-
<?php
|
64 |
-
$i1++;
|
65 |
-
}
|
66 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/admin-redirection.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<ul class="tabs-nav">
|
2 |
-
<li><a href="#fragment-3-1">General</a></li>
|
3 |
-
<?php
|
4 |
-
$i = 2;
|
5 |
-
foreach ($user_roles as $role => $value) {
|
6 |
-
if ( 'pending' == $role )
|
7 |
-
continue;
|
8 |
-
echo '<li><a href="#fragment-3-' . $i . '">' . ucwords($role) . '</a></li>' . "\n";
|
9 |
-
$i++;
|
10 |
-
}
|
11 |
-
?>
|
12 |
-
</ul>
|
13 |
-
|
14 |
-
<div id="fragment-3-1" class="tabs-div">
|
15 |
-
<table class="form-table">
|
16 |
-
<tr valign="top">
|
17 |
-
<th scope="row"><?php _e('Redirection', 'theme-my-login'); ?></th>
|
18 |
-
<td>
|
19 |
-
<input name="override_redirect" type="radio" id="override_redirect_on" value="1" <?php if ( 1 == $ThemeMyLogin->options['override_redirect'] ) { echo 'checked="checked"'; } ?> />
|
20 |
-
<label for="override_redirect_on"><?php _e('Allow Override', 'theme-my-login'); ?></label><br />
|
21 |
-
<input name="override_redirect" type="radio" id="override_redirect_off" value="0" <?php if ( 0 == $ThemeMyLogin->options['override_redirect'] ) { echo 'checked="checked"'; } ?> />
|
22 |
-
<label for="override_redirect_off"><?php _e('Always Redirect', 'theme-my-login'); ?></label><br />
|
23 |
-
</td>
|
24 |
-
</tr>
|
25 |
-
</table>
|
26 |
-
</div>
|
27 |
-
|
28 |
-
<?php
|
29 |
-
$i1 = 2;
|
30 |
-
foreach ($user_roles as $role => $value) {
|
31 |
-
if ( 'pending' == $role )
|
32 |
-
continue;
|
33 |
-
?>
|
34 |
-
<div id="fragment-3-<?php echo $i1; ?>" class="tabs-div">
|
35 |
-
|
36 |
-
<table id="redirection-<?php echo $role; ?>" class="form-table redirection-table">
|
37 |
-
<tr id="redirect-row-<?php echo $i2; ?>">
|
38 |
-
<td>
|
39 |
-
Log In URL<br />
|
40 |
-
<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" /><br />
|
41 |
-
Log Out URL<br />
|
42 |
-
<input name="redirects[<?php echo $role; ?>][logout_url]" type="text" id="redirects[<?php echo $role; ?>][logout_url]" value="<?php echo $redirects[$role]['logout_url']; ?>" class="extended-text redirect-url" /><br />
|
43 |
-
</td>
|
44 |
-
</tr>
|
45 |
-
</table>
|
46 |
-
|
47 |
-
</div>
|
48 |
-
|
49 |
-
<?php
|
50 |
-
$i1++;
|
51 |
-
}
|
52 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/admin.php
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
global $ThemeMyLogin, $wp_roles;
|
4 |
-
$user_roles = $wp_roles->get_names();
|
5 |
-
|
6 |
-
if ( $_POST ) {
|
7 |
-
|
8 |
-
check_admin_referer('theme-my-login-settings');
|
9 |
-
|
10 |
-
$ThemeMyLogin->options['custom_pass'] = ( $_POST['custom_pass'] ) ? 1 : 0;
|
11 |
-
$ThemeMyLogin->options['moderation'] = ( in_array($_POST['moderation'], array('none', 'email', 'admin')) ) ? $_POST['moderation'] : 'none';
|
12 |
-
if ( in_array($_POST['moderation'], array('email', 'admin')) ) {
|
13 |
-
if ( !$wp_roles->is_role('pending') )
|
14 |
-
add_role('pending', 'Pending', array());
|
15 |
-
} else {
|
16 |
-
if ( $wp_roles->is_role('pending') )
|
17 |
-
remove_role('pending');
|
18 |
-
}
|
19 |
-
$ThemeMyLogin->options['use_css'] = isset($_POST['use_css']) ? 1 : 0;
|
20 |
-
$ThemeMyLogin->options['email_from_name'] = stripslashes($_POST['email_from_name']);
|
21 |
-
$ThemeMyLogin->options['email_from'] = stripslashes($_POST['email_from']);
|
22 |
-
$ThemeMyLogin->options['email_content_type'] = stripslashes($_POST['email_content_type']);
|
23 |
-
|
24 |
-
foreach ( $_POST['links'] as $role => $tmp ) {
|
25 |
-
foreach ( $tmp as $key => $data ) {
|
26 |
-
$links[$role][] = array('title' => $data['title'], 'url' => $data['url']);
|
27 |
-
}
|
28 |
-
}
|
29 |
-
$ThemeMyLogin->options['links'] = $links;
|
30 |
-
|
31 |
-
$ThemeMyLogin->options['override_redirect'] = ( $_POST['override_redirect'] ) ? 1 : 0;
|
32 |
-
foreach ( $_POST['redirects'] as $role => $data ) {
|
33 |
-
$redirects[$role] = array('login_url' => $data['login_url'], 'logout_url' => $data['logout_url']);
|
34 |
-
}
|
35 |
-
$ThemeMyLogin->options['redirects'] = $redirects;
|
36 |
-
|
37 |
-
$ThemeMyLogin->options['registration_email'] = array(
|
38 |
-
'subject' => stripslashes($_POST['registration_subject']),
|
39 |
-
'message' => stripslashes($_POST['registration_message']),
|
40 |
-
'admin_disable' => isset($_POST['registration_admin_disable']) ? 1 : 0
|
41 |
-
);
|
42 |
-
$ThemeMyLogin->options['retrieve_pass_email'] = array(
|
43 |
-
'subject' => stripslashes($_POST['retrieve_pass_subject']),
|
44 |
-
'message' => stripslashes($_POST['retrieve_pass_message'])
|
45 |
-
);
|
46 |
-
$ThemeMyLogin->options['reset_pass_email'] = array(
|
47 |
-
'subject' => stripslashes($_POST['reset_pass_subject']),
|
48 |
-
'message' => stripslashes($_POST['reset_pass_message']),
|
49 |
-
'admin_disable' => isset($_POST['reset_pass_admin_disable']) ? 1 : 0
|
50 |
-
);
|
51 |
-
$ThemeMyLogin->options['confirmation_email'] = array(
|
52 |
-
'subject' => stripslashes($_POST['confirmation_subject']),
|
53 |
-
'message' => stripslashes($_POST['confirmation_message'])
|
54 |
-
);
|
55 |
-
$ThemeMyLogin->options['user_approval_email'] = array(
|
56 |
-
'subject' => stripslashes($_POST['user_approval_subject']),
|
57 |
-
'message' => stripslashes($_POST['user_approval_message'])
|
58 |
-
);
|
59 |
-
$ThemeMyLogin->options['user_denial_email'] = array(
|
60 |
-
'subject' => stripslashes($_POST['user_denial_subject']),
|
61 |
-
'message' => stripslashes($_POST['user_denial_message'])
|
62 |
-
);
|
63 |
-
|
64 |
-
$ThemeMyLogin->saveOptions();
|
65 |
-
|
66 |
-
$info_message =__('Settings saved.', 'theme-my-login');
|
67 |
-
}
|
68 |
-
|
69 |
-
$links = $ThemeMyLogin->options['links'];
|
70 |
-
$redirects = $ThemeMyLogin->options['redirects'];
|
71 |
-
|
72 |
-
?>
|
73 |
-
|
74 |
-
<div class="updated" style="background:#f0f8ff; border:1px solid #addae6">
|
75 |
-
<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>
|
76 |
-
</div>
|
77 |
-
|
78 |
-
<div class="wrap">
|
79 |
-
<?php if ( function_exists('screen_icon') ) screen_icon('options-general'); ?>
|
80 |
-
|
81 |
-
<h2><?php _e('Theme My Login Settings'); ?></h2>
|
82 |
-
|
83 |
-
<?php if ( isset($info_message) && !empty($info_message) ) : ?>
|
84 |
-
<div id="message" class="updated fade">
|
85 |
-
<p><strong><?php echo $info_message ?></strong></p>
|
86 |
-
</div>
|
87 |
-
<?php endif; ?>
|
88 |
-
|
89 |
-
<?php if( isset($error_message) && !empty($error_message) ) : ?>
|
90 |
-
<div id="message" class="error">
|
91 |
-
<p><strong><?php echo $error_message ?></strong></p>
|
92 |
-
</div>
|
93 |
-
<?php endif; ?>
|
94 |
-
|
95 |
-
<form id="theme-my-login-settings" action="" method="post">
|
96 |
-
<?php wp_nonce_field('theme-my-login-settings'); ?>
|
97 |
-
|
98 |
-
<div id="container" class="tabs">
|
99 |
-
|
100 |
-
<ul class="tabs-nav">
|
101 |
-
<li><a href="#fragment-1">General</a></li>
|
102 |
-
<li><a href="#fragment-2">Links</a></li>
|
103 |
-
<li><a href="#fragment-3">Redirection</a></li>
|
104 |
-
<li><a href="#fragment-4">E-mail</a></li>
|
105 |
-
</ul>
|
106 |
-
|
107 |
-
<div id="fragment-1" class="tabs-div">
|
108 |
-
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-general.php'; ?>
|
109 |
-
</div>
|
110 |
-
|
111 |
-
<div id="fragment-2" class="tabs-div">
|
112 |
-
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-links.php'; ?>
|
113 |
-
</div>
|
114 |
-
|
115 |
-
<div id="fragment-3" class="tabs-div">
|
116 |
-
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-redirection.php'; ?>
|
117 |
-
</div>
|
118 |
-
|
119 |
-
<div id="fragment-4" class="tabs-div">
|
120 |
-
<?php include WP_PLUGIN_DIR . '/theme-my-login/admin/admin-email.php'; ?>
|
121 |
-
</div>
|
122 |
-
|
123 |
-
</div>
|
124 |
-
|
125 |
-
<p><input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /></p>
|
126 |
-
</form>
|
127 |
-
|
128 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/css/colors-classic.css
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ui-helper-hidden { display: none; }
|
2 |
+
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
|
3 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
4 |
+
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
5 |
+
.ui-helper-clearfix { display: inline-block; }
|
6 |
+
/* required comment for clearfix to work in Opera \*/
|
7 |
+
* html .ui-helper-clearfix { height:1%; }
|
8 |
+
.ui-helper-clearfix { display:block; }
|
9 |
+
/* end clearfix */
|
10 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
11 |
+
|
12 |
+
.ui-tabs { padding: 0; zoom: 1; }
|
13 |
+
|
14 |
+
.ui-tabs .ui-tabs-nav, .ui-tabs .ui-tabs-panel .ui-tabs-nav { list-style: none; position: relative; padding: 0; }
|
15 |
+
.ui-tabs .ui-tabs-nav li, .ui-tabs .ui-tabs-panel .ui-tabs-nav li { position: relative; float: left; margin: 0; padding: 0; }
|
16 |
+
.ui-tabs .ui-tabs-nav li a, .ui-tabs .ui-tabs-panel .ui-tabs-nav li a { float: left; text-decoration: none; padding: .4em 1em; }
|
17 |
+
.ui-tabs .ui-tabs-panel, .ui-tabs .ui-tabs-panel .ui-tabs-panel { padding: 0 0 1em 0; display: block; border: none; }
|
18 |
+
.ui-tabs .ui-tabs-panel .ui-tabs-panel { padding: 0; }
|
19 |
+
.ui-tabs .ui-tabs-hide, .ui-tabs .ui-tabs-panel .ui-tabs-hide { display: none !important; }
|
20 |
+
|
21 |
+
.ui-widget-content {
|
22 |
+
border: 1px solid #aaaaaa;
|
23 |
+
background: #ffffff;
|
24 |
+
}
|
25 |
+
|
26 |
+
.ui-widget-content .ui-widget-header {
|
27 |
+
border-bottom: 1px solid #aaaaaa;
|
28 |
+
background: #eaf3fa url(../images/menu-bits-vs.gif) repeat-x scroll left -379px;
|
29 |
+
font: normal 13px/18px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
30 |
+
}
|
31 |
+
.ui-widget-content .ui-widget-content .ui-widget-header {
|
32 |
+
border-bottom: 1px solid #e5e5e5;
|
33 |
+
background: #f9f9f9;
|
34 |
+
font: normal 11px/18px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
|
35 |
+
}
|
36 |
+
|
37 |
+
.ui-widget-content .ui-state-default {
|
38 |
+
border-right: 1px solid #d3d3d3;
|
39 |
+
background: transparent;
|
40 |
+
outline: none;
|
41 |
+
}
|
42 |
+
|
43 |
+
.ui-widget-content .ui-widget-content .ui-state-default,
|
44 |
+
.ui-widget-content .ui-widget-content .ui-state-hover,
|
45 |
+
.ui-widget-content .ui-widget-content .ui-state-focus,
|
46 |
+
.ui-widget-content .ui-widget-content .ui-state-active {
|
47 |
+
border: 0;
|
48 |
+
background: none;
|
49 |
+
}
|
50 |
+
|
51 |
+
.ui-widget-content .ui-state-active {
|
52 |
+
background: #3c6b95 url(../images/menu-bits-vs.gif) top left repeat-x;
|
53 |
+
outline: none;
|
54 |
+
}
|
55 |
+
|
56 |
+
.ui-widget-content .ui-state-active a,
|
57 |
+
.ui-widget-content .ui-state-active a:link,
|
58 |
+
.ui-widget-content .ui-state-active a:visited,
|
59 |
+
.ui-widget-content .ui-state-active a:hover {
|
60 |
+
color: #ffffff;
|
61 |
+
outline: none;
|
62 |
+
text-decoration: none;
|
63 |
+
}
|
64 |
+
|
65 |
+
.ui-widget-content .ui-widget-content .ui-state-active a,
|
66 |
+
.ui-widget-content .ui-widget-content .ui-state-active a:link,
|
67 |
+
.ui-widget-content .ui-widget-content .ui-state-active a:visited {
|
68 |
+
color: #212121;
|
69 |
+
outline: none;
|
70 |
+
font-weight: bold;
|
71 |
+
}
|
admin/css/colors-fresh.css
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ui-helper-hidden { display: none; }
|
2 |
+
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
|
3 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
4 |
+
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
5 |
+
.ui-helper-clearfix { display: inline-block; }
|
6 |
+
/* required comment for clearfix to work in Opera \*/
|
7 |
+
* html .ui-helper-clearfix { height:1%; }
|
8 |
+
.ui-helper-clearfix { display:block; }
|
9 |
+
/* end clearfix */
|
10 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
11 |
+
|
12 |
+
.ui-tabs { padding: 0; zoom: 1; }
|
13 |
+
|
14 |
+
.ui-tabs .ui-tabs-nav, .ui-tabs .ui-tabs-panel .ui-tabs-nav { list-style: none; position: relative; padding: 0; }
|
15 |
+
.ui-tabs .ui-tabs-nav li, .ui-tabs .ui-tabs-panel .ui-tabs-nav li { position: relative; float: left; margin: 0; padding: 0; }
|
16 |
+
.ui-tabs .ui-tabs-nav li a, .ui-tabs .ui-tabs-panel .ui-tabs-nav li a { float: left; text-decoration: none; padding: .4em 1em; }
|
17 |
+
.ui-tabs .ui-tabs-panel, .ui-tabs .ui-tabs-panel .ui-tabs-panel { padding: 0 0 1em 0; display: block; border: none; }
|
18 |
+
.ui-tabs .ui-tabs-panel .ui-tabs-panel { padding: 0; }
|
19 |
+
.ui-tabs .ui-tabs-hide, .ui-tabs .ui-tabs-panel .ui-tabs-hide { display: none !important; }
|
20 |
+
|
21 |
+
.ui-widget-content {
|
22 |
+
border: 1px solid #aaaaaa;
|
23 |
+
background: #ffffff;
|
24 |
+
}
|
25 |
+
|
26 |
+
.ui-widget-content .ui-widget-header {
|
27 |
+
border-bottom: 1px solid #aaaaaa;
|
28 |
+
background: #f1f1f1 url(../images/menu-bits.gif) repeat-x scroll left -379px;
|
29 |
+
font: normal 13px/18px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
30 |
+
}
|
31 |
+
.ui-widget-content .ui-widget-content .ui-widget-header {
|
32 |
+
border-bottom: 1px solid #e5e5e5;
|
33 |
+
background: #f9f9f9;
|
34 |
+
font: normal 11px/18px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
|
35 |
+
}
|
36 |
+
|
37 |
+
.ui-widget-content .ui-state-default {
|
38 |
+
border-right: 1px solid #d3d3d3;
|
39 |
+
background: transparent;
|
40 |
+
outline: none;
|
41 |
+
}
|
42 |
+
|
43 |
+
.ui-widget-content .ui-widget-content .ui-state-default,
|
44 |
+
.ui-widget-content .ui-widget-content .ui-state-hover,
|
45 |
+
.ui-widget-content .ui-widget-content .ui-state-focus,
|
46 |
+
.ui-widget-content .ui-widget-content .ui-state-active {
|
47 |
+
border: 0;
|
48 |
+
background: none;
|
49 |
+
}
|
50 |
+
|
51 |
+
.ui-widget-content .ui-state-active {
|
52 |
+
background: #6d6d6d url(../images/menu-bits.gif) top left repeat-x;
|
53 |
+
outline: none;
|
54 |
+
}
|
55 |
+
|
56 |
+
.ui-widget-content .ui-state-active a,
|
57 |
+
.ui-widget-content .ui-state-active a:link,
|
58 |
+
.ui-widget-content .ui-state-active a:visited,
|
59 |
+
.ui-widget-content .ui-state-active a:hover {
|
60 |
+
color: #ffffff;
|
61 |
+
outline: none;
|
62 |
+
text-decoration: none;
|
63 |
+
}
|
64 |
+
|
65 |
+
.ui-widget-content .ui-widget-content .ui-state-active a,
|
66 |
+
.ui-widget-content .ui-widget-content .ui-state-active a:link,
|
67 |
+
.ui-widget-content .ui-widget-content .ui-state-active a:visited {
|
68 |
+
color: #212121;
|
69 |
+
outline: none;
|
70 |
+
font-weight: bold;
|
71 |
+
}
|
admin/css/theme-my-login-admin.css
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#tml-container { margin: 20px 0 5px 0; font-size: 12px; }
|
2 |
+
|
3 |
+
#tml-container table th { width: 125px; }
|
4 |
+
|
5 |
+
#tml-container table input.regular-text { width: 25em; }
|
6 |
+
#tml-container table input.extended-text { width: 40em; }
|
7 |
+
#tml-container table input.full-text { width: 99%; }
|
8 |
+
#tml-container table input.small-text { width: 50px; }
|
9 |
+
|
10 |
+
#tml-container div div { font-size: 1em; }
|
admin/images/menu-bits-vs.gif
ADDED
Binary file
|
admin/images/menu-bits.gif
ADDED
Binary file
|
admin/includes/admin.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_new_user_notification_override_notice() {
|
4 |
+
$message = __('<strong>WARNING</strong>: The function <em>wp_new_user_notification</em> has already been overridden by another plugin. ', 'theme-my-login');
|
5 |
+
$message .= __('Some features of <em>Theme My Login</em> may not function properly.', 'theme-my-login');
|
6 |
+
echo '<div class="error"><p>' . $message . '</p></div>';
|
7 |
+
}
|
8 |
+
|
9 |
+
function wdbj_tml_password_change_notification_override_notice() {
|
10 |
+
$message = __('<strong>WARNING</strong>: The function <em>wp_password_change_notification</em> has already been overridden by another plugin. ', 'theme-my-login');
|
11 |
+
$message .= __('Some features of <em>Theme My Login</em> may not function properly.', 'theme-my-login');
|
12 |
+
echo '<div class="error"><p>' . $message . '</p></div>';
|
13 |
+
}
|
14 |
+
|
15 |
+
function wdbj_tml_admin_menu() {
|
16 |
+
// Create our settings link in the default WP "Settings" menu
|
17 |
+
add_options_page(__('Theme My Login', 'theme-my-login'), __('Theme My Login', 'theme-my-login'), 8, 'theme-my-login/admin/options.php');
|
18 |
+
}
|
19 |
+
|
20 |
+
function wdbj_tml_admin_init() {
|
21 |
+
// Register our settings in the global 'whitelist_settings'
|
22 |
+
register_setting('theme_my_login', 'theme_my_login', 'wdbj_tml_save_settings');
|
23 |
+
|
24 |
+
// Hook into the loading of our dedicated settings page
|
25 |
+
add_action('load-theme-my-login/admin/options.php', 'wdbj_tml_load_settings_page');
|
26 |
+
|
27 |
+
// Create a hook for modules to use
|
28 |
+
do_action('tml_admin_init');
|
29 |
+
}
|
30 |
+
|
31 |
+
function wdbj_tml_load_settings_page() {
|
32 |
+
global $theme_my_login, $user_ID;
|
33 |
+
|
34 |
+
do_action('tml_settings_page');
|
35 |
+
|
36 |
+
// Enqueue neccessary scripts and styles
|
37 |
+
wp_enqueue_script('theme-my-login-admin', plugins_url('/theme-my-login/admin/js/theme-my-login-admin.js'));
|
38 |
+
wp_enqueue_script('jquery-ui-tabs');
|
39 |
+
wp_enqueue_style('theme-my-login-admin', plugins_url('/theme-my-login/admin/css/theme-my-login-admin.css'));
|
40 |
+
|
41 |
+
// Set the correct admin style according to user setting (Only supports default admin schemes)
|
42 |
+
$admin_color = get_usermeta($user_ID, 'admin_color');
|
43 |
+
if ( 'classic' == $admin_color )
|
44 |
+
wp_enqueue_style('theme-my-login-colors-classic', plugins_url('/theme-my-login/admin/css/colors-classic.css'));
|
45 |
+
else
|
46 |
+
wp_enqueue_style('theme-my-login-colors-fresh', plugins_url('/theme-my-login/admin/css/colors-fresh.css'));
|
47 |
+
|
48 |
+
// Handle activation/deactivation of modules
|
49 |
+
if ( isset($theme_my_login->options['activate_modules']) || isset($theme_my_login->options['deactivate_modules']) ) {
|
50 |
+
// If we have modules to activate
|
51 |
+
if ( isset($theme_my_login->options['activate_modules']) ) {
|
52 |
+
// Attempt to activate them
|
53 |
+
$result = wdbj_tml_activate_modules($theme_my_login->options['activate_modules']);
|
54 |
+
// Check for WP_Error
|
55 |
+
if ( is_wp_error($result) ) {
|
56 |
+
// Loop through each module in the WP_Error object
|
57 |
+
foreach ( $result->get_error_data('plugins_invalid') as $module => $wp_error ) {
|
58 |
+
// Store the module and error message to a temporary array which will be passed to 'admin_notices'
|
59 |
+
if ( is_wp_error($wp_error) )
|
60 |
+
$theme_my_login->options['module_errors'][$module] = $wp_error->get_error_message();
|
61 |
+
}
|
62 |
+
}
|
63 |
+
// Unset the 'activate_modules' array
|
64 |
+
unset($theme_my_login->options['activate_modules']);
|
65 |
+
}
|
66 |
+
|
67 |
+
// If we have modules to deactivate
|
68 |
+
if ( isset($theme_my_login->options['deactivate_modules']) ) {
|
69 |
+
// Deactive them
|
70 |
+
wdbj_tml_deactivate_modules($theme_my_login->options['deactivate_modules']);
|
71 |
+
// Unset the 'deactivate_modules' array
|
72 |
+
unset($theme_my_login->options['deactivate_modules']);
|
73 |
+
}
|
74 |
+
|
75 |
+
// Update the options in the DB
|
76 |
+
wdbj_tml_save_options();
|
77 |
+
|
78 |
+
// Redirect so that the newly activated modules can be included and newly unactivated modules can not be included
|
79 |
+
$redirect = isset($theme_my_login->options['module_errors']) ? admin_url('options-general.php?page=theme-my-login/admin/options.php') : add_query_arg('updated', 'true');
|
80 |
+
wp_redirect($redirect);
|
81 |
+
exit();
|
82 |
+
}
|
83 |
+
|
84 |
+
// If we have errors to display, hook into 'admin_notices' to display them
|
85 |
+
if ( isset($theme_my_login->options['module_errors']) && $theme_my_login->options['module_errors'] )
|
86 |
+
add_action('admin_notices', 'wdbj_tml_module_error_notice');
|
87 |
+
}
|
88 |
+
|
89 |
+
function wdbj_tml_module_error_notice() {
|
90 |
+
global $theme_my_login;
|
91 |
+
|
92 |
+
// If we have errors to display
|
93 |
+
if ( isset($theme_my_login->options['module_errors']) ) {
|
94 |
+
// Display them
|
95 |
+
echo '<div class="error">';
|
96 |
+
foreach ( $theme_my_login->options['module_errors'] as $module => $error ) {
|
97 |
+
echo "<p><strong>ERROR: The module \"$module\" could not be activated ($error).</strong></p>";
|
98 |
+
}
|
99 |
+
echo '</div>';
|
100 |
+
// Unset the error array
|
101 |
+
unset($theme_my_login->options['module_errors']);
|
102 |
+
// Update the options in the DB
|
103 |
+
wdbj_tml_save_options();
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
function wdbj_tml_save_settings($settings) {
|
108 |
+
global $theme_my_login;
|
109 |
+
|
110 |
+
// Assign current settings
|
111 |
+
$current = $theme_my_login->options;
|
112 |
+
|
113 |
+
// Sanitize new settings
|
114 |
+
$settings['page_id'] = absint($settings['page_id']);
|
115 |
+
$settings['show_page'] = ( isset($settings['show_page']) && $settings['show_page'] ) ? 1 : 0;
|
116 |
+
$settings['rewrite_links'] = ( isset($settings['rewrite_links']) && $settings['rewrite_links'] ) ? 1 : 0;
|
117 |
+
$settings['enable_css'] = ( isset($settings['enable_css']) && $settings['enable_css'] ) ? 1 : 0;
|
118 |
+
$settings['enable_template_tag'] = ( isset($settings['enable_template_tag']) && $settings['enable_template_tag'] ) ? 1 : 0;
|
119 |
+
$settings['enable_widget'] = ( isset($settings['enable_widget']) && $settings['enable_widget'] ) ? 1 : 0;
|
120 |
+
if ( isset($_POST['tml_editing_modules']) ) {
|
121 |
+
$settings['modules'] = isset($settings['modules']) ? (array) $settings['modules'] : array();
|
122 |
+
|
123 |
+
// Set modules to be activated
|
124 |
+
if ( $activate = array_diff($settings['modules'], (array) $current['active_modules']) )
|
125 |
+
$settings['activate_modules'] = $activate;
|
126 |
+
|
127 |
+
// Set modules to be deactivated
|
128 |
+
if ( $deactivate = array_diff((array) $current['active_modules'], $settings['modules']) )
|
129 |
+
$settings['deactivate_modules'] = $deactivate;
|
130 |
+
|
131 |
+
// Unset 'modules' as it is only relevent here
|
132 |
+
unset($settings['modules']);
|
133 |
+
}
|
134 |
+
|
135 |
+
// Merge current settings
|
136 |
+
$settings = wp_parse_args($settings, $current);
|
137 |
+
|
138 |
+
// Allow plugins/modules to add/modify settings
|
139 |
+
$settings = apply_filters('tml_save_settings', $settings);
|
140 |
+
|
141 |
+
return $settings;
|
142 |
+
}
|
143 |
+
|
144 |
+
function wdbj_tml_install() {
|
145 |
+
global $theme_my_login;
|
146 |
+
|
147 |
+
$previous_install = get_option('theme_my_login');
|
148 |
+
if ( $previous_install ) {
|
149 |
+
if ( version_compare($previous_install['version'], '4.4', '<') )
|
150 |
+
remove_role('denied');
|
151 |
+
}
|
152 |
+
|
153 |
+
$insert = array(
|
154 |
+
'post_title' => 'Login',
|
155 |
+
'post_status' => 'publish',
|
156 |
+
'post_type' => 'page',
|
157 |
+
'post_author' => 1,
|
158 |
+
'post_content' => '[theme-my-login show_title="0" before_widget="" after_widget="" instance_id="tml-page"]',
|
159 |
+
'comment_status' => 'closed',
|
160 |
+
'ping_status' => 'closed'
|
161 |
+
);
|
162 |
+
|
163 |
+
if ( $page = get_page_by_title('Login') ) {
|
164 |
+
$page_id = $page->ID;
|
165 |
+
if ( 'trash' == $page->post_status )
|
166 |
+
wp_untrash_post($page_id);
|
167 |
+
} else
|
168 |
+
$page_id = wp_insert_post($insert);
|
169 |
+
|
170 |
+
$options = wp_parse_args($previous_install, Theme_My_Login::default_options());
|
171 |
+
|
172 |
+
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/theme-my-login/theme-my-login.php');
|
173 |
+
$options['version'] = $plugin_data['Version'];
|
174 |
+
$options['page_id'] = $page_id;
|
175 |
+
return update_option('theme_my_login', $options);
|
176 |
+
}
|
177 |
+
|
178 |
+
function wdbj_tml_uninstall() {
|
179 |
+
$options = get_option('theme_my_login');
|
180 |
+
|
181 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
182 |
+
|
183 |
+
// Run module uninstall hooks
|
184 |
+
$modules = get_plugins('/theme-my-login/modules');
|
185 |
+
foreach ( array_keys($modules) as $module ) {
|
186 |
+
$module = plugin_basename(trim($module));
|
187 |
+
|
188 |
+
$valid = wdbj_tml_validate_module($module);
|
189 |
+
if ( is_wp_error($valid) )
|
190 |
+
continue;
|
191 |
+
|
192 |
+
@include (TML_MODULE_DIR . '/' . $module);
|
193 |
+
do_action('uninstall_' . trim($module));
|
194 |
+
}
|
195 |
+
|
196 |
+
// Delete the page
|
197 |
+
if ( get_page($options['page_id']) )
|
198 |
+
wp_delete_post($options['page_id']);
|
199 |
+
|
200 |
+
// Delete options
|
201 |
+
delete_option('theme_my_login');
|
202 |
+
delete_option('widget_theme-my-login');
|
203 |
+
}
|
204 |
+
|
205 |
+
?>
|
admin/includes/module.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_activate_module($module) {
|
4 |
+
$module = plugin_basename(trim($module));
|
5 |
+
$valid = wdbj_tml_validate_module($module);
|
6 |
+
if ( is_wp_error($valid) )
|
7 |
+
return $valid;
|
8 |
+
|
9 |
+
$current = wdbj_tml_get_option('active_modules');
|
10 |
+
if ( ! wdbj_tml_is_module_active($module) ) {
|
11 |
+
//ob_start();
|
12 |
+
@include (TML_MODULE_DIR . '/' . $module);
|
13 |
+
$current[] = $module;
|
14 |
+
sort($current);
|
15 |
+
do_action('tml_activate_module', trim($module));
|
16 |
+
// We will not use this since our function modifies the global plugin object instead of saving to the DB
|
17 |
+
//update_option('theme_my_login', $current);
|
18 |
+
wdbj_tml_update_option($current, 'active_modules');
|
19 |
+
do_action('activate_' . trim($module));
|
20 |
+
do_action('tml_activated_module', trim($module));
|
21 |
+
//ob_end_clean();
|
22 |
+
}
|
23 |
+
|
24 |
+
return null;
|
25 |
+
}
|
26 |
+
|
27 |
+
function wdbj_tml_deactivate_modules($modules, $silent= false) {
|
28 |
+
$current = wdbj_tml_get_option('active_modules');
|
29 |
+
|
30 |
+
if ( ! is_array($modules) )
|
31 |
+
$modules = array($modules);
|
32 |
+
|
33 |
+
foreach ( $modules as $module ) {
|
34 |
+
$module = plugin_basename($module);
|
35 |
+
if( ! wdbj_tml_is_module_active($module) )
|
36 |
+
continue;
|
37 |
+
if ( ! $silent )
|
38 |
+
do_action('tml_deactivate_module', trim($module));
|
39 |
+
|
40 |
+
$key = array_search( $module, (array) $current );
|
41 |
+
|
42 |
+
if ( false !== $key )
|
43 |
+
array_splice( $current, $key, 1 );
|
44 |
+
|
45 |
+
if ( ! $silent ) {
|
46 |
+
do_action( 'deactivate_' . trim( $module ) );
|
47 |
+
do_action( 'tml_deactivated_module', trim( $module ) );
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
// We will not use this since the function modifies our global plugin object instead of saving to the DB
|
52 |
+
//update_option('theme_my_login', $current);
|
53 |
+
wdbj_tml_update_option($current, 'active_modules');
|
54 |
+
}
|
55 |
+
|
56 |
+
function wdbj_tml_activate_modules($modules) {
|
57 |
+
if ( !is_array($modules) )
|
58 |
+
$modules = array($modules);
|
59 |
+
|
60 |
+
$errors = array();
|
61 |
+
foreach ( (array) $modules as $module ) {
|
62 |
+
$result = wdbj_tml_activate_module($module);
|
63 |
+
if ( is_wp_error($result) )
|
64 |
+
$errors[$module] = $result;
|
65 |
+
}
|
66 |
+
|
67 |
+
if ( !empty($errors) )
|
68 |
+
return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
|
69 |
+
|
70 |
+
return true;
|
71 |
+
}
|
72 |
+
|
73 |
+
function wdbj_tml_validate_module($module) {
|
74 |
+
if ( validate_file($module) )
|
75 |
+
return new WP_Error('plugin_invalid', __('Invalid plugin path.'));
|
76 |
+
if ( ! file_exists(TML_MODULE_DIR . '/' . $module) )
|
77 |
+
return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
|
78 |
+
|
79 |
+
$installed_modules = get_plugins('/theme-my-login/modules');
|
80 |
+
if ( ! isset($installed_modules[$module]) )
|
81 |
+
return new WP_Error('no_plugin_header', __('The plugin does not have a valid header.'));
|
82 |
+
return 0;
|
83 |
+
}
|
84 |
+
|
85 |
+
function wdbj_tml_add_menu_page($menu_title, $file, $function = '', $function_args = array(), $position = NULL) {
|
86 |
+
global $wdbj_tml_admin_menu;
|
87 |
+
|
88 |
+
$file = plugin_basename($file);
|
89 |
+
|
90 |
+
$hookname = get_plugin_page_hookname($file, '');
|
91 |
+
$hookname = preg_replace('|[^a-zA-Z0-9_:.]|', '-', $hookname);
|
92 |
+
if ( !empty($function) && !empty($hookname) )
|
93 |
+
add_action($hookname, $function);
|
94 |
+
|
95 |
+
$new_menu = array($menu_title, $file, $hookname, $function_args);
|
96 |
+
|
97 |
+
if ( NULL === $position )
|
98 |
+
$wdbj_tml_admin_menu[] = $new_menu;
|
99 |
+
else
|
100 |
+
$wdbj_tml_admin_menu[$position] = $new_menu;
|
101 |
+
|
102 |
+
return $hookname;
|
103 |
+
}
|
104 |
+
|
105 |
+
function wdbj_tml_add_submenu_page($parent, $menu_title, $file, $function = array(), $function_args = '') {
|
106 |
+
global $wdbj_tml_admin_submenu;
|
107 |
+
|
108 |
+
$file = plugin_basename($file);
|
109 |
+
$parent = plugin_basename($parent);
|
110 |
+
|
111 |
+
$count = ( isset($wdbj_tml_admin_submenu[$parent]) && is_array($wdbj_tml_admin_submenu[$parent]) ) ? count($wdbj_tml_admin_submenu[$parent]) + 1 : 1;
|
112 |
+
|
113 |
+
$hookname = get_plugin_page_hookname($parent . '-' . $count, '');
|
114 |
+
$hookname = preg_replace('|[^a-zA-Z0-9_:.]|', '-', $hookname);
|
115 |
+
if ( !empty($function) && !empty($hookname) )
|
116 |
+
add_action($hookname, $function);
|
117 |
+
|
118 |
+
$wdbj_tml_admin_submenu[$parent][] = array($menu_title, $file, $hookname, $function_args);
|
119 |
+
|
120 |
+
return $hookname;
|
121 |
+
}
|
122 |
+
|
123 |
+
?>
|
admin/js/theme-my-login-admin.js
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
|
3 |
+
$("#tml-container").tabs({
|
4 |
+
select: function(event, ui) {
|
5 |
+
setUserSetting( 'tml0', ui.index );
|
6 |
+
},
|
7 |
+
selected: getUserSetting( 'tml0', 0 )
|
8 |
+
});
|
9 |
+
|
10 |
+
$("#tml-container div").tabs({
|
11 |
+
select: function(event, ui) {
|
12 |
+
setUserSetting( 'tml1', ui.index );
|
13 |
+
},
|
14 |
+
selected: getUserSetting( 'tml1', 0 )
|
15 |
+
});
|
16 |
+
});
|
admin/options-basic.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr valign="top">
|
3 |
+
<th scope="row"><label for="theme_my_login_page_id"><?php _e('Page ID', 'theme-my-login'); ?></label></th>
|
4 |
+
<td>
|
5 |
+
<input name="theme_my_login[page_id]" type="text" id="theme_my_login_page_id" value="<?php echo (int) $theme_my_login->options['page_id']; ?>" class="small-text" />
|
6 |
+
<p class="description"><?php _e('This should be the ID of the WordPress page that includes the [theme-my-login] shortcode. By default, this page is titled "Login".'); ?></p>
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
<tr valign="top">
|
10 |
+
<th scope="row"><?php _e('Pagelist', 'theme-my-login'); ?></th>
|
11 |
+
<td>
|
12 |
+
<input name="theme_my_login[show_page]" type="checkbox" id="theme_my_login_show_page" value="1"<?php checked(1, $theme_my_login->options['show_page']); ?> />
|
13 |
+
<label for="theme_my_login_show_page"><?php _e('Show Page In Pagelist', 'theme-my-login'); ?></label>
|
14 |
+
<p class="description"><?php _e('Enable this setting to add login/logout links to the pagelist generated by functions like wp_list_pages() and wp_page_menu().', 'theme-my-login'); ?></p>
|
15 |
+
</td>
|
16 |
+
</tr>
|
17 |
+
<tr valign="top">
|
18 |
+
<th scope="row"><?php _e('Links', 'theme-my-login'); ?></th>
|
19 |
+
<td>
|
20 |
+
<input name="theme_my_login[rewrite_links]" type="checkbox" id="theme_my_login_rewrite_links" value="1"<?php checked(1, $theme_my_login->options['rewrite_links']); ?> />
|
21 |
+
<label for="theme_my_login_rewrite_links"><?php _e('Rewrite Login Links', 'theme-my-login'); ?></label>
|
22 |
+
<p class="description"><?php _e('Enable this setting to rewrite links generated by functions like wp_loginout() and wp_register().', 'theme-my-login'); ?></p>
|
23 |
+
</td>
|
24 |
+
</tr>
|
25 |
+
<tr valign="top">
|
26 |
+
<th scope="row"><?php _e('Stylesheet', 'theme-my-login'); ?></th>
|
27 |
+
<td>
|
28 |
+
<input name="theme_my_login[enable_css]" type="checkbox" id="theme_my_login_enable_css" value="1"<?php checked(1, $theme_my_login->options['enable_css']); ?> />
|
29 |
+
<label for="theme_my_login_enable_css"><?php _e('Enable "theme-my-login.css"', 'theme-my-login'); ?></label>
|
30 |
+
<p class="description"><?php _e('In order to keep changes between upgrades, you can store your customized "theme-my-login.css" in your current theme directory.', 'theme-my-login'); ?></p>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
<?php do_action('tml_settings_basic', $theme_my_login->options); ?>
|
34 |
+
</table>
|
admin/options-modules.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr valign="top">
|
3 |
+
<th scope="row"><?php _e('Modules', 'theme-my-login'); ?></th>
|
4 |
+
<td>
|
5 |
+
<input type="hidden" name="tml_editing_modules" value="1" />
|
6 |
+
<?php $modules = get_plugins('/theme-my-login/modules'); if ( !empty($modules) ) : foreach ( $modules as $module_file => $module_data ) : ?>
|
7 |
+
<input name="theme_my_login[modules][]" type="checkbox" id="theme_my_login_modules_<?php echo $module_file; ?>" value="<?php echo $module_file; ?>"<?php checked(1, in_array($module_file, $theme_my_login->options['active_modules'])); ?> />
|
8 |
+
<label for="theme_my_login_modules_<?php echo $module_file; ?>"><?php printf(__('Enable %s', 'theme-my-login'), $module_data['Name']); ?></label><br />
|
9 |
+
<?php if ( $module_data['Description'] ) echo '<p class="description">' . $module_data['Description'] . '</p>'; ?>
|
10 |
+
<?php endforeach; else : _e('No modules found.', 'theme-my-login'); endif; ?>
|
11 |
+
</td>
|
12 |
+
</tr>
|
13 |
+
<?php do_action('tml_settings_modules', $theme_my_login->options); ?>
|
14 |
+
</table>
|
admin/options-optimization.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr valign="top">
|
3 |
+
<th scope="row"><?php _e('Optimization', 'theme-my-login'); ?></th>
|
4 |
+
<td>
|
5 |
+
<input name="theme_my_login[enable_template_tag]" type="checkbox" id="theme_my_login_enable_template_tag" value="1"<?php checked('1', $theme_my_login->options['enable_template_tag']); ?> />
|
6 |
+
<label for="theme_my_login_enable_template_tag"><?php _e('Enable Template Tag', 'theme-my-login'); ?></label><br />
|
7 |
+
<p class="description"><?php _e('Enable this setting if you wish to use the theme_my_login() template tag. Otherwise, leave it disabled for optimization purposes.', 'theme-my-login'); ?></p>
|
8 |
+
|
9 |
+
<input name="theme_my_login[enable_widget]" type="checkbox" id="theme_my_login_enable_widget" value="1"<?php checked('1', $theme_my_login->options['enable_widget']); ?> />
|
10 |
+
<label for="theme_my_login_enable_widget"><?php _e('Enable Widget', 'theme-my-login'); ?></label><br />
|
11 |
+
<p class="description"><?php _e('Enable this setting if you wish to use the "Theme My Login" widget. Otherwise, leave it disabled for optimization purposes.', 'theme-my-login'); ?></p>
|
12 |
+
</td>
|
13 |
+
</tr>
|
14 |
+
<?php do_action('tml_settings_optimization', $theme_my_login->options); ?>
|
15 |
+
</table>
|
admin/options.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Default menu
|
4 |
+
wdbj_tml_add_menu_page(__('General', 'theme-my-login'), 'theme-my-login/admin/options.php');
|
5 |
+
wdbj_tml_add_submenu_page('theme-my-login/admin/options.php', __('Basic', 'theme-my-login'), 'theme-my-login/admin/options-basic.php');
|
6 |
+
wdbj_tml_add_submenu_page('theme-my-login/admin/options.php', __('Modules', 'theme-my-login'), 'theme-my-login/admin/options-modules.php');
|
7 |
+
wdbj_tml_add_submenu_page('theme-my-login/admin/options.php', __('Optimization', 'theme-my-login'), 'theme-my-login/admin/options-optimization.php');
|
8 |
+
|
9 |
+
// Allow plugins to add to menu
|
10 |
+
do_action('tml_admin_menu');
|
11 |
+
|
12 |
+
?>
|
13 |
+
|
14 |
+
<div class="updated" style="background:#f0f8ff; border:1px solid #addae6">
|
15 |
+
<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>
|
16 |
+
</div>
|
17 |
+
|
18 |
+
<div class="wrap">
|
19 |
+
<?php screen_icon('options-general'); ?>
|
20 |
+
<h2><?php esc_html_e('Theme My Login Settings', 'theme-my-login'); ?></h2>
|
21 |
+
|
22 |
+
<form action="options.php" method="post">
|
23 |
+
<?php settings_fields('theme_my_login'); ?>
|
24 |
+
|
25 |
+
<div style="display:none;">
|
26 |
+
<p><input type="submit" name="submit" value="<?php esc_attr_e('Save Changes') ?>" /></p>
|
27 |
+
</div>
|
28 |
+
|
29 |
+
<div id="tml-container">
|
30 |
+
|
31 |
+
<ul>
|
32 |
+
<?php foreach ( $wdbj_tml_admin_menu as $tml_menu ) {
|
33 |
+
echo '<li><a href="#' . $tml_menu[2] . '">' . $tml_menu[0] . '</a></li>' . "\n";
|
34 |
+
}?>
|
35 |
+
</ul>
|
36 |
+
|
37 |
+
|
38 |
+
<?php foreach ( $wdbj_tml_admin_menu as $tml_menu ) {
|
39 |
+
echo '<div id="' . $tml_menu[2] . '">' . "\n";
|
40 |
+
if ( isset($wdbj_tml_admin_submenu[$tml_menu[1]]) ) {
|
41 |
+
echo '<ul>' . "\n";
|
42 |
+
foreach ( $wdbj_tml_admin_submenu[$tml_menu[1]] as $tml_submenu ) {
|
43 |
+
echo '<li><a href="#' . $tml_submenu[2] . '">' . $tml_submenu[0] . '</a></li>' . "\n";
|
44 |
+
}
|
45 |
+
echo '</ul>' . "\n";
|
46 |
+
|
47 |
+
foreach ( $wdbj_tml_admin_submenu[$tml_menu[1]] as $tml_submenu ) {
|
48 |
+
echo '<div id="' . $tml_submenu[2] . '">' . "\n";
|
49 |
+
if ( has_action($tml_submenu[2]) ) {
|
50 |
+
do_action('load-' . $tml_submenu[2]);
|
51 |
+
call_user_func_array('do_action', array_merge((array) $tml_submenu[2], (array) $tml_submenu[3]));
|
52 |
+
} else {
|
53 |
+
if ( validate_file($tml_submenu[1]) )
|
54 |
+
return false;
|
55 |
+
|
56 |
+
if ( ! ( file_exists(WP_PLUGIN_DIR . '/' . $tml_submenu[1]) && is_file(WP_PLUGIN_DIR . '/' . $tml_submenu[1]) ) )
|
57 |
+
return false;
|
58 |
+
|
59 |
+
do_action('load-' . $tml_submenu[1]);
|
60 |
+
include (WP_PLUGIN_DIR . '/' . $tml_submenu[1]);
|
61 |
+
}
|
62 |
+
echo '</div>' . "\n";
|
63 |
+
}
|
64 |
+
} else {
|
65 |
+
if ( has_action($tml_menu[2]) ) {
|
66 |
+
do_action('load-' . $tml_menu[2]);
|
67 |
+
call_user_func_array('do_action', array_merge((array) $tml_menu[2], (array) $tml_menu[3]));
|
68 |
+
} else {
|
69 |
+
if ( validate_file($tml_menu[1]) )
|
70 |
+
return false;
|
71 |
+
|
72 |
+
if ( ! ( file_exists(WP_PLUGIN_DIR . '/' . $tml_menu[1]) && is_file(WP_PLUGIN_DIR . '/' . $tml_menu[1]) ) )
|
73 |
+
return false;
|
74 |
+
|
75 |
+
do_action('load-' . $tml_menu[1]);
|
76 |
+
include (WP_PLUGIN_DIR . '/' . $tml_menu[1]);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
echo '</div>' . "\n";
|
80 |
+
} ?>
|
81 |
+
|
82 |
+
</div>
|
83 |
+
|
84 |
+
<p><input type="submit" name="submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /></p>
|
85 |
+
</form>
|
86 |
+
|
87 |
+
</div>
|
css/theme-my-login-admin.css
DELETED
@@ -1,16 +0,0 @@
|
|
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/wp-colors-classic/images/ui-bg_flat_0_aaaaaa_40x100.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-bg_flat_75_ffffff_40x100.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-bg_glass_55_fbf9ee_1x400.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-bg_glass_65_ffffff_1x400.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-bg_glass_75_eaf3fa_1x400.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-bg_glass_95_fef1ec_1x400.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-bg_highlight-soft_75_bbd8e7_1x100.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-icons_222222_256x240.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-icons_2e83ff_256x240.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-icons_454545_256x240.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-icons_888888_256x240.png
DELETED
Binary file
|
css/wp-colors-classic/images/ui-icons_cd0a0a_256x240.png
DELETED
Binary file
|
css/wp-colors-classic/wp-colors-classic.css
DELETED
@@ -1,428 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery UI CSS Framework
|
3 |
-
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
4 |
-
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
5 |
-
*/
|
6 |
-
|
7 |
-
/* Layout helpers
|
8 |
-
----------------------------------*/
|
9 |
-
.ui-helper-hidden { display: none; }
|
10 |
-
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
|
11 |
-
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
12 |
-
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
13 |
-
.ui-helper-clearfix { display: inline-block; }
|
14 |
-
/* required comment for clearfix to work in Opera \*/
|
15 |
-
* html .ui-helper-clearfix { height:1%; }
|
16 |
-
.ui-helper-clearfix { display:block; }
|
17 |
-
/* end clearfix */
|
18 |
-
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
19 |
-
|
20 |
-
|
21 |
-
/* Interaction Cues
|
22 |
-
----------------------------------*/
|
23 |
-
.ui-state-disabled { cursor: default !important; }
|
24 |
-
|
25 |
-
|
26 |
-
/* Icons
|
27 |
-
----------------------------------*/
|
28 |
-
|
29 |
-
/* states and images */
|
30 |
-
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
31 |
-
|
32 |
-
|
33 |
-
/* Misc visuals
|
34 |
-
----------------------------------*/
|
35 |
-
|
36 |
-
/* Overlays */
|
37 |
-
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
/*
|
42 |
-
* jQuery UI CSS Framework
|
43 |
-
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
44 |
-
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
45 |
-
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=bbd8e7&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=eaf3fa&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=1c6280&iconColorDefault=888888&bgColorHover=eaf3fa&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=d54e21&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
46 |
-
*/
|
47 |
-
|
48 |
-
|
49 |
-
/* Component containers
|
50 |
-
----------------------------------*/
|
51 |
-
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
|
52 |
-
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
|
53 |
-
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
|
54 |
-
.ui-widget-content a { color: #222222; }
|
55 |
-
.ui-widget-header { border: 1px solid #aaaaaa; background: #bbd8e7 url(images/ui-bg_highlight-soft_75_bbd8e7_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
|
56 |
-
.ui-widget-header a { color: #222222; }
|
57 |
-
|
58 |
-
/* Interaction states
|
59 |
-
----------------------------------*/
|
60 |
-
.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3; background: #eaf3fa url(images/ui-bg_glass_75_eaf3fa_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #1c6280; outline: none; }
|
61 |
-
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c6280; text-decoration: none; outline: none; }
|
62 |
-
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999; background: #eaf3fa url(images/ui-bg_glass_75_eaf3fa_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #d54e21; outline: none; }
|
63 |
-
.ui-state-hover a, .ui-state-hover a:hover { color: #d54e21; text-decoration: none; outline: none; }
|
64 |
-
.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; }
|
65 |
-
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; }
|
66 |
-
|
67 |
-
/* Interaction Cues
|
68 |
-
----------------------------------*/
|
69 |
-
.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
|
70 |
-
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
|
71 |
-
.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
|
72 |
-
.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; }
|
73 |
-
.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; }
|
74 |
-
.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
75 |
-
.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
|
76 |
-
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
77 |
-
|
78 |
-
/* Icons
|
79 |
-
----------------------------------*/
|
80 |
-
|
81 |
-
/* states and images */
|
82 |
-
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
|
83 |
-
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
84 |
-
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
85 |
-
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
|
86 |
-
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
87 |
-
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
88 |
-
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
|
89 |
-
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
|
90 |
-
|
91 |
-
/* positioning */
|
92 |
-
.ui-icon-carat-1-n { background-position: 0 0; }
|
93 |
-
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
94 |
-
.ui-icon-carat-1-e { background-position: -32px 0; }
|
95 |
-
.ui-icon-carat-1-se { background-position: -48px 0; }
|
96 |
-
.ui-icon-carat-1-s { background-position: -64px 0; }
|
97 |
-
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
98 |
-
.ui-icon-carat-1-w { background-position: -96px 0; }
|
99 |
-
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
100 |
-
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
101 |
-
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
102 |
-
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
103 |
-
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
104 |
-
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
105 |
-
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
106 |
-
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
107 |
-
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
108 |
-
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
109 |
-
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
110 |
-
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
111 |
-
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
112 |
-
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
113 |
-
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
114 |
-
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
115 |
-
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
116 |
-
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
117 |
-
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
118 |
-
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
119 |
-
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
120 |
-
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
121 |
-
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
122 |
-
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
123 |
-
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
124 |
-
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
125 |
-
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
126 |
-
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
127 |
-
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
128 |
-
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
129 |
-
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
130 |
-
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
131 |
-
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
132 |
-
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
133 |
-
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
134 |
-
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
135 |
-
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
136 |
-
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
137 |
-
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
138 |
-
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
139 |
-
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
140 |
-
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
141 |
-
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
142 |
-
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
143 |
-
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
144 |
-
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
145 |
-
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
146 |
-
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
147 |
-
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
148 |
-
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
149 |
-
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
150 |
-
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
151 |
-
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
152 |
-
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
153 |
-
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
154 |
-
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
155 |
-
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
156 |
-
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
157 |
-
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
158 |
-
.ui-icon-extlink { background-position: -32px -80px; }
|
159 |
-
.ui-icon-newwin { background-position: -48px -80px; }
|
160 |
-
.ui-icon-refresh { background-position: -64px -80px; }
|
161 |
-
.ui-icon-shuffle { background-position: -80px -80px; }
|
162 |
-
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
163 |
-
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
164 |
-
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
165 |
-
.ui-icon-folder-open { background-position: -16px -96px; }
|
166 |
-
.ui-icon-document { background-position: -32px -96px; }
|
167 |
-
.ui-icon-document-b { background-position: -48px -96px; }
|
168 |
-
.ui-icon-note { background-position: -64px -96px; }
|
169 |
-
.ui-icon-mail-closed { background-position: -80px -96px; }
|
170 |
-
.ui-icon-mail-open { background-position: -96px -96px; }
|
171 |
-
.ui-icon-suitcase { background-position: -112px -96px; }
|
172 |
-
.ui-icon-comment { background-position: -128px -96px; }
|
173 |
-
.ui-icon-person { background-position: -144px -96px; }
|
174 |
-
.ui-icon-print { background-position: -160px -96px; }
|
175 |
-
.ui-icon-trash { background-position: -176px -96px; }
|
176 |
-
.ui-icon-locked { background-position: -192px -96px; }
|
177 |
-
.ui-icon-unlocked { background-position: -208px -96px; }
|
178 |
-
.ui-icon-bookmark { background-position: -224px -96px; }
|
179 |
-
.ui-icon-tag { background-position: -240px -96px; }
|
180 |
-
.ui-icon-home { background-position: 0 -112px; }
|
181 |
-
.ui-icon-flag { background-position: -16px -112px; }
|
182 |
-
.ui-icon-calendar { background-position: -32px -112px; }
|
183 |
-
.ui-icon-cart { background-position: -48px -112px; }
|
184 |
-
.ui-icon-pencil { background-position: -64px -112px; }
|
185 |
-
.ui-icon-clock { background-position: -80px -112px; }
|
186 |
-
.ui-icon-disk { background-position: -96px -112px; }
|
187 |
-
.ui-icon-calculator { background-position: -112px -112px; }
|
188 |
-
.ui-icon-zoomin { background-position: -128px -112px; }
|
189 |
-
.ui-icon-zoomout { background-position: -144px -112px; }
|
190 |
-
.ui-icon-search { background-position: -160px -112px; }
|
191 |
-
.ui-icon-wrench { background-position: -176px -112px; }
|
192 |
-
.ui-icon-gear { background-position: -192px -112px; }
|
193 |
-
.ui-icon-heart { background-position: -208px -112px; }
|
194 |
-
.ui-icon-star { background-position: -224px -112px; }
|
195 |
-
.ui-icon-link { background-position: -240px -112px; }
|
196 |
-
.ui-icon-cancel { background-position: 0 -128px; }
|
197 |
-
.ui-icon-plus { background-position: -16px -128px; }
|
198 |
-
.ui-icon-plusthick { background-position: -32px -128px; }
|
199 |
-
.ui-icon-minus { background-position: -48px -128px; }
|
200 |
-
.ui-icon-minusthick { background-position: -64px -128px; }
|
201 |
-
.ui-icon-close { background-position: -80px -128px; }
|
202 |
-
.ui-icon-closethick { background-position: -96px -128px; }
|
203 |
-
.ui-icon-key { background-position: -112px -128px; }
|
204 |
-
.ui-icon-lightbulb { background-position: -128px -128px; }
|
205 |
-
.ui-icon-scissors { background-position: -144px -128px; }
|
206 |
-
.ui-icon-clipboard { background-position: -160px -128px; }
|
207 |
-
.ui-icon-copy { background-position: -176px -128px; }
|
208 |
-
.ui-icon-contact { background-position: -192px -128px; }
|
209 |
-
.ui-icon-image { background-position: -208px -128px; }
|
210 |
-
.ui-icon-video { background-position: -224px -128px; }
|
211 |
-
.ui-icon-script { background-position: -240px -128px; }
|
212 |
-
.ui-icon-alert { background-position: 0 -144px; }
|
213 |
-
.ui-icon-info { background-position: -16px -144px; }
|
214 |
-
.ui-icon-notice { background-position: -32px -144px; }
|
215 |
-
.ui-icon-help { background-position: -48px -144px; }
|
216 |
-
.ui-icon-check { background-position: -64px -144px; }
|
217 |
-
.ui-icon-bullet { background-position: -80px -144px; }
|
218 |
-
.ui-icon-radio-off { background-position: -96px -144px; }
|
219 |
-
.ui-icon-radio-on { background-position: -112px -144px; }
|
220 |
-
.ui-icon-pin-w { background-position: -128px -144px; }
|
221 |
-
.ui-icon-pin-s { background-position: -144px -144px; }
|
222 |
-
.ui-icon-play { background-position: 0 -160px; }
|
223 |
-
.ui-icon-pause { background-position: -16px -160px; }
|
224 |
-
.ui-icon-seek-next { background-position: -32px -160px; }
|
225 |
-
.ui-icon-seek-prev { background-position: -48px -160px; }
|
226 |
-
.ui-icon-seek-end { background-position: -64px -160px; }
|
227 |
-
.ui-icon-seek-first { background-position: -80px -160px; }
|
228 |
-
.ui-icon-stop { background-position: -96px -160px; }
|
229 |
-
.ui-icon-eject { background-position: -112px -160px; }
|
230 |
-
.ui-icon-volume-off { background-position: -128px -160px; }
|
231 |
-
.ui-icon-volume-on { background-position: -144px -160px; }
|
232 |
-
.ui-icon-power { background-position: 0 -176px; }
|
233 |
-
.ui-icon-signal-diag { background-position: -16px -176px; }
|
234 |
-
.ui-icon-signal { background-position: -32px -176px; }
|
235 |
-
.ui-icon-battery-0 { background-position: -48px -176px; }
|
236 |
-
.ui-icon-battery-1 { background-position: -64px -176px; }
|
237 |
-
.ui-icon-battery-2 { background-position: -80px -176px; }
|
238 |
-
.ui-icon-battery-3 { background-position: -96px -176px; }
|
239 |
-
.ui-icon-circle-plus { background-position: 0 -192px; }
|
240 |
-
.ui-icon-circle-minus { background-position: -16px -192px; }
|
241 |
-
.ui-icon-circle-close { background-position: -32px -192px; }
|
242 |
-
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
243 |
-
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
244 |
-
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
245 |
-
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
246 |
-
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
247 |
-
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
248 |
-
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
249 |
-
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
250 |
-
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
251 |
-
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
252 |
-
.ui-icon-circle-check { background-position: -208px -192px; }
|
253 |
-
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
254 |
-
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
255 |
-
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
256 |
-
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
257 |
-
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
258 |
-
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
259 |
-
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
260 |
-
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
261 |
-
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
262 |
-
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
263 |
-
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
264 |
-
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
265 |
-
|
266 |
-
|
267 |
-
/* Misc visuals
|
268 |
-
----------------------------------*/
|
269 |
-
|
270 |
-
/* Corner radius */
|
271 |
-
.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
|
272 |
-
.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
|
273 |
-
.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
|
274 |
-
.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
|
275 |
-
.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
|
276 |
-
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
|
277 |
-
.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
|
278 |
-
.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
|
279 |
-
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
|
280 |
-
|
281 |
-
/* Overlays */
|
282 |
-
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
|
283 |
-
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }/* Accordion
|
284 |
-
----------------------------------*/
|
285 |
-
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
|
286 |
-
.ui-accordion .ui-accordion-li-fix { display: inline; }
|
287 |
-
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
|
288 |
-
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
|
289 |
-
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
|
290 |
-
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
|
291 |
-
.ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker
|
292 |
-
----------------------------------*/
|
293 |
-
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
|
294 |
-
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
295 |
-
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
296 |
-
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
297 |
-
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
298 |
-
.ui-datepicker .ui-datepicker-next { right:2px; }
|
299 |
-
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
300 |
-
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
301 |
-
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
302 |
-
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
303 |
-
.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
|
304 |
-
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
305 |
-
.ui-datepicker select.ui-datepicker-month,
|
306 |
-
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
307 |
-
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
|
308 |
-
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
309 |
-
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
310 |
-
.ui-datepicker td { border: 0; padding: 1px; }
|
311 |
-
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
312 |
-
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
313 |
-
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
314 |
-
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
315 |
-
|
316 |
-
/* with multiple calendars */
|
317 |
-
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
318 |
-
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
319 |
-
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
320 |
-
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
321 |
-
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
322 |
-
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
323 |
-
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
324 |
-
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
325 |
-
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
326 |
-
.ui-datepicker-row-break { clear:both; width:100%; }
|
327 |
-
|
328 |
-
/* RTL support */
|
329 |
-
.ui-datepicker-rtl { direction: rtl; }
|
330 |
-
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
331 |
-
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
332 |
-
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
333 |
-
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
334 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
335 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
336 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
337 |
-
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
338 |
-
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
339 |
-
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
340 |
-
|
341 |
-
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
342 |
-
.ui-datepicker-cover {
|
343 |
-
display: none; /*sorry for IE5*/
|
344 |
-
display/**/: block; /*sorry for IE5*/
|
345 |
-
position: absolute; /*must have*/
|
346 |
-
z-index: -1; /*must have*/
|
347 |
-
filter: mask(); /*must have*/
|
348 |
-
top: -4px; /*must have*/
|
349 |
-
left: -4px; /*must have*/
|
350 |
-
width: 200px; /*must have*/
|
351 |
-
height: 200px; /*must have*/
|
352 |
-
}/* Dialog
|
353 |
-
----------------------------------*/
|
354 |
-
.ui-dialog { position: relative; padding: .2em; width: 300px; }
|
355 |
-
.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
|
356 |
-
.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
|
357 |
-
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
358 |
-
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
|
359 |
-
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
360 |
-
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
361 |
-
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
362 |
-
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
|
363 |
-
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
364 |
-
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
365 |
-
/* Progressbar
|
366 |
-
----------------------------------*/
|
367 |
-
.ui-progressbar { height:2em; text-align: left; }
|
368 |
-
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
|
369 |
-
----------------------------------*/
|
370 |
-
.ui-resizable { position: relative;}
|
371 |
-
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
|
372 |
-
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
373 |
-
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
|
374 |
-
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
|
375 |
-
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
|
376 |
-
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
|
377 |
-
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
378 |
-
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
379 |
-
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
380 |
-
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
|
381 |
-
----------------------------------*/
|
382 |
-
.ui-slider { position: relative; text-align: left; }
|
383 |
-
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
384 |
-
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
|
385 |
-
|
386 |
-
.ui-slider-horizontal { height: .8em; }
|
387 |
-
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
388 |
-
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
389 |
-
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
390 |
-
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
391 |
-
|
392 |
-
.ui-slider-vertical { width: .8em; height: 100px; }
|
393 |
-
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
394 |
-
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
395 |
-
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
396 |
-
.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
|
397 |
-
----------------------------------*/
|
398 |
-
.ui-tabs { padding: .2em; zoom: 1; }
|
399 |
-
.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
|
400 |
-
.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
|
401 |
-
.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
|
402 |
-
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; font-weight: 700; }
|
403 |
-
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
|
404 |
-
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
405 |
-
.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
|
406 |
-
.ui-tabs .ui-tabs-hide { display: none !important; }
|
407 |
-
|
408 |
-
/* Sub tabs
|
409 |
-
---------------------------------*/
|
410 |
-
.ui-widget-content .ui-widget-content .ui-widget-header,
|
411 |
-
.ui-widget-content .ui-widget-content .ui-state-default,
|
412 |
-
.ui-widget-content .ui-widget-content .ui-state-hover,
|
413 |
-
.ui-widget-content .ui-widget-content .ui-state-focus,
|
414 |
-
.ui-widget-content .ui-widget-content .ui-state-active { border: 0; background: none; }
|
415 |
-
|
416 |
-
.ui-widget-content .ui-widget-content .ui-state-default a,
|
417 |
-
.ui-widget-content .ui-widget-content .ui-state-default a:link,
|
418 |
-
.ui-widget-content .ui-widget-content .ui-state-default a:visited { color: #1c6280; text-decoration: none; outline: none; }
|
419 |
-
.ui-widget-content .ui-widget-content .ui-state-hover a,
|
420 |
-
.ui-widget-content .ui-widget-content .ui-state-hover a:hover { color: #d54e21; text-decoration: none; outline: none; }
|
421 |
-
.ui-widget-content .ui-widget-content .ui-state-active a,
|
422 |
-
.ui-widget-content .ui-widget-content .ui-state-active a:link,
|
423 |
-
.ui-widget-content .ui-widget-content .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; }
|
424 |
-
|
425 |
-
.ui-tabs .ui-tabs-panel .ui-tabs-nav { list-style: none; position: relative; padding: 0; }
|
426 |
-
.ui-tabs .ui-tabs-panel .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
|
427 |
-
.ui-tabs .ui-tabs-panel .ui-tabs-nav li a { color: #FF0000; float: left; text-decoration: none; padding: .5em 1em .5em 0; }
|
428 |
-
.ui-tabs .ui-tabs-panel .ui-tabs-panel { padding: 0; display: block; border-width: 0; background: none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/wp-colors-fresh/images/ui-bg_flat_0_aaaaaa_40x100.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-bg_flat_75_ffffff_40x100.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-bg_glass_55_fbf9ee_1x400.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-bg_glass_65_ffffff_1x400.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-bg_glass_75_f1f1f1_1x400.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-bg_glass_95_fef1ec_1x400.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-bg_highlight-soft_75_dfdfdf_1x100.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-icons_222222_256x240.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-icons_2e83ff_256x240.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-icons_454545_256x240.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-icons_888888_256x240.png
DELETED
Binary file
|
css/wp-colors-fresh/images/ui-icons_cd0a0a_256x240.png
DELETED
Binary file
|
css/wp-colors-fresh/wp-colors-fresh.css
DELETED
@@ -1,428 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery UI CSS Framework
|
3 |
-
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
4 |
-
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
5 |
-
*/
|
6 |
-
|
7 |
-
/* Layout helpers
|
8 |
-
----------------------------------*/
|
9 |
-
.ui-helper-hidden { display: none; }
|
10 |
-
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
|
11 |
-
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
12 |
-
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
13 |
-
.ui-helper-clearfix { display: inline-block; }
|
14 |
-
/* required comment for clearfix to work in Opera \*/
|
15 |
-
* html .ui-helper-clearfix { height:1%; }
|
16 |
-
.ui-helper-clearfix { display:block; }
|
17 |
-
/* end clearfix */
|
18 |
-
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
19 |
-
|
20 |
-
|
21 |
-
/* Interaction Cues
|
22 |
-
----------------------------------*/
|
23 |
-
.ui-state-disabled { cursor: default !important; }
|
24 |
-
|
25 |
-
|
26 |
-
/* Icons
|
27 |
-
----------------------------------*/
|
28 |
-
|
29 |
-
/* states and images */
|
30 |
-
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
31 |
-
|
32 |
-
|
33 |
-
/* Misc visuals
|
34 |
-
----------------------------------*/
|
35 |
-
|
36 |
-
/* Overlays */
|
37 |
-
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
/*
|
42 |
-
* jQuery UI CSS Framework
|
43 |
-
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
44 |
-
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
45 |
-
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=dfdfdf&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=f1f1f1&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=21759b&iconColorDefault=888888&bgColorHover=f1f1f1&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=d54e21&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
46 |
-
*/
|
47 |
-
|
48 |
-
|
49 |
-
/* Component containers
|
50 |
-
----------------------------------*/
|
51 |
-
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
|
52 |
-
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
|
53 |
-
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
|
54 |
-
.ui-widget-content a { color: #222222; }
|
55 |
-
.ui-widget-header { border: 1px solid #aaaaaa; background: #dfdfdf url(images/ui-bg_highlight-soft_75_dfdfdf_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
|
56 |
-
.ui-widget-header a { color: #222222; }
|
57 |
-
|
58 |
-
/* Interaction states
|
59 |
-
----------------------------------*/
|
60 |
-
.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3; background: #f1f1f1 url(images/ui-bg_glass_75_f1f1f1_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #21759b; outline: none; }
|
61 |
-
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #21759b; text-decoration: none; outline: none; }
|
62 |
-
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999; background: #f1f1f1 url(images/ui-bg_glass_75_f1f1f1_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #d54e21; outline: none; }
|
63 |
-
.ui-state-hover a, .ui-state-hover a:hover { color: #d54e21; text-decoration: none; outline: none; }
|
64 |
-
.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; }
|
65 |
-
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; }
|
66 |
-
|
67 |
-
/* Interaction Cues
|
68 |
-
----------------------------------*/
|
69 |
-
.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
|
70 |
-
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
|
71 |
-
.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
|
72 |
-
.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; }
|
73 |
-
.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; }
|
74 |
-
.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
75 |
-
.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
|
76 |
-
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
77 |
-
|
78 |
-
/* Icons
|
79 |
-
----------------------------------*/
|
80 |
-
|
81 |
-
/* states and images */
|
82 |
-
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
|
83 |
-
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
84 |
-
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
85 |
-
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
|
86 |
-
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
87 |
-
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
88 |
-
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
|
89 |
-
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
|
90 |
-
|
91 |
-
/* positioning */
|
92 |
-
.ui-icon-carat-1-n { background-position: 0 0; }
|
93 |
-
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
94 |
-
.ui-icon-carat-1-e { background-position: -32px 0; }
|
95 |
-
.ui-icon-carat-1-se { background-position: -48px 0; }
|
96 |
-
.ui-icon-carat-1-s { background-position: -64px 0; }
|
97 |
-
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
98 |
-
.ui-icon-carat-1-w { background-position: -96px 0; }
|
99 |
-
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
100 |
-
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
101 |
-
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
102 |
-
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
103 |
-
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
104 |
-
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
105 |
-
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
106 |
-
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
107 |
-
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
108 |
-
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
109 |
-
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
110 |
-
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
111 |
-
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
112 |
-
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
113 |
-
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
114 |
-
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
115 |
-
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
116 |
-
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
117 |
-
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
118 |
-
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
119 |
-
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
120 |
-
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
121 |
-
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
122 |
-
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
123 |
-
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
124 |
-
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
125 |
-
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
126 |
-
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
127 |
-
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
128 |
-
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
129 |
-
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
130 |
-
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
131 |
-
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
132 |
-
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
133 |
-
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
134 |
-
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
135 |
-
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
136 |
-
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
137 |
-
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
138 |
-
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
139 |
-
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
140 |
-
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
141 |
-
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
142 |
-
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
143 |
-
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
144 |
-
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
145 |
-
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
146 |
-
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
147 |
-
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
148 |
-
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
149 |
-
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
150 |
-
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
151 |
-
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
152 |
-
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
153 |
-
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
154 |
-
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
155 |
-
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
156 |
-
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
157 |
-
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
158 |
-
.ui-icon-extlink { background-position: -32px -80px; }
|
159 |
-
.ui-icon-newwin { background-position: -48px -80px; }
|
160 |
-
.ui-icon-refresh { background-position: -64px -80px; }
|
161 |
-
.ui-icon-shuffle { background-position: -80px -80px; }
|
162 |
-
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
163 |
-
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
164 |
-
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
165 |
-
.ui-icon-folder-open { background-position: -16px -96px; }
|
166 |
-
.ui-icon-document { background-position: -32px -96px; }
|
167 |
-
.ui-icon-document-b { background-position: -48px -96px; }
|
168 |
-
.ui-icon-note { background-position: -64px -96px; }
|
169 |
-
.ui-icon-mail-closed { background-position: -80px -96px; }
|
170 |
-
.ui-icon-mail-open { background-position: -96px -96px; }
|
171 |
-
.ui-icon-suitcase { background-position: -112px -96px; }
|
172 |
-
.ui-icon-comment { background-position: -128px -96px; }
|
173 |
-
.ui-icon-person { background-position: -144px -96px; }
|
174 |
-
.ui-icon-print { background-position: -160px -96px; }
|
175 |
-
.ui-icon-trash { background-position: -176px -96px; }
|
176 |
-
.ui-icon-locked { background-position: -192px -96px; }
|
177 |
-
.ui-icon-unlocked { background-position: -208px -96px; }
|
178 |
-
.ui-icon-bookmark { background-position: -224px -96px; }
|
179 |
-
.ui-icon-tag { background-position: -240px -96px; }
|
180 |
-
.ui-icon-home { background-position: 0 -112px; }
|
181 |
-
.ui-icon-flag { background-position: -16px -112px; }
|
182 |
-
.ui-icon-calendar { background-position: -32px -112px; }
|
183 |
-
.ui-icon-cart { background-position: -48px -112px; }
|
184 |
-
.ui-icon-pencil { background-position: -64px -112px; }
|
185 |
-
.ui-icon-clock { background-position: -80px -112px; }
|
186 |
-
.ui-icon-disk { background-position: -96px -112px; }
|
187 |
-
.ui-icon-calculator { background-position: -112px -112px; }
|
188 |
-
.ui-icon-zoomin { background-position: -128px -112px; }
|
189 |
-
.ui-icon-zoomout { background-position: -144px -112px; }
|
190 |
-
.ui-icon-search { background-position: -160px -112px; }
|
191 |
-
.ui-icon-wrench { background-position: -176px -112px; }
|
192 |
-
.ui-icon-gear { background-position: -192px -112px; }
|
193 |
-
.ui-icon-heart { background-position: -208px -112px; }
|
194 |
-
.ui-icon-star { background-position: -224px -112px; }
|
195 |
-
.ui-icon-link { background-position: -240px -112px; }
|
196 |
-
.ui-icon-cancel { background-position: 0 -128px; }
|
197 |
-
.ui-icon-plus { background-position: -16px -128px; }
|
198 |
-
.ui-icon-plusthick { background-position: -32px -128px; }
|
199 |
-
.ui-icon-minus { background-position: -48px -128px; }
|
200 |
-
.ui-icon-minusthick { background-position: -64px -128px; }
|
201 |
-
.ui-icon-close { background-position: -80px -128px; }
|
202 |
-
.ui-icon-closethick { background-position: -96px -128px; }
|
203 |
-
.ui-icon-key { background-position: -112px -128px; }
|
204 |
-
.ui-icon-lightbulb { background-position: -128px -128px; }
|
205 |
-
.ui-icon-scissors { background-position: -144px -128px; }
|
206 |
-
.ui-icon-clipboard { background-position: -160px -128px; }
|
207 |
-
.ui-icon-copy { background-position: -176px -128px; }
|
208 |
-
.ui-icon-contact { background-position: -192px -128px; }
|
209 |
-
.ui-icon-image { background-position: -208px -128px; }
|
210 |
-
.ui-icon-video { background-position: -224px -128px; }
|
211 |
-
.ui-icon-script { background-position: -240px -128px; }
|
212 |
-
.ui-icon-alert { background-position: 0 -144px; }
|
213 |
-
.ui-icon-info { background-position: -16px -144px; }
|
214 |
-
.ui-icon-notice { background-position: -32px -144px; }
|
215 |
-
.ui-icon-help { background-position: -48px -144px; }
|
216 |
-
.ui-icon-check { background-position: -64px -144px; }
|
217 |
-
.ui-icon-bullet { background-position: -80px -144px; }
|
218 |
-
.ui-icon-radio-off { background-position: -96px -144px; }
|
219 |
-
.ui-icon-radio-on { background-position: -112px -144px; }
|
220 |
-
.ui-icon-pin-w { background-position: -128px -144px; }
|
221 |
-
.ui-icon-pin-s { background-position: -144px -144px; }
|
222 |
-
.ui-icon-play { background-position: 0 -160px; }
|
223 |
-
.ui-icon-pause { background-position: -16px -160px; }
|
224 |
-
.ui-icon-seek-next { background-position: -32px -160px; }
|
225 |
-
.ui-icon-seek-prev { background-position: -48px -160px; }
|
226 |
-
.ui-icon-seek-end { background-position: -64px -160px; }
|
227 |
-
.ui-icon-seek-first { background-position: -80px -160px; }
|
228 |
-
.ui-icon-stop { background-position: -96px -160px; }
|
229 |
-
.ui-icon-eject { background-position: -112px -160px; }
|
230 |
-
.ui-icon-volume-off { background-position: -128px -160px; }
|
231 |
-
.ui-icon-volume-on { background-position: -144px -160px; }
|
232 |
-
.ui-icon-power { background-position: 0 -176px; }
|
233 |
-
.ui-icon-signal-diag { background-position: -16px -176px; }
|
234 |
-
.ui-icon-signal { background-position: -32px -176px; }
|
235 |
-
.ui-icon-battery-0 { background-position: -48px -176px; }
|
236 |
-
.ui-icon-battery-1 { background-position: -64px -176px; }
|
237 |
-
.ui-icon-battery-2 { background-position: -80px -176px; }
|
238 |
-
.ui-icon-battery-3 { background-position: -96px -176px; }
|
239 |
-
.ui-icon-circle-plus { background-position: 0 -192px; }
|
240 |
-
.ui-icon-circle-minus { background-position: -16px -192px; }
|
241 |
-
.ui-icon-circle-close { background-position: -32px -192px; }
|
242 |
-
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
243 |
-
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
244 |
-
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
245 |
-
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
246 |
-
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
247 |
-
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
248 |
-
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
249 |
-
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
250 |
-
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
251 |
-
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
252 |
-
.ui-icon-circle-check { background-position: -208px -192px; }
|
253 |
-
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
254 |
-
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
255 |
-
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
256 |
-
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
257 |
-
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
258 |
-
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
259 |
-
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
260 |
-
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
261 |
-
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
262 |
-
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
263 |
-
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
264 |
-
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
265 |
-
|
266 |
-
|
267 |
-
/* Misc visuals
|
268 |
-
----------------------------------*/
|
269 |
-
|
270 |
-
/* Corner radius */
|
271 |
-
.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
|
272 |
-
.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
|
273 |
-
.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
|
274 |
-
.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
|
275 |
-
.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
|
276 |
-
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
|
277 |
-
.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
|
278 |
-
.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
|
279 |
-
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
|
280 |
-
|
281 |
-
/* Overlays */
|
282 |
-
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
|
283 |
-
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }/* Accordion
|
284 |
-
----------------------------------*/
|
285 |
-
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
|
286 |
-
.ui-accordion .ui-accordion-li-fix { display: inline; }
|
287 |
-
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
|
288 |
-
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
|
289 |
-
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
|
290 |
-
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
|
291 |
-
.ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker
|
292 |
-
----------------------------------*/
|
293 |
-
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
|
294 |
-
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
295 |
-
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
296 |
-
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
297 |
-
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
298 |
-
.ui-datepicker .ui-datepicker-next { right:2px; }
|
299 |
-
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
300 |
-
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
301 |
-
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
302 |
-
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
303 |
-
.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
|
304 |
-
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
305 |
-
.ui-datepicker select.ui-datepicker-month,
|
306 |
-
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
307 |
-
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
|
308 |
-
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
309 |
-
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
310 |
-
.ui-datepicker td { border: 0; padding: 1px; }
|
311 |
-
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
312 |
-
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
313 |
-
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
314 |
-
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
315 |
-
|
316 |
-
/* with multiple calendars */
|
317 |
-
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
318 |
-
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
319 |
-
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
320 |
-
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
321 |
-
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
322 |
-
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
323 |
-
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
324 |
-
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
325 |
-
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
326 |
-
.ui-datepicker-row-break { clear:both; width:100%; }
|
327 |
-
|
328 |
-
/* RTL support */
|
329 |
-
.ui-datepicker-rtl { direction: rtl; }
|
330 |
-
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
331 |
-
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
332 |
-
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
333 |
-
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
334 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
335 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
336 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
337 |
-
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
338 |
-
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
339 |
-
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
340 |
-
|
341 |
-
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
342 |
-
.ui-datepicker-cover {
|
343 |
-
display: none; /*sorry for IE5*/
|
344 |
-
display/**/: block; /*sorry for IE5*/
|
345 |
-
position: absolute; /*must have*/
|
346 |
-
z-index: -1; /*must have*/
|
347 |
-
filter: mask(); /*must have*/
|
348 |
-
top: -4px; /*must have*/
|
349 |
-
left: -4px; /*must have*/
|
350 |
-
width: 200px; /*must have*/
|
351 |
-
height: 200px; /*must have*/
|
352 |
-
}/* Dialog
|
353 |
-
----------------------------------*/
|
354 |
-
.ui-dialog { position: relative; padding: .2em; width: 300px; }
|
355 |
-
.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
|
356 |
-
.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
|
357 |
-
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
358 |
-
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
|
359 |
-
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
360 |
-
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
361 |
-
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
362 |
-
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
|
363 |
-
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
364 |
-
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
365 |
-
/* Progressbar
|
366 |
-
----------------------------------*/
|
367 |
-
.ui-progressbar { height:2em; text-align: left; }
|
368 |
-
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
|
369 |
-
----------------------------------*/
|
370 |
-
.ui-resizable { position: relative;}
|
371 |
-
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
|
372 |
-
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
373 |
-
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
|
374 |
-
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
|
375 |
-
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
|
376 |
-
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
|
377 |
-
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
378 |
-
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
379 |
-
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
380 |
-
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
|
381 |
-
----------------------------------*/
|
382 |
-
.ui-slider { position: relative; text-align: left; }
|
383 |
-
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
384 |
-
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
|
385 |
-
|
386 |
-
.ui-slider-horizontal { height: .8em; }
|
387 |
-
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
388 |
-
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
389 |
-
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
390 |
-
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
391 |
-
|
392 |
-
.ui-slider-vertical { width: .8em; height: 100px; }
|
393 |
-
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
394 |
-
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
395 |
-
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
396 |
-
.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
|
397 |
-
----------------------------------*/
|
398 |
-
.ui-tabs { padding: .2em; zoom: 1; }
|
399 |
-
.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
|
400 |
-
.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
|
401 |
-
.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
|
402 |
-
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; font-weight: 700; }
|
403 |
-
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
|
404 |
-
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
405 |
-
.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
|
406 |
-
.ui-tabs .ui-tabs-hide { display: none !important; }
|
407 |
-
|
408 |
-
/* Sub tabs
|
409 |
-
---------------------------------*/
|
410 |
-
.ui-widget-content .ui-widget-content .ui-widget-header,
|
411 |
-
.ui-widget-content .ui-widget-content .ui-state-default,
|
412 |
-
.ui-widget-content .ui-widget-content .ui-state-hover,
|
413 |
-
.ui-widget-content .ui-widget-content .ui-state-focus,
|
414 |
-
.ui-widget-content .ui-widget-content .ui-state-active { border: 0; background: none; }
|
415 |
-
|
416 |
-
.ui-widget-content .ui-widget-content .ui-state-default a,
|
417 |
-
.ui-widget-content .ui-widget-content .ui-state-default a:link,
|
418 |
-
.ui-widget-content .ui-widget-content .ui-state-default a:visited { color: #1c6280; text-decoration: none; outline: none; }
|
419 |
-
.ui-widget-content .ui-widget-content .ui-state-hover a,
|
420 |
-
.ui-widget-content .ui-widget-content .ui-state-hover a:hover { color: #d54e21; text-decoration: none; outline: none; }
|
421 |
-
.ui-widget-content .ui-widget-content .ui-state-active a,
|
422 |
-
.ui-widget-content .ui-widget-content .ui-state-active a:link,
|
423 |
-
.ui-widget-content .ui-widget-content .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; }
|
424 |
-
|
425 |
-
.ui-tabs .ui-tabs-panel .ui-tabs-nav { list-style: none; position: relative; padding: 0; }
|
426 |
-
.ui-tabs .ui-tabs-panel .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
|
427 |
-
.ui-tabs .ui-tabs-panel .ui-tabs-nav li a { color: #FF0000; float: left; text-decoration: none; padding: .5em 1em .5em 0; }
|
428 |
-
.ui-tabs .ui-tabs-panel .ui-tabs-panel { padding: 0; display: block; border-width: 0; background: none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
images/add.gif
DELETED
Binary file
|
images/remove.gif
DELETED
Binary file
|
includes/class.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists('Theme_My_Login') ) :
|
4 |
+
class Theme_My_Login {
|
5 |
+
var $options;
|
6 |
+
var $errors;
|
7 |
+
var $request_action;
|
8 |
+
var $request_instance;
|
9 |
+
var $current_instance;
|
10 |
+
var $count;
|
11 |
+
var $redirect_to;
|
12 |
+
|
13 |
+
function get_new_instance() {
|
14 |
+
++$this->count;
|
15 |
+
return 'tml-' . $this->count;
|
16 |
+
}
|
17 |
+
|
18 |
+
function update_option() {
|
19 |
+
$args = func_get_args();
|
20 |
+
if ( !is_array($args) )
|
21 |
+
return false;
|
22 |
+
|
23 |
+
$value = array_shift($args);
|
24 |
+
|
25 |
+
$option =& $this->options;
|
26 |
+
foreach ( $args as $arg ) {
|
27 |
+
$option =& $option[$arg];
|
28 |
+
}
|
29 |
+
$option = $value;
|
30 |
+
return true;
|
31 |
+
}
|
32 |
+
|
33 |
+
function delete_option() {
|
34 |
+
$args = func_get_args();
|
35 |
+
if ( !is_array($args) )
|
36 |
+
return false;
|
37 |
+
|
38 |
+
$option = 'options';
|
39 |
+
foreach ( $args as $arg ) {
|
40 |
+
$option .= "['$arg']";
|
41 |
+
}
|
42 |
+
eval("unset(\$this->{$option});");
|
43 |
+
return true;
|
44 |
+
}
|
45 |
+
|
46 |
+
function get_option() {
|
47 |
+
$args = func_get_args();
|
48 |
+
if ( !is_array($args) )
|
49 |
+
return false;
|
50 |
+
|
51 |
+
$option = $this->options;
|
52 |
+
foreach ( $args as $arg ) {
|
53 |
+
if ( !isset($option[$arg]) )
|
54 |
+
return false;
|
55 |
+
$option = $option[$arg];
|
56 |
+
}
|
57 |
+
return $option;
|
58 |
+
}
|
59 |
+
|
60 |
+
function save_options() {
|
61 |
+
return update_option('theme_my_login', $this->options);
|
62 |
+
}
|
63 |
+
|
64 |
+
function set_error($code = '', $error = '', $data = '') {
|
65 |
+
if ( empty($code) )
|
66 |
+
$this->errors = new WP_Error();
|
67 |
+
elseif ( is_a($code, 'WP_Error') )
|
68 |
+
$this->errors = $code;
|
69 |
+
elseif ( is_a($this->errors, 'WP_Error') )
|
70 |
+
$this->errors->add($code, $error, $data);
|
71 |
+
else
|
72 |
+
$this->errors = new WP_Error($code, $error, $data);
|
73 |
+
}
|
74 |
+
|
75 |
+
function get_error($code = '') {
|
76 |
+
if ( is_a($this->errors, 'WP_Error') )
|
77 |
+
return $this->errors->get_error_message($code);
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
function set_var() {
|
82 |
+
$args = func_get_args();
|
83 |
+
if ( !is_array($args) || count($args) < 2 )
|
84 |
+
return false;
|
85 |
+
|
86 |
+
$value = array_shift($args);
|
87 |
+
$key = array_shift($args);
|
88 |
+
|
89 |
+
$option = $key;
|
90 |
+
foreach ( $args as $arg ) {
|
91 |
+
$option .= "['$arg']";
|
92 |
+
}
|
93 |
+
eval("\$this->{$option} = \$value;");
|
94 |
+
return true;
|
95 |
+
}
|
96 |
+
|
97 |
+
function get_var() {
|
98 |
+
$args = func_get_args();
|
99 |
+
if ( !is_array($args) )
|
100 |
+
return false;
|
101 |
+
|
102 |
+
$key = array_shift($args);
|
103 |
+
if ( !isset($this->{$key}) )
|
104 |
+
return false;
|
105 |
+
|
106 |
+
$option = $this->{$key};
|
107 |
+
foreach ( $args as $arg ) {
|
108 |
+
if ( !isset($option[$arg]) )
|
109 |
+
return $option;
|
110 |
+
$option = $option[$arg];
|
111 |
+
}
|
112 |
+
return $option;
|
113 |
+
}
|
114 |
+
|
115 |
+
function default_options() {
|
116 |
+
$options = array(
|
117 |
+
'show_page' => 1,
|
118 |
+
'rewrite_links' => 1,
|
119 |
+
'enable_css' => 1,
|
120 |
+
'enable_template_tag' => 0,
|
121 |
+
'enable_widget' => 0,
|
122 |
+
'active_modules' => array()
|
123 |
+
);
|
124 |
+
return apply_filters('tml_default_option', $options);
|
125 |
+
}
|
126 |
+
|
127 |
+
function __construct() {
|
128 |
+
$this->options = get_option('theme_my_login', self::default_options());
|
129 |
+
$this->request_action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
|
130 |
+
$this->request_instance = isset($_REQUEST['instance']) ? $_REQUEST['instance'] : 'tml-page';
|
131 |
+
$this->count = 0;
|
132 |
+
}
|
133 |
+
|
134 |
+
function Theme_My_Login() {
|
135 |
+
self::__construct;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
endif;
|
139 |
+
|
140 |
+
?>
|
includes/functions.php
CHANGED
@@ -1,306 +1,104 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
*
|
8 |
-
* @return bool|WP_Error True: when finish. WP_Error on error
|
9 |
-
*/
|
10 |
-
function retrieve_password() {
|
11 |
-
global $wpdb, $ThemeMyLogin;
|
12 |
-
|
13 |
-
$errors = new WP_Error();
|
14 |
-
|
15 |
-
if ( empty( $_POST['user_login'] ) && empty( $_POST['user_email'] ) )
|
16 |
-
$errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
|
17 |
-
|
18 |
-
if ( strpos($_POST['user_login'], '@') ) {
|
19 |
-
$user_data = get_user_by_email(trim($_POST['user_login']));
|
20 |
-
if ( empty($user_data) )
|
21 |
-
$errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
|
22 |
-
} else {
|
23 |
-
$login = trim($_POST['user_login']);
|
24 |
-
$user_data = get_userdatabylogin($login);
|
25 |
-
}
|
26 |
-
|
27 |
-
do_action('lostpassword_post');
|
28 |
-
|
29 |
-
if ( $errors->get_error_code() )
|
30 |
-
return $errors;
|
31 |
-
|
32 |
-
if ( !$user_data ) {
|
33 |
-
$errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.'));
|
34 |
-
return $errors;
|
35 |
-
}
|
36 |
-
|
37 |
-
// redefining user_login ensures we return the right case in the email
|
38 |
-
$user_login = $user_data->user_login;
|
39 |
-
$user_email = $user_data->user_email;
|
40 |
-
|
41 |
-
do_action('retreive_password', $user_login); // Misspelled and deprecated
|
42 |
-
do_action('retrieve_password', $user_login);
|
43 |
-
|
44 |
-
$allow = apply_filters('allow_password_reset', true, $user_data->ID);
|
45 |
-
|
46 |
-
if ( ! $allow )
|
47 |
-
return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
|
48 |
-
else if ( is_wp_error($allow) )
|
49 |
-
return $allow;
|
50 |
-
|
51 |
-
$key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login));
|
52 |
-
if ( empty($key) ) {
|
53 |
-
// Generate something random for a key...
|
54 |
-
$key = wp_generate_password(20, false);
|
55 |
-
do_action('retrieve_password_key', $user_login, $key);
|
56 |
-
// Now insert the new md5 key into the db
|
57 |
-
$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
|
58 |
-
}
|
59 |
-
|
60 |
-
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
61 |
-
// we want to reverse this for the plain text arena of emails.
|
62 |
-
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
63 |
-
|
64 |
-
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%reseturl%/', '/%user_login%/', '/%user_email%/', '/%key%/', '/%user_ip%/');
|
65 |
-
$replace_with = array($blogname, get_option('siteurl'), site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login'), $user_login, $user_email, $key, $_SERVER['REMOTE_ADDR']);
|
66 |
-
$title = $ThemeMyLogin->options['retrieve_pass_email']['subject'];
|
67 |
-
$message = $ThemeMyLogin->options['retrieve_pass_email']['message'];
|
68 |
-
|
69 |
-
if ( !empty($title) )
|
70 |
-
$title = preg_replace($replace_this, $replace_with, $title);
|
71 |
-
else
|
72 |
-
$title = sprintf(__('[%s] Password Reset', 'theme-my-login'), $blogname);
|
73 |
-
|
74 |
-
if ( !empty($message) )
|
75 |
-
$message = preg_replace($replace_this, $replace_with, $message);
|
76 |
-
else {
|
77 |
-
$message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
|
78 |
-
$message .= get_option('siteurl') . "\r\n\r\n";
|
79 |
-
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
80 |
-
$message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
|
81 |
-
$message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
|
82 |
-
}
|
83 |
-
|
84 |
-
$title = apply_filters('retrieve_password_title', $title);
|
85 |
-
$message = apply_filters('retrieve_password_message', $message, $key);
|
86 |
-
|
87 |
-
if ( $message && !$ThemeMyLogin->sendEmail($user_email, $title, $message) )
|
88 |
-
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
89 |
-
|
90 |
-
return true;
|
91 |
}
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
*
|
98 |
-
* @param string $key Hash to validate sending user's password
|
99 |
-
* @return bool|WP_Error
|
100 |
-
*/
|
101 |
-
function reset_password($key, $login) {
|
102 |
-
global $wpdb, $ThemeMyLogin;
|
103 |
-
|
104 |
-
$key = preg_replace('/[^a-z0-9]/i', '', $key);
|
105 |
-
|
106 |
-
if ( empty( $key ) || !is_string( $key ) )
|
107 |
-
return new WP_Error('invalid_key', __('Invalid key'));
|
108 |
-
|
109 |
-
if ( empty($login) || !is_string($login) )
|
110 |
-
return new WP_Error('invalid_key', __('Invalid key'));
|
111 |
-
|
112 |
-
$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login));
|
113 |
-
if ( empty( $user ) )
|
114 |
-
return new WP_Error('invalid_key', __('Invalid key'));
|
115 |
-
|
116 |
-
// Generate something random for a password...
|
117 |
-
$new_pass = wp_generate_password();
|
118 |
-
|
119 |
-
do_action('password_reset', $user, $new_pass);
|
120 |
-
|
121 |
-
wp_set_password($new_pass, $user->ID);
|
122 |
-
update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
|
123 |
-
|
124 |
-
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
125 |
-
// we want to reverse this for the plain text arena of emails.
|
126 |
-
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
127 |
-
|
128 |
-
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_pass%/', '/%user_ip%/');
|
129 |
-
$replace_with = array($blogname, get_option('siteurl'), $user->user_login, $user->user_email, $new_pass, $_SERVER['REMOTE_ADDR']);
|
130 |
-
$title = $ThemeMyLogin->options['reset_pass_email']['subject'];
|
131 |
-
$message = $ThemeMyLogin->options['reset_pass_email']['message'];
|
132 |
-
|
133 |
-
if ( !empty($title) )
|
134 |
-
$title = preg_replace($replace_this, $replace_with, $title);
|
135 |
-
else
|
136 |
-
$title = sprintf(__('[%s] Your new password'), $blogname);
|
137 |
-
|
138 |
-
if ( !empty($message) )
|
139 |
-
$message = preg_replace($replace_this, $replace_with, $message);
|
140 |
-
else {
|
141 |
-
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
|
142 |
-
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
|
143 |
-
$message .= site_url('wp-login.php', 'login') . "\r\n";
|
144 |
-
}
|
145 |
-
|
146 |
-
$title = apply_filters('password_reset_title', $title);
|
147 |
-
$message = apply_filters('password_reset_message', $message, $new_pass);
|
148 |
-
|
149 |
-
if ( $message && !$ThemeMyLogin->sendEmail($user->user_email, $title, $message) )
|
150 |
-
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
151 |
-
|
152 |
-
if ( !$ThemeMyLogin->options['reset_pass_email']['admin_disable'] )
|
153 |
-
wp_password_change_notification($user);
|
154 |
-
|
155 |
-
return true;
|
156 |
}
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
* @param string $user_email User's email address to send password and add
|
163 |
-
* @return int|WP_Error Either user's ID or error on failure.
|
164 |
-
*/
|
165 |
-
function register_new_user($user_login, $user_email) {
|
166 |
-
$errors = new WP_Error();
|
167 |
-
|
168 |
-
$user_login = sanitize_user( $user_login );
|
169 |
-
$user_email = apply_filters( 'user_registration_email', $user_email );
|
170 |
-
|
171 |
-
// Check the username
|
172 |
-
if ( $user_login == '' )
|
173 |
-
$errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
|
174 |
-
elseif ( !validate_username( $user_login ) ) {
|
175 |
-
$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.'));
|
176 |
-
$user_login = '';
|
177 |
-
} elseif ( username_exists( $user_login ) )
|
178 |
-
$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
|
179 |
-
|
180 |
-
// Check the e-mail address
|
181 |
-
if ($user_email == '') {
|
182 |
-
$errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.'));
|
183 |
-
} elseif ( !is_email( $user_email ) ) {
|
184 |
-
$errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.'));
|
185 |
-
$user_email = '';
|
186 |
-
} elseif ( email_exists( $user_email ) )
|
187 |
-
$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
|
188 |
-
|
189 |
-
do_action('register_post', $user_login, $user_email, $errors);
|
190 |
-
|
191 |
-
$errors = apply_filters( 'registration_errors', $errors, $user_login, $user_email );
|
192 |
-
|
193 |
-
if ( $errors->get_error_code() )
|
194 |
-
return $errors;
|
195 |
-
|
196 |
-
$user_pass = wp_generate_password();
|
197 |
-
$user_id = wp_create_user( $user_login, $user_pass, $user_email );
|
198 |
-
if ( !$user_id ) {
|
199 |
-
$errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')));
|
200 |
-
return $errors;
|
201 |
-
}
|
202 |
-
|
203 |
-
wp_new_user_notification($user_id, $user_pass);
|
204 |
-
|
205 |
-
return $user_id;
|
206 |
}
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
* @param string $login User's username for logging in
|
213 |
-
* @param bool $newpass Whether or not to assign a new password
|
214 |
-
* @return bool|WP_Error
|
215 |
-
*/
|
216 |
-
function activate_new_user($key, $login, $newpass = false) {
|
217 |
-
global $wpdb;
|
218 |
|
219 |
-
|
|
|
|
|
|
|
220 |
|
221 |
-
|
222 |
-
|
|
|
|
|
223 |
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
$wpdb->update($wpdb->users, array('user_activation_key' => ''), array('user_login' => $login) );
|
232 |
-
|
233 |
-
$user_object = new WP_User($user->ID);
|
234 |
-
$user_object->set_role(get_option('default_role'));
|
235 |
-
unset($user_object);
|
236 |
-
|
237 |
-
$pass = __('Same as when you signed up.', 'theme-my-login');
|
238 |
-
if ( $newpass ) {
|
239 |
-
$pass = wp_generate_password();
|
240 |
-
wp_set_password($pass, $user->ID);
|
241 |
-
}
|
242 |
-
|
243 |
-
wp_new_user_notification($user->ID, $pass);
|
244 |
-
|
245 |
-
return true;
|
246 |
}
|
247 |
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
* @param bool $newpass Whether or not to assign a new password
|
253 |
-
* @return bool Returns false if not a valid user
|
254 |
-
*/
|
255 |
-
function approve_new_user($id, $newpass = false) {
|
256 |
-
global $wpdb, $ThemeMyLogin;
|
257 |
-
|
258 |
-
$id = (int) $id;
|
259 |
-
|
260 |
-
$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE ID = %d", $id));
|
261 |
-
if ( empty( $user ) )
|
262 |
-
return false;
|
263 |
|
264 |
-
|
|
|
|
|
265 |
|
266 |
-
$
|
267 |
-
$
|
268 |
-
unset($user_object);
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
$
|
273 |
-
wp_set_password($pass, $user->ID);
|
274 |
}
|
275 |
-
|
276 |
-
|
277 |
-
// we want to reverse this for the plain text arena of emails.
|
278 |
-
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
279 |
-
|
280 |
-
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_pass%/');
|
281 |
-
$replace_with = array($blogname, get_option('siteurl'), $user->user_login, $user->user_email, $pass);
|
282 |
-
$subject = $ThemeMyLogin->options['user_approval_email']['subject'];
|
283 |
-
$message = $ThemeMyLogin->options['user_approval_email']['message'];
|
284 |
|
285 |
-
|
286 |
-
|
|
|
|
|
|
|
287 |
else
|
288 |
-
$
|
289 |
-
|
290 |
-
if ( !empty($message) )
|
291 |
-
$message = preg_replace($replace_this, $replace_with, $message);
|
292 |
-
else {
|
293 |
-
$message = sprintf(__('You have been approved access to %s', 'theme-my-login'), $blogname) . "\r\n\r\n";
|
294 |
-
$message .= sprintf(__('Username: %s', 'theme-my-login'), $user->user_login) . "\r\n";
|
295 |
-
$message .= sprintf(__('Password: %s', 'theme-my-login'), $pass) . "\r\n";
|
296 |
-
$message .= "\r\n";
|
297 |
-
$message .= site_url('wp-login.php', 'login') . "\r\n";
|
298 |
-
}
|
299 |
-
$ThemeMyLogin->sendEmail($user->user_email, $subject, $message);
|
300 |
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
|
303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
}
|
305 |
|
306 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
function wdbj_tml_update_option() {
|
4 |
+
global $theme_my_login;
|
5 |
+
$args = func_get_args();
|
6 |
+
return call_user_func_array(array($theme_my_login, 'update_option'), $args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
}
|
8 |
|
9 |
+
function wdbj_tml_delete_option() {
|
10 |
+
global $theme_my_login;
|
11 |
+
$args = func_get_args();
|
12 |
+
return call_user_func_array(array($theme_my_login, 'delete_option'), $args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
|
15 |
+
function wdbj_tml_get_option() {
|
16 |
+
global $theme_my_login;
|
17 |
+
$args = func_get_args();
|
18 |
+
return call_user_func_array(array($theme_my_login, 'get_option'), $args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
+
function wdbj_tml_save_options() {
|
22 |
+
global $theme_my_login;
|
23 |
+
return $theme_my_login->save_options();
|
24 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
function wdbj_tml_set_error($code = '', $error = '', $data = '') {
|
27 |
+
global $theme_my_login;
|
28 |
+
return $theme_my_login->set_error($code, $error, $data);
|
29 |
+
}
|
30 |
|
31 |
+
function wdbj_tml_get_error($code = '') {
|
32 |
+
global $theme_my_login;
|
33 |
+
return $theme_my_login->get_error($code);
|
34 |
+
}
|
35 |
|
36 |
+
function wdbj_tml_get_var() {
|
37 |
+
global $theme_my_login;
|
38 |
+
$args = func_get_args();
|
39 |
+
return call_user_func_array(array($theme_my_login, 'get_var'), $args);
|
40 |
+
}
|
41 |
|
42 |
+
function wdbj_tml_set_var() {
|
43 |
+
global $theme_my_login;
|
44 |
+
$args = func_get_args();
|
45 |
+
return call_user_func_array(array($theme_my_login, 'set_var'), $args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
+
function wdbj_tml_get_new_instance() {
|
49 |
+
global $theme_my_login;
|
50 |
+
return $theme_my_login->get_new_instance();
|
51 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
function wdbj_tml_get_current_url($query = '') {
|
54 |
+
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
55 |
+
$self = $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
56 |
|
57 |
+
$keys = array('instance', 'action', 'checkemail', 'error', 'loggedout', 'registered', 'redirect_to', 'updated', 'key', '_wpnonce');
|
58 |
+
$url = remove_query_arg($keys, $self);
|
|
|
59 |
|
60 |
+
if ( !empty($query) ) {
|
61 |
+
$query = wp_parse_args($query);
|
62 |
+
$url = add_query_arg($query, $url);
|
|
|
63 |
}
|
64 |
+
return $url;
|
65 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
function wdbj_tml_get_css($file = 'theme-my-login.css') {
|
68 |
+
if ( file_exists(get_stylesheet_directory() . "/$file") )
|
69 |
+
$css_file = get_stylesheet_directory_uri() . "/$file";
|
70 |
+
elseif ( file_exists(get_template_directory() . "/$file") )
|
71 |
+
$css_file = get_template_directory_uri() . "/$file";
|
72 |
else
|
73 |
+
$css_file = plugins_url("/theme-my-login/$file");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
wp_enqueue_style('theme-my-login', $css_file);
|
76 |
+
}
|
77 |
+
|
78 |
+
function wdbj_tml_is_module_active($module) {
|
79 |
+
$modules = apply_filters('tml_active_modules', wdbj_tml_get_option('active_modules'));
|
80 |
+
return in_array($module, $modules);
|
81 |
+
}
|
82 |
|
83 |
+
function wdbj_tml_load_active_modules() {
|
84 |
+
$modules = apply_filters('tml_active_modules', wdbj_tml_get_option('active_modules'));
|
85 |
+
if ( is_array($modules) ) {
|
86 |
+
foreach ( $modules as $module ) {
|
87 |
+
// check the $plugin filename
|
88 |
+
// Validate plugin filename
|
89 |
+
if ( validate_file($module) // $module must validate as file
|
90 |
+
|| '.php' != substr($module, -4) // $module must end with '.php'
|
91 |
+
|| !file_exists(TML_MODULE_DIR . '/' . $module) // $module must exist
|
92 |
+
)
|
93 |
+
continue;
|
94 |
+
|
95 |
+
include_once(TML_MODULE_DIR . '/' . $module);
|
96 |
+
}
|
97 |
+
unset($module);
|
98 |
+
}
|
99 |
+
unset($modules);
|
100 |
+
|
101 |
+
do_action('tml_modules_loaded');
|
102 |
}
|
103 |
|
104 |
?>
|
includes/hook-functions.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_the_title($title, $post_id = '') {
|
4 |
+
$tml_page = wdbj_tml_get_option('page_id');
|
5 |
+
if ( is_admin() && ! is_page($tml_page) )
|
6 |
+
return $title;
|
7 |
+
if ( $tml_page == $post_id ) {
|
8 |
+
require_once (WP_PLUGIN_DIR . '/theme-my-login/includes/template-functions.php');
|
9 |
+
$action = ( 'tml-page' == wdbj_tml_get_var('request_instance') ) ? wdbj_tml_get_var('request_action') : 'login';
|
10 |
+
$title = wdbj_tml_get_title($action);
|
11 |
+
}
|
12 |
+
return $title;
|
13 |
+
}
|
14 |
+
|
15 |
+
function wdbj_tml_single_post_title($title) {
|
16 |
+
if ( is_page(wdbj_tml_get_option('page_id')) ) {
|
17 |
+
require_once (WP_PLUGIN_DIR . '/theme-my-login/includes/template-functions.php');
|
18 |
+
$action = ( 'tml-page' == wdbj_tml_get_var('request_instance') ) ? wdbj_tml_get_var('request_action') : 'login';
|
19 |
+
$title = wdbj_tml_get_title($action);
|
20 |
+
}
|
21 |
+
return $title;
|
22 |
+
}
|
23 |
+
|
24 |
+
function wdbj_tml_site_url($url, $path, $orig_scheme) {
|
25 |
+
if ( strpos($url, 'wp-login.php') !== false && !isset($_REQUEST['interim-login']) ) {
|
26 |
+
$orig_url = $url;
|
27 |
+
$url = get_permalink(wdbj_tml_get_option('page_id'));
|
28 |
+
if ( strpos($orig_url, '?') ) {
|
29 |
+
$query = substr($orig_url, strpos($orig_url, '?') + 1);
|
30 |
+
parse_str($query, $r);
|
31 |
+
$url = add_query_arg($r, $url);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
return $url;
|
35 |
+
}
|
36 |
+
|
37 |
+
function wdbj_tml_list_pages_excludes($exclude_array) {
|
38 |
+
if ( !wdbj_tml_get_option('show_page') )
|
39 |
+
$exclude_array[] = wdbj_tml_get_option('page_id');
|
40 |
+
return $exclude_array;
|
41 |
+
}
|
42 |
+
|
43 |
+
function wdbj_tml_page_link($link, $id) {
|
44 |
+
if ( $id == wdbj_tml_get_option('page_id') ) {
|
45 |
+
if ( is_user_logged_in() )
|
46 |
+
$link = wp_nonce_url(add_query_arg('action', 'logout', $link), 'log-out');
|
47 |
+
}
|
48 |
+
return $link;
|
49 |
+
}
|
50 |
+
|
51 |
+
function wdbj_tml_get_pages($pages, $attributes) {
|
52 |
+
$tml_page = wdbj_tml_get_option('page_id');
|
53 |
+
if ( is_admin() && ! is_page($tml_page) )
|
54 |
+
return $pages;
|
55 |
+
|
56 |
+
// Change to logout link if user is logged in
|
57 |
+
add_filter('page_link', 'wdbj_tml_page_link', 10, 2);
|
58 |
+
|
59 |
+
// It sucks there's not really a better way to do this
|
60 |
+
if ( wdbj_tml_get_option('show_page') ) {
|
61 |
+
foreach ( $pages as $page ) {
|
62 |
+
if ( $page->ID == $tml_page ) {
|
63 |
+
if ( is_user_logged_in() )
|
64 |
+
$page->post_title = __('Log out');
|
65 |
+
else
|
66 |
+
$page->post_title = __('Log In');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
return $pages;
|
71 |
+
}
|
72 |
+
|
73 |
+
function wdbj_tml_shortcode($atts = '') {
|
74 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/template-functions.php' );
|
75 |
+
|
76 |
+
if ( empty($atts['instance_id']) )
|
77 |
+
$atts['instance_id'] = wdbj_tml_get_new_instance();
|
78 |
+
|
79 |
+
if ( wdbj_tml_get_var('request_instance') == $atts['instance_id'] )
|
80 |
+
$atts['is_active'] = 1;
|
81 |
+
|
82 |
+
wdbj_tml_set_var(shortcode_atts(wdbj_tml_get_display_options(), $atts), 'current_instance');
|
83 |
+
return wdbj_tml_display();
|
84 |
+
}
|
85 |
+
|
86 |
+
?>
|
includes/login-actions.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$instance = wdbj_tml_get_var('request_instance');
|
4 |
+
$action = wdbj_tml_get_var('request_action');
|
5 |
+
|
6 |
+
//Set a cookie now to see if they are supported by the browser.
|
7 |
+
setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
|
8 |
+
if ( SITECOOKIEPATH != COOKIEPATH )
|
9 |
+
setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
|
10 |
+
|
11 |
+
// allow plugins to override the default actions, and to add extra actions if they want
|
12 |
+
if ( has_filter('login_action_' . $action) ) :
|
13 |
+
|
14 |
+
do_action('login_action_' . $action, $instance);
|
15 |
+
|
16 |
+
else :
|
17 |
+
|
18 |
+
$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
|
19 |
+
switch ( $action ) {
|
20 |
+
case 'logout' :
|
21 |
+
check_admin_referer('log-out');
|
22 |
+
|
23 |
+
$user = wp_get_current_user();
|
24 |
+
|
25 |
+
$redirect_to = site_url('wp-login.php?loggedout=true');
|
26 |
+
$redirect_to = apply_filters('logout_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
|
27 |
+
|
28 |
+
wp_logout();
|
29 |
+
|
30 |
+
wp_safe_redirect($redirect_to);
|
31 |
+
exit();
|
32 |
+
break;
|
33 |
+
case 'lostpassword' :
|
34 |
+
case 'retrievepassword' :
|
35 |
+
if ( $http_post ) {
|
36 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/login-functions.php' );
|
37 |
+
$errors = retrieve_password();
|
38 |
+
if ( !is_wp_error($errors) ) {
|
39 |
+
$redirect_to = site_url('wp-login.php?checkemail=confirm');
|
40 |
+
if ( 'tml-page' != $instance )
|
41 |
+
$redirect_to = wdbj_tml_get_current_url('checkemail=confirm&instance=' . $instance);
|
42 |
+
wp_redirect($redirect_to);
|
43 |
+
exit();
|
44 |
+
} else wdbj_tml_set_error($errors);
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( isset($_REQUEST['error']) && 'invalidkey' == $_REQUEST['error'] )
|
48 |
+
wdbj_tml_set_error('invalidkey', __('Sorry, that key does not appear to be valid.'));
|
49 |
+
break;
|
50 |
+
case 'resetpass' :
|
51 |
+
case 'rp' :
|
52 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/login-functions.php' );
|
53 |
+
$errors = reset_password($_GET['key'], $_GET['login']);
|
54 |
+
|
55 |
+
if ( !is_wp_error($errors) ) {
|
56 |
+
$redirect_to = site_url('wp-login.php?checkemail=newpass');
|
57 |
+
if ( 'tml-page' != $instance )
|
58 |
+
$redirect_to = wdbj_tml_get_current_url('checkemail=newpass&instance=' . $instance);
|
59 |
+
$redirect_to = apply_filters('resetpass_redirect', $redirect_to);
|
60 |
+
wp_redirect($redirect_to);
|
61 |
+
exit();
|
62 |
+
} else wdbj_tml_set_error($errors);
|
63 |
+
|
64 |
+
$redirect_to = site_url('wp-login.php?action=lostpassword&error=invalidkey');
|
65 |
+
if ( 'tml-page' != $instance )
|
66 |
+
$redirect_to = wdbj_tml_get_current_url('action=lostpassword&error=invalidkey&instance=' . $instance);
|
67 |
+
wp_redirect($redirect_to);
|
68 |
+
exit();
|
69 |
+
break;
|
70 |
+
case 'register' :
|
71 |
+
if ( !get_option('users_can_register') ) {
|
72 |
+
wp_redirect(wdbj_tml_get_current_url('registration=disabled'));
|
73 |
+
exit();
|
74 |
+
}
|
75 |
+
|
76 |
+
$user_login = '';
|
77 |
+
$user_email = '';
|
78 |
+
$user_pass = '';
|
79 |
+
if ( $http_post ) {
|
80 |
+
require_once( ABSPATH . WPINC . '/registration.php' );
|
81 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/login-functions.php' );
|
82 |
+
|
83 |
+
$user_login = $_POST['user_login'];
|
84 |
+
$user_email = $_POST['user_email'];
|
85 |
+
|
86 |
+
$errors = register_new_user($user_login, $user_email);
|
87 |
+
if ( !is_wp_error($errors) ) {
|
88 |
+
$redirect_to = site_url('wp-login.php?checkemail=registered');
|
89 |
+
if ( 'tml-page' != $instance )
|
90 |
+
$redirect_to = wdbj_tml_get_current_url('checkemail=registered&instance=' . $instance);
|
91 |
+
$redirect_to = apply_filters('register_redirect', $redirect_to);
|
92 |
+
wp_redirect($redirect_to);
|
93 |
+
exit();
|
94 |
+
} else wdbj_tml_set_error($errors);
|
95 |
+
}
|
96 |
+
break;
|
97 |
+
case 'login' :
|
98 |
+
default:
|
99 |
+
$secure_cookie = '';
|
100 |
+
|
101 |
+
// If the user wants ssl but the session is not ssl, force a secure cookie.
|
102 |
+
if ( !empty($_POST['log']) && !force_ssl_admin() ) {
|
103 |
+
$user_name = sanitize_user($_POST['log']);
|
104 |
+
if ( $user = get_userdatabylogin($user_name) ) {
|
105 |
+
if ( get_user_option('use_ssl', $user->ID) ) {
|
106 |
+
$secure_cookie = true;
|
107 |
+
force_ssl_admin(true);
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( isset($_REQUEST['redirect_to']) && !empty($_REQUEST['redirect_to']) ) {
|
113 |
+
$redirect_to = $_REQUEST['redirect_to'];
|
114 |
+
// Redirect to https if user wants ssl
|
115 |
+
if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
|
116 |
+
$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
117 |
+
} else {
|
118 |
+
$redirect_to = admin_url();
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
|
122 |
+
$secure_cookie = false;
|
123 |
+
|
124 |
+
$user = wp_signon('', $secure_cookie);
|
125 |
+
|
126 |
+
$redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
|
127 |
+
|
128 |
+
wdbj_tml_set_var($redirect_to, 'redirect_to');
|
129 |
+
|
130 |
+
if ( !is_wp_error($user) ) {
|
131 |
+
// If the user can't edit posts, send them to their profile.
|
132 |
+
if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
|
133 |
+
$redirect_to = admin_url('profile.php');
|
134 |
+
wp_safe_redirect($redirect_to);
|
135 |
+
exit();
|
136 |
+
}
|
137 |
+
|
138 |
+
wdbj_tml_set_error($user);
|
139 |
+
break;
|
140 |
+
}
|
141 |
+
|
142 |
+
endif;
|
143 |
+
|
144 |
+
?>
|
includes/login-functions.php
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles sending password retrieval email to user.
|
5 |
+
*
|
6 |
+
* @uses $wpdb WordPress Database object
|
7 |
+
*
|
8 |
+
* @return bool|WP_Error True: when finish. WP_Error on error
|
9 |
+
*/
|
10 |
+
function retrieve_password() {
|
11 |
+
global $wpdb;
|
12 |
+
|
13 |
+
$errors = new WP_Error();
|
14 |
+
|
15 |
+
if ( empty( $_POST['user_login'] ) && empty( $_POST['user_email'] ) )
|
16 |
+
$errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
|
17 |
+
|
18 |
+
if ( strpos($_POST['user_login'], '@') ) {
|
19 |
+
$user_data = get_user_by_email(trim($_POST['user_login']));
|
20 |
+
if ( empty($user_data) )
|
21 |
+
$errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
|
22 |
+
} else {
|
23 |
+
$login = trim($_POST['user_login']);
|
24 |
+
$user_data = get_userdatabylogin($login);
|
25 |
+
}
|
26 |
+
|
27 |
+
do_action('lostpassword_post');
|
28 |
+
|
29 |
+
if ( $errors->get_error_code() )
|
30 |
+
return $errors;
|
31 |
+
|
32 |
+
if ( !$user_data ) {
|
33 |
+
$errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.'));
|
34 |
+
return $errors;
|
35 |
+
}
|
36 |
+
|
37 |
+
// redefining user_login ensures we return the right case in the email
|
38 |
+
$user_login = $user_data->user_login;
|
39 |
+
$user_email = $user_data->user_email;
|
40 |
+
|
41 |
+
do_action('retreive_password', $user_login); // Misspelled and deprecated
|
42 |
+
do_action('retrieve_password', $user_login);
|
43 |
+
|
44 |
+
$allow = apply_filters('allow_password_reset', true, $user_data->ID);
|
45 |
+
|
46 |
+
if ( ! $allow )
|
47 |
+
return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
|
48 |
+
else if ( is_wp_error($allow) )
|
49 |
+
return $allow;
|
50 |
+
|
51 |
+
$key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login));
|
52 |
+
if ( empty($key) ) {
|
53 |
+
// Generate something random for a key...
|
54 |
+
$key = wp_generate_password(20, false);
|
55 |
+
do_action('retrieve_password_key', $user_login, $key);
|
56 |
+
// Now insert the new md5 key into the db
|
57 |
+
$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
|
58 |
+
}
|
59 |
+
$message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
|
60 |
+
$message .= get_option('siteurl') . "\r\n\r\n";
|
61 |
+
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
62 |
+
$message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
|
63 |
+
$message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
|
64 |
+
|
65 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
66 |
+
// we want to reverse this for the plain text arena of emails.
|
67 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
68 |
+
|
69 |
+
$title = sprintf(__('[%s] Password Reset'), $blogname);
|
70 |
+
|
71 |
+
$title = apply_filters('retrieve_password_title', $title, $user_data->ID);
|
72 |
+
$message = apply_filters('retrieve_password_message', $message, $key, $user_data->ID);
|
73 |
+
|
74 |
+
if ( $message && !wp_mail($user_email, $title, $message) )
|
75 |
+
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
76 |
+
|
77 |
+
return true;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Handles resetting the user's password.
|
82 |
+
*
|
83 |
+
* @uses $wpdb WordPress Database object
|
84 |
+
*
|
85 |
+
* @param string $key Hash to validate sending user's password
|
86 |
+
* @return bool|WP_Error
|
87 |
+
*/
|
88 |
+
function reset_password($key, $login) {
|
89 |
+
global $wpdb;
|
90 |
+
|
91 |
+
$key = preg_replace('/[^a-z0-9]/i', '', $key);
|
92 |
+
|
93 |
+
if ( empty( $key ) || !is_string( $key ) )
|
94 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
95 |
+
|
96 |
+
if ( empty($login) || !is_string($login) )
|
97 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
98 |
+
|
99 |
+
$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login));
|
100 |
+
if ( empty( $user ) )
|
101 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
102 |
+
|
103 |
+
// Generate something random for a password...
|
104 |
+
$new_pass = wp_generate_password();
|
105 |
+
|
106 |
+
do_action('password_reset', $user, $new_pass);
|
107 |
+
|
108 |
+
wp_set_password($new_pass, $user->ID);
|
109 |
+
update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
|
110 |
+
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
|
111 |
+
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
|
112 |
+
$message .= site_url('wp-login.php', 'login') . "\r\n";
|
113 |
+
|
114 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
115 |
+
// we want to reverse this for the plain text arena of emails.
|
116 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
117 |
+
|
118 |
+
$title = sprintf(__('[%s] Your new password'), $blogname);
|
119 |
+
|
120 |
+
$title = apply_filters('password_reset_title', $title, $user->ID);
|
121 |
+
$message = apply_filters('password_reset_message', $message, $new_pass, $user->ID);
|
122 |
+
|
123 |
+
if ( $message && !wp_mail($user->user_email, $title, $message) )
|
124 |
+
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
125 |
+
|
126 |
+
wp_password_change_notification($user);
|
127 |
+
|
128 |
+
return true;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Handles registering a new user.
|
133 |
+
*
|
134 |
+
* @param string $user_login User's username for logging in
|
135 |
+
* @param string $user_email User's email address to send password and add
|
136 |
+
* @return int|WP_Error Either user's ID or error on failure.
|
137 |
+
*/
|
138 |
+
function register_new_user($user_login, $user_email) {
|
139 |
+
$errors = new WP_Error();
|
140 |
+
|
141 |
+
$user_login = sanitize_user( $user_login );
|
142 |
+
$user_email = apply_filters( 'user_registration_email', $user_email );
|
143 |
+
|
144 |
+
// Check the username
|
145 |
+
if ( $user_login == '' )
|
146 |
+
$errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
|
147 |
+
elseif ( !validate_username( $user_login ) ) {
|
148 |
+
$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.'));
|
149 |
+
$user_login = '';
|
150 |
+
} elseif ( username_exists( $user_login ) )
|
151 |
+
$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
|
152 |
+
|
153 |
+
// Check the e-mail address
|
154 |
+
if ($user_email == '') {
|
155 |
+
$errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.'));
|
156 |
+
} elseif ( !is_email( $user_email ) ) {
|
157 |
+
$errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.'));
|
158 |
+
$user_email = '';
|
159 |
+
} elseif ( email_exists( $user_email ) )
|
160 |
+
$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
|
161 |
+
|
162 |
+
do_action('register_post', $user_login, $user_email, $errors);
|
163 |
+
|
164 |
+
$errors = apply_filters( 'registration_errors', $errors, $user_login, $user_email );
|
165 |
+
|
166 |
+
if ( $errors->get_error_code() )
|
167 |
+
return $errors;
|
168 |
+
|
169 |
+
$user_pass = wp_generate_password();
|
170 |
+
|
171 |
+
// Allow the new password to be filtered by plugins
|
172 |
+
$user_pass = apply_filters('user_registration_pass', $user_pass);
|
173 |
+
|
174 |
+
$user_id = wp_create_user( $user_login, $user_pass, $user_email );
|
175 |
+
if ( !$user_id ) {
|
176 |
+
$errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')));
|
177 |
+
return $errors;
|
178 |
+
}
|
179 |
+
|
180 |
+
wp_new_user_notification($user_id, $user_pass);
|
181 |
+
|
182 |
+
return $user_id;
|
183 |
+
}
|
184 |
+
|
185 |
+
?>
|
includes/pluggable-functions.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( !function_exists('wp_password_change_notification') ) :
|
4 |
+
/**
|
5 |
+
* Notify the blog admin of a user changing password, normally via email.
|
6 |
+
*
|
7 |
+
* @since 2.7
|
8 |
+
*
|
9 |
+
* @param object $user User Object
|
10 |
+
*/
|
11 |
+
function wp_password_change_notification(&$user) {
|
12 |
+
do_action('wp_password_change_notification');
|
13 |
+
// send a copy of password change notification to the admin
|
14 |
+
// but check to see if it's the admin whose password we're changing, and skip this
|
15 |
+
if ( $user->user_email != get_option('admin_email') ) {
|
16 |
+
if ( apply_filters('password_change_notification', true) ) {
|
17 |
+
$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
|
18 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
19 |
+
// we want to reverse this for the plain text arena of emails.
|
20 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
21 |
+
|
22 |
+
$title = sprintf(__('[%s] Password Lost/Changed'), $blogname);
|
23 |
+
|
24 |
+
$title = apply_filters('password_change_notification_title', $title, $user->ID);
|
25 |
+
$message = apply_filters('password_change_notification_message', $message, $user->ID);
|
26 |
+
|
27 |
+
@wp_mail(get_option('admin_email'), $title, $message);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
endif;
|
32 |
+
|
33 |
+
if ( !function_exists('wp_new_user_notification') ) :
|
34 |
+
/**
|
35 |
+
* Notify the blog admin of a new user, normally via email.
|
36 |
+
*
|
37 |
+
* @since 2.0
|
38 |
+
*
|
39 |
+
* @param int $user_id User ID
|
40 |
+
* @param string $plaintext_pass Optional. The user's plaintext password
|
41 |
+
*/
|
42 |
+
function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
43 |
+
$user = new WP_User($user_id);
|
44 |
+
|
45 |
+
do_action('wp_new_user_notification', $user_id, $plaintext_pass);
|
46 |
+
|
47 |
+
$user_login = stripslashes($user->user_login);
|
48 |
+
$user_email = stripslashes($user->user_email);
|
49 |
+
|
50 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
51 |
+
// we want to reverse this for the plain text arena of emails.
|
52 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
53 |
+
|
54 |
+
if ( apply_filters('new_user_admin_notification', true) ) {
|
55 |
+
$message = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n";
|
56 |
+
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
57 |
+
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
|
58 |
+
|
59 |
+
$title = sprintf(__('[%s] New User Registration'), $blogname);
|
60 |
+
|
61 |
+
$title = apply_filters('new_user_admin_notification_title', $title, $user_id);
|
62 |
+
$message = apply_filters('new_user_admin_notification_message', $message, $user_id);
|
63 |
+
|
64 |
+
@wp_mail(get_option('admin_email'), $title, $message);
|
65 |
+
}
|
66 |
+
|
67 |
+
if ( empty($plaintext_pass) )
|
68 |
+
return;
|
69 |
+
|
70 |
+
if ( apply_filters('new_user_notification', true) ) {
|
71 |
+
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
|
72 |
+
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
|
73 |
+
$message .= wp_login_url() . "\r\n";
|
74 |
+
|
75 |
+
$title = sprintf(__('[%s] Your username and password'), $blogname);
|
76 |
+
|
77 |
+
$title = apply_filters('new_user_notification_title', $title, $user_id);
|
78 |
+
$message = apply_filters('new_user_notification_message', $message, $plaintext_pass, $user_id);
|
79 |
+
|
80 |
+
wp_mail($user_email, $title, $message);
|
81 |
+
}
|
82 |
+
|
83 |
+
}
|
84 |
+
endif;
|
85 |
+
|
86 |
+
?>
|
includes/template-functions.php
ADDED
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_display() {
|
4 |
+
$current_instance = wdbj_tml_get_var('current_instance');
|
5 |
+
$request_instance = wdbj_tml_get_var('request_instance');
|
6 |
+
|
7 |
+
$action = isset($current_instance['default_action']) ? $current_instance['default_action'] : 'login';
|
8 |
+
if ( $request_instance == $current_instance['instance_id'] )
|
9 |
+
$action = wdbj_tml_get_var('request_action');
|
10 |
+
|
11 |
+
ob_start();
|
12 |
+
echo $current_instance['before_widget'];
|
13 |
+
if ( $current_instance['show_title'] )
|
14 |
+
echo $current_instance['before_title'] . wdbj_tml_get_title($action) . $current_instance['after_title'] . "\n";
|
15 |
+
if ( is_user_logged_in() ) {
|
16 |
+
$user = wp_get_current_user();
|
17 |
+
$user_role = reset($user->roles);
|
18 |
+
echo '<div class="login" id="' . $current_instance['instance_id'] . '">' . "\n";
|
19 |
+
if ( $current_instance['show_gravatar'] )
|
20 |
+
echo '<div class="tml-user-avatar">' . get_avatar( $user->ID, $current_instance['gravatar_size'] ) . '</div>' . "\n";
|
21 |
+
echo '<ul class="tml-user-links">' . "\n";
|
22 |
+
$user_links = array(
|
23 |
+
array('title' => __('Dashboard'), 'url' => admin_url()),
|
24 |
+
array('title' => __('Profile'), 'url' => admin_url('profile.php'))
|
25 |
+
);
|
26 |
+
$user_links = apply_filters('tml_user_links', $user_links);
|
27 |
+
if ( $user_links ) {
|
28 |
+
foreach ( $user_links as $link ) {
|
29 |
+
echo '<li><a href="' . $link['url'] . '">' . $link['title'] . '</a></li>' . "\n";
|
30 |
+
}
|
31 |
+
}
|
32 |
+
echo '<li><a href="' . wp_logout_url() . '">' . __('Log out') . '</a></li>' . "\n";
|
33 |
+
echo "</ul>\n</div>\n";
|
34 |
+
} else {
|
35 |
+
if ( has_filter('login_form_' . $action) ) {
|
36 |
+
do_action('login_form_' . $action, $current_instance['instance_id']);
|
37 |
+
} else {
|
38 |
+
switch ( $action ) {
|
39 |
+
case 'lostpassword' :
|
40 |
+
case 'retrievepassword' :
|
41 |
+
wdbj_tml_get_lost_password_form();
|
42 |
+
break;
|
43 |
+
case 'register' :
|
44 |
+
wdbj_tml_get_register_form();
|
45 |
+
break;
|
46 |
+
case 'login' :
|
47 |
+
default :
|
48 |
+
wdbj_tml_get_login_form();
|
49 |
+
break;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
echo $current_instance['after_widget'] . "\n";
|
54 |
+
unset($current_instance, $request_instance, $action, $user_links, $link);
|
55 |
+
$contents = ob_get_contents();
|
56 |
+
ob_end_clean();
|
57 |
+
return $contents;
|
58 |
+
}
|
59 |
+
|
60 |
+
function wdbj_tml_get_display_options() {
|
61 |
+
$display_options = array(
|
62 |
+
'instance_id' => 'tml-page',
|
63 |
+
'is_active' => 0,
|
64 |
+
'default_action' => 'login',
|
65 |
+
'show_title' => 1,
|
66 |
+
'show_log_link' => 1,
|
67 |
+
'show_reg_link' => 1,
|
68 |
+
'show_pass_link' => 1,
|
69 |
+
'register_widget' => 0,
|
70 |
+
'lost_pass_widget' => 0,
|
71 |
+
'logged_in_widget' => 1,
|
72 |
+
'show_gravatar' => 1,
|
73 |
+
'gravatar_size' => 50,
|
74 |
+
'before_widget' => '<li>',
|
75 |
+
'after_widget' => '</li>',
|
76 |
+
'before_title' => '<h2>',
|
77 |
+
'after_title' => '</h2>'
|
78 |
+
);
|
79 |
+
return apply_filters('tml_display_options', $display_options);
|
80 |
+
}
|
81 |
+
|
82 |
+
function wdbj_tml_get_title($action = '') {
|
83 |
+
if ( empty($action) )
|
84 |
+
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
|
85 |
+
|
86 |
+
if ( is_user_logged_in() ) {
|
87 |
+
$user = wp_get_current_user();
|
88 |
+
$title = sprintf(__('Welcome, %s', 'theme-my-login'), $user->display_name);
|
89 |
+
} else {
|
90 |
+
switch ( $action ) {
|
91 |
+
case 'register':
|
92 |
+
$title = __('Register');
|
93 |
+
break;
|
94 |
+
case 'lostpassword':
|
95 |
+
case 'retrievepassword':
|
96 |
+
case 'resetpass':
|
97 |
+
case 'rp':
|
98 |
+
$title = __('Lost Password');
|
99 |
+
break;
|
100 |
+
case 'login':
|
101 |
+
default:
|
102 |
+
$title = __('Log In');
|
103 |
+
}
|
104 |
+
}
|
105 |
+
return apply_filters('tml_title', $title, $action);
|
106 |
+
}
|
107 |
+
|
108 |
+
function wdbj_tml_get_header($message = '') {
|
109 |
+
global $error;
|
110 |
+
|
111 |
+
$wp_error = wdbj_tml_get_var('errors');
|
112 |
+
$current_instance = wdbj_tml_get_var('current_instance');
|
113 |
+
|
114 |
+
if ( empty($wp_error) )
|
115 |
+
$wp_error = new WP_Error();
|
116 |
+
|
117 |
+
echo '<div class="login" id="' . $current_instance['instance_id'] . '">';
|
118 |
+
|
119 |
+
$message = apply_filters('login_message', $message);
|
120 |
+
if ( !empty($message) )
|
121 |
+
echo '<p class="message">' . $message . "</p>\n";
|
122 |
+
|
123 |
+
// Incase a plugin uses $error rather than the $errors object
|
124 |
+
if ( !empty( $error ) ) {
|
125 |
+
$wp_error->add('error', $error);
|
126 |
+
unset($error);
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( $current_instance['is_active'] ) {
|
130 |
+
if ( $wp_error->get_error_code() ) {
|
131 |
+
$errors = '';
|
132 |
+
$messages = '';
|
133 |
+
foreach ( $wp_error->get_error_codes() as $code ) {
|
134 |
+
$severity = $wp_error->get_error_data($code);
|
135 |
+
foreach ( $wp_error->get_error_messages($code) as $error ) {
|
136 |
+
if ( 'message' == $severity )
|
137 |
+
$messages .= ' ' . $error . "<br />\n";
|
138 |
+
else
|
139 |
+
$errors .= ' ' . $error . "<br />\n";
|
140 |
+
}
|
141 |
+
}
|
142 |
+
if ( !empty($errors) )
|
143 |
+
echo '<p class="error">' . apply_filters('login_errors', $errors) . "</p>\n";
|
144 |
+
if ( !empty($messages) )
|
145 |
+
echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
function wdbj_tml_get_footer($login_link = true, $register_link = true, $password_link = true) {
|
151 |
+
$current_instance = wdbj_tml_get_var('current_instance');
|
152 |
+
|
153 |
+
echo '<ul class="tml-links">' . "\n";
|
154 |
+
if ( $login_link && $current_instance['show_log_link'] ) {
|
155 |
+
$url = wdbj_tml_get_current_url('instance=' . $current_instance['instance_id']);
|
156 |
+
echo '<li><a href="' . esc_url($url) . '">' . wdbj_tml_get_title('login') . '</a></li>' . "\n";
|
157 |
+
}
|
158 |
+
if ( $register_link && $current_instance['show_reg_link'] && get_option('users_can_register') ) {
|
159 |
+
$url = ( $current_instance['register_widget'] ) ? wdbj_tml_get_current_url('action=register&instance=' . $current_instance['instance_id']) : site_url('wp-login.php?action=register', 'login');
|
160 |
+
echo '<li><a href="' . esc_url($url) . '">' . wdbj_tml_get_title('register') . '</a></li>' . "\n";
|
161 |
+
}
|
162 |
+
if ( $password_link && $current_instance['show_pass_link'] ) {
|
163 |
+
$url = ( $current_instance['lost_pass_widget'] ) ? wdbj_tml_get_current_url('action=lostpassword&instance=' . $current_instance['instance_id']) : site_url('wp-login.php?action=lostpassword', 'login');
|
164 |
+
echo '<li><a href="' . esc_url($url) . '">' . wdbj_tml_get_title('lostpassword') . '</a></li>' . "\n";
|
165 |
+
}
|
166 |
+
echo '</ul>' . "\n";
|
167 |
+
echo '</div>' . "\n";
|
168 |
+
}
|
169 |
+
|
170 |
+
function wdbj_tml_get_login_form() {
|
171 |
+
$current_instance = wdbj_tml_get_var('current_instance');
|
172 |
+
|
173 |
+
// Clear errors if loggedout is set.
|
174 |
+
if ( !empty($_GET['loggedout']) )
|
175 |
+
wdbj_tml_set_error();
|
176 |
+
|
177 |
+
// If cookies are disabled we can't log in even with a valid user+pass
|
178 |
+
if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
|
179 |
+
wdbj_tml_set_error('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'theme-my-login'));
|
180 |
+
|
181 |
+
// Some parts of this script use the main login form to display a message
|
182 |
+
if ( $current_instance['is_active'] ) {
|
183 |
+
if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] )
|
184 |
+
wdbj_tml_set_error('loggedout', __('You are now logged out.'), 'message');
|
185 |
+
elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] )
|
186 |
+
wdbj_tml_set_error('registerdisabled', __('User registration is currently not allowed.'));
|
187 |
+
elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )
|
188 |
+
wdbj_tml_set_error('confirm', __('Check your e-mail for the confirmation link.'), 'message');
|
189 |
+
elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )
|
190 |
+
wdbj_tml_set_error('newpass', __('Check your e-mail for your new password.'), 'message');
|
191 |
+
elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )
|
192 |
+
wdbj_tml_set_error('registered', __('Registration complete. Please check your e-mail.'), 'message');
|
193 |
+
}
|
194 |
+
|
195 |
+
wdbj_tml_get_header();
|
196 |
+
|
197 |
+
if ( isset($_POST['log']) )
|
198 |
+
$user_login = ( wdbj_tml_get_error('incorrect_password') || wdbj_tml_get_error('empty_password') ) ? attribute_escape(stripslashes($_POST['log'])) : '';
|
199 |
+
|
200 |
+
$user_login = ( $current_instance['is_active'] && isset($user_login) ) ? $user_login : '';
|
201 |
+
|
202 |
+
if ( ( ! ( isset($_GET['checkemail']) && $current_instance['is_active'] ) ) ||
|
203 |
+
( ! ( in_array($_GET['checkemail'], array('confirm', 'newpass') ) && $current_instance['is_active'] ) ) ) {
|
204 |
+
?>
|
205 |
+
<form name="loginform" id="loginform-<?php echo $current_instance['instance_id']; ?>" action="<?php echo esc_url(wdbj_tml_get_current_url('action=login&instance=' . $current_instance['instance_id'])); ?>" method="post">
|
206 |
+
<p>
|
207 |
+
<label for="log-<?php echo $current_instance['instance_id']; ?>"><?php _e('Username') ?></label>
|
208 |
+
<input type="text" name="log" id="log-<?php echo $current_instance['instance_id']; ?>" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20" />
|
209 |
+
</p>
|
210 |
+
<p>
|
211 |
+
<label for="pwd-<?php echo $current_instance['instance_id']; ?>"><?php _e('Password') ?></label>
|
212 |
+
<input type="password" name="pwd" id="pwd-<?php echo $current_instance['instance_id']; ?>" class="input" value="" size="20" />
|
213 |
+
</p>
|
214 |
+
<?php do_action('login_form', $current_instance['instance_id']); ?>
|
215 |
+
<p class="forgetmenot"><input name="rememberme" type="checkbox" id="rememberme-<?php echo $current_instance['instance_id']; ?>" value="forever" /> <label for="rememberme-<?php echo $current_instance['instance_id']; ?>"><?php _e('Remember Me'); ?></label></p>
|
216 |
+
<p class="submit">
|
217 |
+
<input type="submit" name="wp-submit" id="wp-submit-<?php echo $current_instance['instance_id']; ?>" value="<?php _e('Log In'); ?>" />
|
218 |
+
<input type="hidden" name="redirect_to" value="<?php echo esc_attr(wdbj_tml_get_var('redirect_to')); ?>" />
|
219 |
+
<input type="hidden" name="testcookie" value="1" />
|
220 |
+
</p>
|
221 |
+
</form>
|
222 |
+
<?php
|
223 |
+
}
|
224 |
+
if ( $current_instance['is_active'] && isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) )
|
225 |
+
$login_link = true;
|
226 |
+
else
|
227 |
+
$login_link = false;
|
228 |
+
wdbj_tml_get_footer($login_link, true, true);
|
229 |
+
}
|
230 |
+
|
231 |
+
function wdbj_tml_get_register_form() {
|
232 |
+
$current_instance = wdbj_tml_get_var('current_instance');
|
233 |
+
|
234 |
+
$user_login = isset($_POST['user_login']) ? $_POST['user_login'] : '';
|
235 |
+
$user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
|
236 |
+
|
237 |
+
$message = apply_filters('register_message', __('A password will be e-mailed to you.'));
|
238 |
+
|
239 |
+
wdbj_tml_get_header($message);
|
240 |
+
?>
|
241 |
+
<form name="registerform" id="registerform-<?php echo $current_instance['instance_id']; ?>" action="<?php echo esc_url(wdbj_tml_get_current_url('action=register&instance=' . $current_instance['instance_id'])); ?>" method="post">
|
242 |
+
<p>
|
243 |
+
<label for="user_login-<?php echo $current_instance['instance_id']; ?>"><?php _e('Username') ?></label>
|
244 |
+
<input type="text" name="user_login" id="user_login-<?php echo $current_instance['instance_id']; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" />
|
245 |
+
</p>
|
246 |
+
<p>
|
247 |
+
<label for="user_email-<?php echo $current_instance['instance_id']; ?>"><?php _e('E-mail') ?></label>
|
248 |
+
<input type="text" name="user_email" id="user_email-<?php echo $current_instance['instance_id']; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" />
|
249 |
+
</p>
|
250 |
+
<?php do_action('register_form', $current_instance['instance_id']); ?>
|
251 |
+
<p class="submit">
|
252 |
+
<input type="submit" name="wp-submit" id="wp-submit-<?php echo $current_instance['instance_id']; ?>" value="<?php _e('Register'); ?>" />
|
253 |
+
</p>
|
254 |
+
</form>
|
255 |
+
<?php
|
256 |
+
wdbj_tml_get_footer(true, false, true);
|
257 |
+
}
|
258 |
+
|
259 |
+
function wdbj_tml_get_lost_password_form() {
|
260 |
+
$current_instance = wdbj_tml_get_var('current_instance');
|
261 |
+
|
262 |
+
do_action('lost_password', $current_instance['instance_id']);
|
263 |
+
|
264 |
+
$message = apply_filters('lostpassword_message', __('Please enter your username or e-mail address. You will receive a new password via e-mail.'));
|
265 |
+
|
266 |
+
wdbj_tml_get_header($message);
|
267 |
+
|
268 |
+
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
269 |
+
?>
|
270 |
+
<form name="lostpasswordform" id="lostpasswordform-<?php echo $current_instance['instance_id']; ?>" action="<?php echo esc_url(wdbj_tml_get_current_url('action=lostpassword&instance=' . $current_instance['instance_id'])); ?>" method="post">
|
271 |
+
<p>
|
272 |
+
<label for="user_login-<?php echo $current_instance['instance_id']; ?>"><?php _e('Username or E-mail:') ?></label>
|
273 |
+
<input type="text" name="user_login" id="user_login-<?php echo $current_instance['instance_id']; ?>" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" />
|
274 |
+
</p>
|
275 |
+
<?php do_action('lostpassword_form', $current_instance['instance_id']); ?>
|
276 |
+
<p class="submit">
|
277 |
+
<input type="submit" name="wp-submit" id="wp-submit-<?php echo $current_instance['instance_id']; ?>" value="<?php _e('Get New Password'); ?>" />
|
278 |
+
</p>
|
279 |
+
</form>
|
280 |
+
<?php
|
281 |
+
wdbj_tml_get_footer(true, true, false);
|
282 |
+
}
|
283 |
+
|
284 |
+
?>
|
includes/widget.php
CHANGED
@@ -1,55 +1,50 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if ( !class_exists('
|
4 |
-
class
|
5 |
|
6 |
-
function
|
7 |
$widget_ops = array('classname' => 'widget_theme_my_login', 'description' => __('A login form for your blog.', 'theme-my-login') );
|
8 |
-
|
9 |
}
|
10 |
|
11 |
function widget($args, $instance){
|
12 |
-
global $ThemeMyLogin;
|
13 |
if ( is_user_logged_in() && !$instance['logged_in_widget'] )
|
14 |
return;
|
15 |
$args = array_merge($args, $instance);
|
16 |
-
echo
|
17 |
}
|
18 |
|
19 |
function update($new_instance, $old_instance){
|
20 |
-
|
21 |
$instance = $old_instance;
|
22 |
-
$instance['default_action']
|
23 |
-
$instance['logged_in_widget']
|
24 |
-
$instance['show_title']
|
25 |
-
$instance['show_log_link']
|
26 |
-
$instance['show_reg_link']
|
27 |
-
$instance['show_pass_link']
|
28 |
-
$instance['show_gravatar']
|
29 |
-
$instance['gravatar_size']
|
30 |
-
$instance['register_widget']
|
31 |
-
$instance['lost_pass_widget']
|
32 |
-
|
33 |
return $instance;
|
34 |
}
|
35 |
|
36 |
function form($instance){
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$defaults['register_widget'] = 1;
|
50 |
-
$defaults['lost_pass_widget'] = 1;
|
51 |
|
52 |
-
$instance = wp_parse_args(
|
53 |
$actions = array('login' => 'Login', 'register' => 'Register', 'lostpassword' => 'Lost Password');
|
54 |
echo '<p>Default Action<br /><select name="' . $this->get_field_name('default_action') . '" id="' . $this->get_field_id('default_action') . '">';
|
55 |
foreach ($actions as $action => $title) {
|
@@ -76,14 +71,7 @@ class ThemeMyLoginWidget extends WP_Widget {
|
|
76 |
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";
|
77 |
}
|
78 |
|
79 |
-
}// END class
|
80 |
-
endif;
|
81 |
-
|
82 |
-
if ( !function_exists('ThemeMyLoginWidgetInit') ) :
|
83 |
-
function ThemeMyLoginWidgetInit() {
|
84 |
-
register_widget('ThemeMyLoginWidget');
|
85 |
}
|
86 |
endif;
|
87 |
-
add_action('widgets_init', 'ThemeMyLoginWidgetInit');
|
88 |
|
89 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
if ( !class_exists('Theme_My_Login_Widget') ) :
|
4 |
+
class Theme_My_Login_Widget extends WP_Widget {
|
5 |
|
6 |
+
function Theme_My_Login_Widget(){
|
7 |
$widget_ops = array('classname' => 'widget_theme_my_login', 'description' => __('A login form for your blog.', 'theme-my-login') );
|
8 |
+
parent::WP_Widget('theme-my-login', __('Theme My Login', 'theme-my-login'), $widget_ops);
|
9 |
}
|
10 |
|
11 |
function widget($args, $instance){
|
|
|
12 |
if ( is_user_logged_in() && !$instance['logged_in_widget'] )
|
13 |
return;
|
14 |
$args = array_merge($args, $instance);
|
15 |
+
echo wdbj_tml_shortcode($args);
|
16 |
}
|
17 |
|
18 |
function update($new_instance, $old_instance){
|
|
|
19 |
$instance = $old_instance;
|
20 |
+
$instance['default_action'] = in_array($new_instance['default_action'], array('login', 'register', 'lostpassword')) ? $new_instance['default_action'] : 'login';
|
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 |
return $instance;
|
31 |
}
|
32 |
|
33 |
function form($instance){
|
34 |
+
$defaults = array(
|
35 |
+
'default_action' => 'login',
|
36 |
+
'logged_in_widget' => 1,
|
37 |
+
'show_title' => 1,
|
38 |
+
'show_log_link' => 1,
|
39 |
+
'show_reg_link' => 1,
|
40 |
+
'show_pass_link' => 1,
|
41 |
+
'show_gravatar' => 1,
|
42 |
+
'gravatar_size' => 50,
|
43 |
+
'register_widget' => 1,
|
44 |
+
'lost_pass_widget' => 1
|
45 |
+
);
|
|
|
|
|
46 |
|
47 |
+
$instance = wp_parse_args($instance, $defaults);
|
48 |
$actions = array('login' => 'Login', 'register' => 'Register', 'lostpassword' => 'Lost Password');
|
49 |
echo '<p>Default Action<br /><select name="' . $this->get_field_name('default_action') . '" id="' . $this->get_field_id('default_action') . '">';
|
50 |
foreach ($actions as $action => $title) {
|
71 |
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";
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
endif;
|
|
|
76 |
|
77 |
?>
|
js/theme-my-login-admin.js
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($){
|
2 |
-
|
3 |
-
$("#container, #container div").tabs({ fx: { opacity: 'toggle', duration: 'fast' } });
|
4 |
-
|
5 |
-
$("a.link").live("click", function() {
|
6 |
-
var arr = $(this).attr("class").split(" ");
|
7 |
-
var action = arr[1];
|
8 |
-
var role = arr[2];
|
9 |
-
var lastrow = $("#links-" + role + " tbody>tr:last").attr("id");
|
10 |
-
var count = Number(lastrow.substring(9, lastrow.length)) + 1;
|
11 |
-
if ('add' == action) {
|
12 |
-
$("#links-" + role + " tbody>tr:last").clone(true).insertAfter("#links-" + role + " tbody>tr:last");
|
13 |
-
var curclass = $("#links-" + role + " tbody>tr:last").attr("class");
|
14 |
-
var newclass = ('alternate' == curclass) ? '' : 'alternate';
|
15 |
-
$("#links-" + role + " tbody>tr:last").attr("class", newclass);
|
16 |
-
$("#links-" + role + " tbody>tr:last").attr("id", "link-row-" + count);
|
17 |
-
$("#links-" + role + " tbody>tr:last input.link-title").attr("id", "links[" + role + "][" + count + "][title]");
|
18 |
-
$("#links-" + role + " tbody>tr:last input.link-title").attr("name", "links[" + role + "][" + count + "][title]");
|
19 |
-
$("#links-" + role + " tbody>tr:last input.link-url").attr("id", "links[" + role + "][" + count + "][url]");
|
20 |
-
$("#links-" + role + " tbody>tr:last input.link-url").attr("name", "links[" + role + "][" + count + "][url]");
|
21 |
-
$("#links-" + role + " tbody>tr:last input.link-title").attr("value", "");
|
22 |
-
$("#links-" + role + " tbody>tr:last input.link-url").attr("value", "");
|
23 |
-
$("#links-" + role + " tbody>tr:last input.link-title").focus();
|
24 |
-
updateButtons();
|
25 |
-
} else {
|
26 |
-
$(this).parent().parent().parent().remove();
|
27 |
-
updateButtons();
|
28 |
-
}
|
29 |
-
return false;
|
30 |
-
});
|
31 |
-
updateButtons();
|
32 |
-
});
|
33 |
-
|
34 |
-
function updateButtons() {
|
35 |
-
jQuery(".link-table a.link.remove").show();
|
36 |
-
jQuery(".link-table a.link.add").hide();
|
37 |
-
jQuery(".link-table").each(function(i) {
|
38 |
-
jQuery("#" + this.id + " a.link.add:last").show();
|
39 |
-
});
|
40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/custom-email/admin/admin.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_custom_email_admin_menu() {
|
4 |
+
$parent = plugin_basename(TML_MODULE_DIR . '/custom-email/admin/options.php');
|
5 |
+
wdbj_tml_add_menu_page(__('E-mail', 'theme-my-login'), $parent);
|
6 |
+
wdbj_tml_add_submenu_page($parent, __('General', 'theme-my-login'), TML_MODULE_DIR . '/custom-email/admin/options-general.php');
|
7 |
+
wdbj_tml_add_submenu_page($parent, __('New User', 'theme-my-login'), TML_MODULE_DIR . '/custom-email/admin/options-new-user.php');
|
8 |
+
wdbj_tml_add_submenu_page($parent, __('Retrieve Password', 'theme-my-login'), TML_MODULE_DIR . '/custom-email/admin/options-retrieve-pass.php');
|
9 |
+
wdbj_tml_add_submenu_page($parent, __('Reset Password', 'theme-my-login'), TML_MODULE_DIR . '/custom-email/admin/options-reset-pass.php');
|
10 |
+
}
|
11 |
+
|
12 |
+
function wdbj_tml_custom_email_sanitize_html($text) {
|
13 |
+
$text = addslashes($text);
|
14 |
+
$text = wp_filter_post_kses($text);
|
15 |
+
$text = stripslashes($text);
|
16 |
+
$text = esc_html($text);
|
17 |
+
return $text;
|
18 |
+
}
|
19 |
+
|
20 |
+
function wdbj_tml_custom_email_sanitize_text($text) {
|
21 |
+
$text = strip_tags($text);
|
22 |
+
$text = addslashes($text);
|
23 |
+
$text = wp_filter_post_kses($text);
|
24 |
+
$text = stripslashes($text);
|
25 |
+
return $text;
|
26 |
+
}
|
27 |
+
|
28 |
+
function wdbj_tml_custom_email_save_settings($settings) {
|
29 |
+
$settings['email']['mail_from_name'] = wdbj_tml_custom_email_sanitize_text($settings['email']['mail_from_name']);
|
30 |
+
$settings['email']['mail_from'] = sanitize_email($settings['email']['mail_from']);
|
31 |
+
$settings['email']['mail_content_type'] = preg_replace('/[^a-zA-Z0-9_-]/', '', $settings['email']['mail_content_type']);
|
32 |
+
|
33 |
+
$settings['email']['new_user']['admin_disable'] = isset($settings['email']['new_user']['admin_disable']) ? 1 : 0;
|
34 |
+
$settings['email']['reset_pass']['admin_disable'] = isset($settings['email']['reset_pass']['admin_disable']) ? 1 : 0;
|
35 |
+
return $settings;
|
36 |
+
}
|
37 |
+
|
38 |
+
?>
|
modules/custom-email/admin/options-general.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr valign="top">
|
3 |
+
<td>
|
4 |
+
<label for="theme_my_login_mail_from_name"><?php _e('From Name', 'theme-my-login'); ?></label><br />
|
5 |
+
<input name="theme_my_login[email][mail_from_name]" type="text" id="theme_my_login_mail_from_name" value="<?php echo $theme_my_login->options['email']['mail_from_name']; ?>" class="regular-text" />
|
6 |
+
</td>
|
7 |
+
</tr>
|
8 |
+
<tr valign="top">
|
9 |
+
<td>
|
10 |
+
<label for="theme_my_login_mail_from"><?php _e('From E-mail', 'theme-my-login'); ?></label><br />
|
11 |
+
<input name="theme_my_login[email][mail_from]" type="text" id="theme_my_login_mail_from" value="<?php echo $theme_my_login->options['email']['mail_from']; ?>" class="regular-text" />
|
12 |
+
</td>
|
13 |
+
</tr>
|
14 |
+
<tr valign="top">
|
15 |
+
<td>
|
16 |
+
<label for="theme_my_login_mail_content_type"><?php _e('E-mail Format', 'theme-my-login'); ?></label><br />
|
17 |
+
<select name="theme_my_login[email][mail_content_type]" id="theme_my_login_mail_content_type">
|
18 |
+
<option value="plain"<?php if ('plain' == $theme_my_login->options['email']['mail_content_type']) echo ' selected="selected"'; ?>>Plain Text</option>
|
19 |
+
<option value="html"<?php if ('html' == $theme_my_login->options['email']['mail_content_type']) echo ' selected="selected"'; ?>>HTML</option>
|
20 |
+
</select>
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
</table>
|
modules/custom-email/admin/options-new-user.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr>
|
3 |
+
<td>
|
4 |
+
<p><em><?php _e('Available Variables', 'theme-my-login'); ?>: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%, %user_ip%</em></p>
|
5 |
+
<label for="theme_my_login_new_user_title"><?php _e('Subject', 'theme-my-login'); ?></label><br />
|
6 |
+
<input name="theme_my_login[email][new_user][title]" type="text" id="theme_my_login_new_user_title" value="<?php echo $theme_my_login->options['email']['new_user']['title']; ?>" class="full-text" /><br />
|
7 |
+
<label for="theme_my_login_new_user_message"><?php _e('Message', 'theme-my-login'); ?></label><br />
|
8 |
+
<textarea name="theme_my_login[email][new_user][message]" id="theme_my_login_new_user_message" class="large-text" rows="10"><?php echo $theme_my_login->options['email']['new_user']['message']; ?></textarea><br />
|
9 |
+
<p>
|
10 |
+
<label for="theme_my_login_new_user_admin_disable"><input name="theme_my_login[email][new_user][admin_disable]" type="checkbox" id="theme_my_login_new_user_admin_disable" value="1"<?php checked(1, $theme_my_login->options['email']['new_user']['admin_disable']); ?> /> Disable Admin Notification</label>
|
11 |
+
</p>
|
12 |
+
</td>
|
13 |
+
</tr>
|
14 |
+
</table>
|
modules/custom-email/admin/options-reset-pass.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr>
|
3 |
+
<td>
|
4 |
+
<p><em><?php _e('Available Variables', 'theme-my-login'); ?>: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%, %user_ip%</em></p>
|
5 |
+
<label for="theme_my_login_reset_pass_title"><?php _e('Subject', 'theme-my-login'); ?></label><br />
|
6 |
+
<input name="theme_my_login[email][reset_pass][title]" type="text" id="theme_my_login_reset_pass_title" value="<?php echo $theme_my_login->options['email']['reset_pass']['title']; ?>" class="full-text" /><br />
|
7 |
+
<label for="theme_my_login_reset_pass_message"><?php _e('Message', 'theme-my-login'); ?></label><br />
|
8 |
+
<textarea name="theme_my_login[email][reset_pass][message]" id="theme_my_login_reset_pass_message" class="large-text" rows="10"><?php echo $theme_my_login->options['email']['reset_pass']['message']; ?></textarea><br />
|
9 |
+
<p>
|
10 |
+
<label for="theme_my_login_reset_pass_admin_disable"><input name="theme_my_login[email][reset_pass][admin_disable]" type="checkbox" id="theme_my_login_reset_pass_admin_disable" value="1"<?php checked(1, $theme_my_login->options['email']['reset_pass']['admin_disable']); ?> /> <?php _e('Disable Admin Notification', 'theme-my-login'); ?></label>
|
11 |
+
</p>
|
12 |
+
</td>
|
13 |
+
</tr>
|
14 |
+
</table>
|
modules/custom-email/admin/options-retrieve-pass.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr>
|
3 |
+
<td>
|
4 |
+
<p><em><?php _e('Available Variables', 'theme-my-login'); ?>: %blogname%, %siteurl%, %reseturl%, %user_login%, %user_email%, %user_ip%</em></p>
|
5 |
+
<label for="theme_my_login_reset_pass_title"><?php _e('Subject', 'theme-my-login'); ?></label><br />
|
6 |
+
<input name="theme_my_login[email][retrieve_pass][title]" type="text" id="theme_my_login_retrieve_pass_title" value="<?php echo $theme_my_login->options['email']['retrieve_pass']['title']; ?>" class="full-text" /><br />
|
7 |
+
<label for="theme_my_login_reset_pass_message"><?php _e('Message', 'theme-my-login'); ?></label><br />
|
8 |
+
<textarea name="theme_my_login[email][retrieve_pass][message]" id="theme_my_login_retrieve_pass_message" class="large-text" rows="10"><?php echo $theme_my_login->options['email']['retrieve_pass']['message']; ?></textarea><br />
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</table>
|
modules/custom-email/custom-email.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Custom E-mail
|
4 |
+
Description: Enabling this module will initialize custom e-mails. You will then have to configure the settings via the "E-mail" tab.
|
5 |
+
*/
|
6 |
+
|
7 |
+
add_action('tml_init', 'wdbj_tml_custom_email_init');
|
8 |
+
function wdbj_tml_custom_email_init() {
|
9 |
+
require_once( TML_MODULE_DIR . '/custom-email/includes/hook-functions.php' );
|
10 |
+
add_action('retrieve_password', 'wdbj_tml_custom_email_retrieve_pass_filters');
|
11 |
+
add_action('password_reset', 'wdbj_tml_custom_email_reset_pass_filters', 10, 2);
|
12 |
+
add_action('register_post', 'wdbj_tml_custom_email_new_user_filters', 10, 2);
|
13 |
+
}
|
14 |
+
|
15 |
+
add_action('tml_admin_init', 'wdbj_tml_custom_email_admin_init');
|
16 |
+
function wdbj_tml_custom_email_admin_init() {
|
17 |
+
require_once( TML_MODULE_DIR . '/custom-email/admin/admin.php' );
|
18 |
+
add_action('tml_admin_menu', 'wdbj_tml_custom_email_admin_menu');
|
19 |
+
add_filter('tml_save_settings', 'wdbj_tml_custom_email_save_settings');
|
20 |
+
}
|
21 |
+
|
22 |
+
add_action('activate_custom-email/custom-email.php', 'wdbj_tml_custom_email_activate');
|
23 |
+
function wdbj_tml_custom_email_activate() {
|
24 |
+
$current = wdbj_tml_get_option('email');
|
25 |
+
$default = wdbj_tml_custom_email_default_settings();
|
26 |
+
|
27 |
+
if ( is_array($current) )
|
28 |
+
wdbj_tml_update_option(array_merge($default, $current), 'email');
|
29 |
+
else
|
30 |
+
wdbj_tml_update_option($default, 'email');
|
31 |
+
|
32 |
+
unset($current, $default);
|
33 |
+
}
|
34 |
+
|
35 |
+
function wdbj_tml_custom_email_default_settings() {
|
36 |
+
$options = array(
|
37 |
+
'mail_from' => '',
|
38 |
+
'mail_from_name' => '',
|
39 |
+
'mail_content_type' => '',
|
40 |
+
'new_user' => array(
|
41 |
+
'title' => '',
|
42 |
+
'message' => '',
|
43 |
+
'admin_disable' => 0
|
44 |
+
),
|
45 |
+
'retrieve_pass' => array(
|
46 |
+
'title' => '',
|
47 |
+
'message' => ''
|
48 |
+
),
|
49 |
+
'reset_pass' => array(
|
50 |
+
'title' => '',
|
51 |
+
'message' => '',
|
52 |
+
'admin_disable' => 0
|
53 |
+
)
|
54 |
+
);
|
55 |
+
return $options;
|
56 |
+
}
|
57 |
+
|
58 |
+
?>
|
modules/custom-email/includes/hook-functions.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_custom_email_headers() {
|
4 |
+
add_filter('wp_mail_from', 'wdbj_tml_custom_email_from');
|
5 |
+
add_filter('wp_mail_from_name', 'wdbj_tml_custom_email_from_name');
|
6 |
+
add_filter('wp_mail_content_type', 'wdbj_tml_custom_email_content_type');
|
7 |
+
}
|
8 |
+
|
9 |
+
function wdbj_tml_custom_email_retrieve_pass_filters($user_login) {
|
10 |
+
wdbj_tml_custom_email_headers();
|
11 |
+
add_filter('retrieve_password_title', 'wdbj_tml_custom_email_retrieve_pass_title', 10, 2);
|
12 |
+
add_filter('retrieve_password_message', 'wdbj_tml_custom_email_retrieve_pass_message', 10, 3);
|
13 |
+
}
|
14 |
+
|
15 |
+
function wdbj_tml_custom_email_reset_pass_filters($user, $new_pass) {
|
16 |
+
wdbj_tml_custom_email_headers();
|
17 |
+
add_filter('password_reset_title', 'wdbj_tml_custom_email_reset_pass_title', 10, 2);
|
18 |
+
add_filter('password_reset_message', 'wdbj_tml_custom_email_reset_pass_message', 10, 3);
|
19 |
+
add_filter('password_change_notification', 'wdbj_tml_custom_email_reset_pass_disable');
|
20 |
+
}
|
21 |
+
|
22 |
+
function wdbj_tml_custom_email_new_user_filters($user_id, $user_pass) {
|
23 |
+
wdbj_tml_custom_email_headers();
|
24 |
+
add_filter('new_user_notification_title', 'wdbj_tml_custom_email_new_user_title', 10, 2);
|
25 |
+
add_filter('new_user_notification_message', 'wdbj_tml_custom_email_new_user_message', 10, 3);
|
26 |
+
add_filter('new_user_admin_notification', 'wdbj_tml_custom_email_new_user_admin_disable');
|
27 |
+
}
|
28 |
+
|
29 |
+
function wdbj_tml_custom_email_from($from_email) {
|
30 |
+
$_from_email = wdbj_tml_get_option('email', 'mail_from');
|
31 |
+
return empty($_from_email) ? $from_email : $_from_email;
|
32 |
+
}
|
33 |
+
|
34 |
+
function wdbj_tml_custom_email_from_name($from_name) {
|
35 |
+
$_from_name = wdbj_tml_get_option('email', 'mail_from_name');
|
36 |
+
return empty($_from_name) ? $from_name : $_from_name;
|
37 |
+
}
|
38 |
+
|
39 |
+
function wdbj_tml_custom_email_content_type($content_type) {
|
40 |
+
$_content_type = wdbj_tml_get_option('email', 'mail_content_type');
|
41 |
+
return empty($_content_type) ? $content_type : 'text/' . $_content_type;
|
42 |
+
}
|
43 |
+
|
44 |
+
function wdbj_tml_custom_email_retrieve_pass_title($title, $user_id) {
|
45 |
+
$_title = wdbj_tml_get_option('email', 'retrieve_pass', 'title');
|
46 |
+
return empty($_title) ? $title : wdbj_tml_custom_email_replace_vars($_title, $user_id);
|
47 |
+
}
|
48 |
+
|
49 |
+
function wdbj_tml_custom_email_retrieve_pass_message($message, $key, $user_id) {
|
50 |
+
$_message = wdbj_tml_get_option('email', 'retrieve_pass', 'message');
|
51 |
+
$user = get_userdata($user_id);
|
52 |
+
$replacements = array(
|
53 |
+
'%loginurl%' => site_url('wp-login.php', 'login'),
|
54 |
+
'%reseturl%' => site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login')
|
55 |
+
);
|
56 |
+
return empty($_message) ? $message : wdbj_tml_custom_email_replace_vars($_message, $user_id, $replacements);
|
57 |
+
}
|
58 |
+
|
59 |
+
function wdbj_tml_custom_email_reset_pass_title($title, $user_id) {
|
60 |
+
$_title = wdbj_tml_get_option('email', 'reset_pass', 'title');
|
61 |
+
return empty($_title) ? $title : wdbj_tml_custom_email_replace_vars($_title, $user_id);
|
62 |
+
}
|
63 |
+
|
64 |
+
function wdbj_tml_custom_email_reset_pass_message($message, $new_pass, $user_id) {
|
65 |
+
$_message = wdbj_tml_get_option('email', 'reset_pass', 'message');
|
66 |
+
$replacements = array(
|
67 |
+
'%loginurl%' => site_url('wp-login.php', 'login'),
|
68 |
+
'%user_pass%' => $new_pass
|
69 |
+
);
|
70 |
+
return empty($_message) ? $message : wdbj_tml_custom_email_replace_vars($_message, $user_id, $replacements);
|
71 |
+
}
|
72 |
+
|
73 |
+
function wdbj_tml_custom_email_reset_pass_disable($enable) {
|
74 |
+
return ( wdbj_tml_get_option('email', 'reset_pass', 'admin_disable') ) ? 0 : 1;
|
75 |
+
}
|
76 |
+
|
77 |
+
function wdbj_tml_custom_email_new_user_title($title, $user_id) {
|
78 |
+
$_title = wdbj_tml_get_option('email', 'new_user', 'title');
|
79 |
+
return empty($_title) ? $title : wdbj_tml_custom_email_replace_vars($_title, $user_id);
|
80 |
+
}
|
81 |
+
|
82 |
+
function wdbj_tml_custom_email_new_user_message($message, $new_pass, $user_id) {
|
83 |
+
$_message = wdbj_tml_get_option('email', 'new_user', 'message');
|
84 |
+
$replacements = array(
|
85 |
+
'%loginurl%' => site_url('wp-login.php', 'login'),
|
86 |
+
'%user_pass%' => $new_pass
|
87 |
+
);
|
88 |
+
return empty($_message) ? $message : wdbj_tml_custom_email_replace_vars($_message, $user_id, $replacements);
|
89 |
+
}
|
90 |
+
|
91 |
+
function wdbj_tml_custom_email_new_user_admin_disable($enable) {
|
92 |
+
return ( wdbj_tml_get_option('email', 'new_user', 'admin_disable') ) ? 0 : 1;
|
93 |
+
}
|
94 |
+
|
95 |
+
function wdbj_tml_custom_email_replace_vars($text, $user_id = '', $replacements = array()) {
|
96 |
+
// Get user data
|
97 |
+
if ( $user_id )
|
98 |
+
$user = get_userdata($user_id);
|
99 |
+
|
100 |
+
// Get all matches ($matches[0] will be '%value%'; $matches[1] will be 'value')
|
101 |
+
preg_match_all('/%([^%]*)%/', $text, $matches);
|
102 |
+
|
103 |
+
// Iterate through matches
|
104 |
+
foreach ( $matches[0] as $key => $match ) {
|
105 |
+
if ( isset($replacements[$match]) )
|
106 |
+
continue;
|
107 |
+
if ( isset($user) && isset($user->{$matches[1][$key]}) )
|
108 |
+
$replacements[$match] = $user->{$matches[1][$key]};
|
109 |
+
else
|
110 |
+
$replacements[$match] = get_bloginfo($matches[1][$key]);
|
111 |
+
}
|
112 |
+
return str_replace(array_keys($replacements), array_values($replacements), $text);
|
113 |
+
}
|
114 |
+
|
115 |
+
?>
|
modules/custom-passwords/custom-passwords.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Custom Passwords
|
4 |
+
Description: Enabling this module will initialize and enable custom passwords. There are no other settings for this module.
|
5 |
+
*/
|
6 |
+
|
7 |
+
add_action('tml_init', 'wdbj_tml_custom_pass_init');
|
8 |
+
function wdbj_tml_custom_pass_init() {
|
9 |
+
include_once( TML_MODULE_DIR . '/custom-passwords/hook-functions.php' );
|
10 |
+
require_once( TML_MODULE_DIR . '/custom-passwords/functions.php' );
|
11 |
+
// Password registration
|
12 |
+
add_action('register_form', 'wdbj_tml_custom_pass_form');
|
13 |
+
add_filter('registration_errors', 'wdbj_tml_custom_pass_errors');
|
14 |
+
add_filter('user_registration_pass', 'wdbj_tml_custom_pass_set_pass');
|
15 |
+
// Password reset
|
16 |
+
add_action('login_form_resetpass', 'wdbj_tml_custom_pass_reset_form');
|
17 |
+
add_action('login_form_rp', 'wdbj_tml_custom_pass_reset_form');
|
18 |
+
add_action('login_action_resetpass', 'wdbj_tml_custom_pass_reset_action');
|
19 |
+
add_action('login_action_rp', 'wdbj_tml_custom_pass_reset_action');
|
20 |
+
// Template messages
|
21 |
+
add_filter('login_message', 'wdbj_tml_custom_pass_login_message');
|
22 |
+
add_filter('lostpassword_message', 'wdbj_tml_custom_pass_lostpassword_message');
|
23 |
+
add_action('template_redirect', 'wdbj_tml_custom_pass_messages', 100);
|
24 |
+
// Redirection
|
25 |
+
add_filter('register_redirect', 'wdbj_tml_custom_pass_register_redirect');
|
26 |
+
add_filter('resetpass_redirect', 'wdbj_tml_custom_pass_resetpass_redirect');
|
27 |
+
}
|
28 |
+
|
29 |
+
?>
|
modules/custom-passwords/functions.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_custom_pass_validate_reset_key($key, $login) {
|
4 |
+
global $wpdb;
|
5 |
+
|
6 |
+
$key = preg_replace('/[^a-z0-9]/i', '', $key);
|
7 |
+
|
8 |
+
if ( empty( $key ) || !is_string( $key ) )
|
9 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
10 |
+
|
11 |
+
if ( empty($login) || !is_string($login) )
|
12 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
13 |
+
|
14 |
+
$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login));
|
15 |
+
if ( empty( $user ) )
|
16 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
17 |
+
|
18 |
+
return $user;
|
19 |
+
}
|
20 |
+
|
21 |
+
function wdbj_tml_custom_pass_reset_pass() {
|
22 |
+
|
23 |
+
$user = wdbj_tml_custom_pass_validate_reset_key($_REQUEST['key'], $_REQUEST['login']);
|
24 |
+
if ( is_wp_error($user) )
|
25 |
+
return $user;
|
26 |
+
|
27 |
+
$errors = wdbj_tml_custom_pass_errors(new WP_Error());
|
28 |
+
if ( $errors->get_error_code() )
|
29 |
+
return $errors;
|
30 |
+
|
31 |
+
$new_pass = $_POST['pass1'];
|
32 |
+
|
33 |
+
do_action('password_reset', $user->user_login, $new_pass);
|
34 |
+
|
35 |
+
wp_set_password($new_pass, $user->ID);
|
36 |
+
update_usermeta($user->ID, 'default_password_nag', false);
|
37 |
+
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
|
38 |
+
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
|
39 |
+
$message .= site_url('wp-login.php', 'login') . "\r\n";
|
40 |
+
|
41 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
42 |
+
// we want to reverse this for the plain text arena of emails.
|
43 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
44 |
+
|
45 |
+
$title = sprintf(__('[%s] Your new password'), $blogname);
|
46 |
+
|
47 |
+
$title = apply_filters('password_reset_title', $title, $user->ID);
|
48 |
+
$message = apply_filters('password_reset_message', $message, $new_pass, $user->ID);
|
49 |
+
|
50 |
+
if ( $message && !wp_mail($user->user_email, $title, $message) )
|
51 |
+
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
52 |
+
|
53 |
+
wp_password_change_notification($user);
|
54 |
+
|
55 |
+
return true;
|
56 |
+
}
|
57 |
+
|
58 |
+
?>
|
modules/custom-passwords/hook-functions.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_custom_pass_form($instance_id) {
|
4 |
+
?>
|
5 |
+
<p><label for="pass1-<?php echo $instance_id; ?>"><?php _e('Password:', 'theme-my-login');?></label>
|
6 |
+
<input autocomplete="off" name="pass1" id="pass1-<?php echo $instance_id; ?>" class="input" size="20" value="" type="password" /></p>
|
7 |
+
<p><label for="pass2-<?php echo $instance_id; ?>"><?php _e('Confirm Password:', 'theme-my-login');?></label>
|
8 |
+
<input autocomplete="off" name="pass2" id="pass2-<?php echo $instance_id; ?>" class="input" size="20" value="" type="password" /></p>
|
9 |
+
<?php
|
10 |
+
}
|
11 |
+
|
12 |
+
function wdbj_tml_custom_pass_errors($errors = '') {
|
13 |
+
if ( empty($_POST['pass1']) || $_POST['pass1'] == '' || empty($_POST['pass2']) || $_POST['pass2'] == '' ) {
|
14 |
+
$errors->add('empty_password', __('<strong>ERROR</strong>: Please enter a password.'));
|
15 |
+
} elseif ( $_POST['pass1'] !== $_POST['pass2'] ) {
|
16 |
+
$errors->add('password_mismatch', __('<strong>ERROR</strong>: Your passwords do not match.'));
|
17 |
+
} elseif ( strlen($_POST['pass1']) < 6 ) {
|
18 |
+
$errors->add('password_length', __('<strong>ERROR</strong>: Your password must be at least 6 characters in length.'));
|
19 |
+
} else {
|
20 |
+
$_POST['user_pw'] = $_POST['pass1'];
|
21 |
+
}
|
22 |
+
return $errors;
|
23 |
+
}
|
24 |
+
|
25 |
+
function wdbj_tml_custom_pass_set_pass($user_pass) {
|
26 |
+
if ( isset($_POST['user_pw']) && !empty($_POST['user_pw']) )
|
27 |
+
$user_pass = $_POST['user_pw'];
|
28 |
+
return $user_pass;
|
29 |
+
}
|
30 |
+
|
31 |
+
function wdbj_tml_custom_pass_reset_action() {
|
32 |
+
$user = wdbj_tml_custom_pass_validate_reset_key($_GET['key'], $_GET['login']);
|
33 |
+
if ( is_wp_error($user) ) {
|
34 |
+
$redirect_to = site_url('wp-login.php?action=lostpassword&error=invalidkey');
|
35 |
+
if ( 'tml-page' != wdbj_tml_get_var('request_instance') )
|
36 |
+
$redirect_to = wdbj_tml_get_current_url('action=lostpassword&error=invalidkey&instance=' . wdbj_tml_get_var('request_instance'));
|
37 |
+
wp_redirect($redirect_to);
|
38 |
+
exit();
|
39 |
+
}
|
40 |
+
|
41 |
+
if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
42 |
+
$errors = wdbj_tml_custom_pass_reset_pass();
|
43 |
+
if ( ! is_wp_error($errors) ) {
|
44 |
+
$redirect_to = site_url('wp-login.php?resetpass=complete');
|
45 |
+
if ( 'tml-page' != wdbj_tml_get_var('request_instance') )
|
46 |
+
$redirect_to = wdbj_tml_get_current_url('resetpass=complete&instance=' . wdbj_tml_get_var('request_instance'));
|
47 |
+
wp_redirect($redirect_to);
|
48 |
+
exit();
|
49 |
+
} else wdbj_tml_set_error($errors);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
function wdbj_tml_custom_pass_reset_form($instance_id) {
|
54 |
+
$message = apply_filters('resetpass_message', __('Please enter a new password.', 'theme-my-login'));
|
55 |
+
|
56 |
+
wdbj_tml_get_header($message);
|
57 |
+
|
58 |
+
if ( ! wdbj_tml_get_error('invalid_key') ) {
|
59 |
+
?>
|
60 |
+
<form name="resetpasswordform" id="resetpasswordform-<?php echo $instance_id; ?>" action="<?php echo esc_url(wdbj_tml_get_current_url('action=rp&key=' . $_GET['key'] . '&login=' . $_GET['login'] . '&instance=' . $instance_id)); ?>" method="post">
|
61 |
+
<p>
|
62 |
+
<label for="pass1-<?php echo $instance_id; ?>"><?php _e('New Password:', 'theme-my-login');?></label>
|
63 |
+
<input autocomplete="off" name="pass1" id="pass1-<?php echo $instance_id; ?>" class="input" size="20" value="" type="password" />
|
64 |
+
</p>
|
65 |
+
<p>
|
66 |
+
<label for="pass2-<?php echo $instance_id; ?>"><?php _e('Confirm Password:', 'theme-my-login');?></label>
|
67 |
+
<input autocomplete="off" name="pass2" id="pass2-<?php echo $instance_id; ?>" class="input" size="20" value="" type="password" />
|
68 |
+
</p>
|
69 |
+
<?php do_action('resetpassword_form', $instance_id); ?>
|
70 |
+
<p class="submit">
|
71 |
+
<input type="submit" name="wp-submit" id="wp-submit-<?php echo $instance_id; ?>" value="<?php _e('Change Password', 'theme-my-login'); ?>" />
|
72 |
+
</p>
|
73 |
+
</form>
|
74 |
+
<?php
|
75 |
+
}
|
76 |
+
wdbj_tml_get_footer(true, true, false);
|
77 |
+
}
|
78 |
+
|
79 |
+
function wdbj_tml_custom_pass_register_redirect($redirect_to) {
|
80 |
+
$request_instance = wdbj_tml_get_var('request_instance');
|
81 |
+
$redirect_to = site_url('wp-login.php?registration=complete');
|
82 |
+
if ( 'tml-page' != $request_instance )
|
83 |
+
$redirect_to = wdbj_tml_get_current_url('registration=complete&instance=' . $request_instance);
|
84 |
+
return $redirect_to;
|
85 |
+
}
|
86 |
+
|
87 |
+
function wdbj_tml_custom_pass_resetpass_redirect($redirect_to) {
|
88 |
+
$request_instance = wdbj_tml_get_var('request_instance');
|
89 |
+
$redirect_to = site_url('wp-login.php?resetpass=complete');
|
90 |
+
if ( 'tml-page' != $request_instance )
|
91 |
+
$redirect_to = wdbj_tml_get_current_url('resetpass=complete&instance=' . $request_instance);
|
92 |
+
return $redirect_to;
|
93 |
+
}
|
94 |
+
|
95 |
+
function wdbj_tml_custom_pass_login_message($message) {
|
96 |
+
if ( isset($_GET['action']) && 'register' == $_GET['action'] )
|
97 |
+
$message = '';
|
98 |
+
return $message;
|
99 |
+
}
|
100 |
+
|
101 |
+
function wdbj_tml_custom_pass_lostpassword_message($message) {
|
102 |
+
$message = __('Please enter your username or e-mail address. You will recieve an e-mail with a link to reset your password.', 'theme-my-login');
|
103 |
+
return $message;
|
104 |
+
}
|
105 |
+
|
106 |
+
function wdbj_tml_custom_pass_messages() {
|
107 |
+
if ( isset($_GET['registration']) && 'complete' == $_GET['registration'] )
|
108 |
+
wdbj_tml_set_error('registration_complete', __('Registration complete. You may now log in.', 'theme-my-login'), 'message');
|
109 |
+
elseif ( isset($_GET['resetpass']) && 'complete' == $_GET['resetpass'] )
|
110 |
+
wdbj_tml_set_error('password_saved', __('Your password has been saved. You may now log in.', 'theme-my-login'), 'message');
|
111 |
+
}
|
112 |
+
|
113 |
+
?>
|
modules/custom-redirection/admin.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_custom_redirect_admin_menu() {
|
4 |
+
global $wp_roles;
|
5 |
+
$parent = plugin_basename(TML_MODULE_DIR . '/custom-redirection/admin/options.php');
|
6 |
+
wdbj_tml_add_menu_page(__('Redirection', 'theme-my-login'), $parent);
|
7 |
+
$user_roles = $wp_roles->get_names();
|
8 |
+
foreach ( $user_roles as $role => $label ) {
|
9 |
+
if ( 'pending' == $role )
|
10 |
+
continue;
|
11 |
+
wdbj_tml_add_submenu_page($parent, translate_user_role($label), '', 'wdbj_tml_custom_redirect_user_role_admin_page', array('role' => $role));
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
function wdbj_tml_custom_redirect_user_role_admin_page($role) {
|
16 |
+
$redirection = wdbj_tml_get_option('redirection', $role);
|
17 |
+
?>
|
18 |
+
<table class="form-table">
|
19 |
+
<tr valign="top">
|
20 |
+
<th scope="row"><?php _e('Log in'); ?></th>
|
21 |
+
<td>
|
22 |
+
<input name="theme_my_login[redirection][<?php echo $role; ?>][login_type]" type="radio" id="theme_my_login_redirection_<?php echo $role; ?>_login_type_default" value="default"<?php checked('default', $redirection['login_type']); ?> /> <label for="theme_my_login_redirection_<?php echo $role; ?>_login_type_default"><?php _e('Default', 'theme-my-login'); ?></label><br />
|
23 |
+
<input name="theme_my_login[redirection][<?php echo $role; ?>][login_type]" type="radio" id="theme_my_login_redirection_<?php echo $role; ?>_login_type_referer" value="referer"<?php checked('referer', $redirection['login_type']); ?> /> <label for="theme_my_login_redirection_<?php echo $role; ?>_login_type_referer"><?php _e('Referer', 'theme-my-login'); ?></label><br />
|
24 |
+
<input name="theme_my_login[redirection][<?php echo $role; ?>][login_type]" type="radio" id="theme_my_login_redirection_<?php echo $role; ?>_login_type_custom" value="custom"<?php checked('custom', $redirection['login_type']); ?> />
|
25 |
+
<input name="theme_my_login[redirection][<?php echo $role; ?>][login_url]" type="text" id="theme_my_login_redirection_<?php echo $role; ?>_login_url" value="<?php echo $redirection['login_url']; ?>" class="regular-text" />
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
<tr valign="top">
|
29 |
+
<th scope="row"><?php _e('Log out'); ?></th>
|
30 |
+
<td>
|
31 |
+
<input name="theme_my_login[redirection][<?php echo $role; ?>][logout_type]" type="radio" id="theme_my_login_redirection_<?php echo $role; ?>_logout_type_default" value="default"<?php checked('default', $redirection['logout_type']); ?> /> <label for="theme_my_login_redirection_<?php echo $role; ?>_logout_type_default"><?php _e('Default', 'theme-my-login'); ?></label><br />
|
32 |
+
<input name="theme_my_login[redirection][<?php echo $role; ?>][logout_type]" type="radio" id="theme_my_login_redirection_<?php echo $role; ?>_logout_type_referer" value="referer"<?php checked('referer', $redirection['logout_type']); ?> /> <label for="theme_my_login_redirection_<?php echo $role; ?>_logout_type_referer"><?php _e('Referer', 'theme-my-login'); ?></label><br />
|
33 |
+
<input name="theme_my_login[redirection][<?php echo $role; ?>][logout_type]" type="radio" id="theme_my_login_redirection_<?php echo $role; ?>_logout_type_custom" value="custom"<?php checked('custom', $redirection['logout_type']); ?> />
|
34 |
+
<input name="theme_my_login[redirection][<?php echo $role; ?>][logout_url]" type="text" id="theme_my_login_redirection_<?php echo $role; ?>_logout_url" value="<?php echo $redirection['logout_url']; ?>" class="regular-text" />
|
35 |
+
</td>
|
36 |
+
</tr>
|
37 |
+
</table>
|
38 |
+
<?php
|
39 |
+
}
|
40 |
+
|
41 |
+
?>
|
modules/custom-redirection/custom-redirection.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Custom Redirection
|
4 |
+
Description: Enabling this module will initialize custom redirection. You will then have to configure the settings via the "Redirection" tab.
|
5 |
+
*/
|
6 |
+
|
7 |
+
add_action('tml_init', 'wdbj_tml_custom_redirect_init');
|
8 |
+
function wdbj_tml_custom_redirect_init() {
|
9 |
+
include( TML_MODULE_DIR . '/custom-redirection/hook-functions.php' );
|
10 |
+
add_filter('login_redirect', 'wdbj_tml_custom_redirect_login', 10, 3);
|
11 |
+
add_filter('logout_redirect', 'wdbj_tml_custom_redirect_logout', 10, 3);
|
12 |
+
add_action('login_form', 'wdbj_tml_custom_redirect_login_form');
|
13 |
+
}
|
14 |
+
|
15 |
+
add_action('tml_admin_init', 'wdbj_tml_custom_redirect_admin_init');
|
16 |
+
function wdbj_tml_custom_redirect_admin_init() {
|
17 |
+
require_once (TML_MODULE_DIR . '/custom-redirection/admin.php');
|
18 |
+
add_action('tml_admin_menu', 'wdbj_tml_custom_redirect_admin_menu');
|
19 |
+
}
|
20 |
+
|
21 |
+
add_action('activate_custom-redirection/custom-redirection.php', 'wdbj_tml_custom_redirection_activate');
|
22 |
+
function wdbj_tml_custom_redirection_activate() {
|
23 |
+
$current = wdbj_tml_get_option('redirection');
|
24 |
+
$default = wdbj_tml_custom_redirect_default_settings();
|
25 |
+
|
26 |
+
if ( is_array($current) )
|
27 |
+
wdbj_tml_update_option(array_merge($default, $current), 'redirection');
|
28 |
+
else
|
29 |
+
wdbj_tml_update_option($default, 'redirection');
|
30 |
+
|
31 |
+
unset($current, $default);
|
32 |
+
}
|
33 |
+
|
34 |
+
function wdbj_tml_custom_redirect_default_settings() {
|
35 |
+
global $wp_roles;
|
36 |
+
foreach ( $wp_roles->get_names() as $role => $label ) {
|
37 |
+
$options[$role] = array('login_type' => 'default', 'login_url' => '', 'logout_type' => 'default', 'logout_url' => '');
|
38 |
+
}
|
39 |
+
return $options;
|
40 |
+
}
|
41 |
+
|
42 |
+
?>
|
modules/custom-redirection/hook-functions.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_custom_redirect_login_form($instance_id) {
|
4 |
+
$jump_back_to = 'tml-page' == $instance_id ? 'previous' : 'current';
|
5 |
+
wp_original_referer_field(true, $jump_back_to);
|
6 |
+
echo "\n";
|
7 |
+
}
|
8 |
+
|
9 |
+
function wdbj_tml_custom_redirect_login($redirect_to, $request, $user) {
|
10 |
+
global $pagenow;
|
11 |
+
|
12 |
+
if ( 'wp-login.php' == $pagenow )
|
13 |
+
return $redirect_to;
|
14 |
+
|
15 |
+
// Bailout if this isn't a login
|
16 |
+
if ( 'POST' != $_SERVER['REQUEST_METHOD'] )
|
17 |
+
return $redirect_to;
|
18 |
+
|
19 |
+
$orig_redirect = $redirect_to;
|
20 |
+
|
21 |
+
// Determine the correct referer
|
22 |
+
$http_referer = isset($_REQUEST['_wp_original_http_referer']) ? $_REQUEST['_wp_original_http_referer'] : $_SERVER['HTTP_REFERER'];
|
23 |
+
|
24 |
+
// User is logged in
|
25 |
+
if ( is_object($user) && !is_wp_error($user) ) {
|
26 |
+
$user_role = reset($user->roles);
|
27 |
+
$redirection = wdbj_tml_get_option('redirection', $user_role);
|
28 |
+
if ( 'default' == $redirection['login_type'] )
|
29 |
+
$redirect_to = $orig_redirect;
|
30 |
+
elseif ( 'referer' == $redirection['login_type'] )
|
31 |
+
$redirect_to = $http_referer;
|
32 |
+
else {
|
33 |
+
$redirect_to = $redirection['login_url'];
|
34 |
+
// Allow a few user specific variables
|
35 |
+
$replace = array('%user_id%' => $user->ID, '%user_login%' => $user->user_login);
|
36 |
+
$redirect_to = str_replace(array_keys($replace), array_values($replace), $redirect_to);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
if ( isset($request) && admin_url() != $request )
|
41 |
+
$redirect_to = $request;
|
42 |
+
|
43 |
+
return $redirect_to;
|
44 |
+
}
|
45 |
+
|
46 |
+
function wdbj_tml_custom_redirect_logout($redirect_to, $request, $user) {
|
47 |
+
|
48 |
+
$orig_redirect = $redirect_to;
|
49 |
+
|
50 |
+
// Determine the correct referer
|
51 |
+
$http_referer = isset($_REQUEST['_wp_original_http_referer']) ? $_REQUEST['_wp_original_http_referer'] : $_SERVER['HTTP_REFERER'];
|
52 |
+
$http_referer = remove_query_arg(array('instance', 'action', 'checkemail', 'error', 'loggedout', 'registered', 'redirect_to', 'updated', 'key', '_wpnonce'), $http_referer);
|
53 |
+
|
54 |
+
if ( is_object($user) && !is_wp_error($user) ) {
|
55 |
+
$user_role = reset($user->roles);
|
56 |
+
$redirection = wdbj_tml_get_option('redirection', $user_role);
|
57 |
+
if ( 'default' == $redirection['logout_type'] )
|
58 |
+
$redirect_to = $orig_redirect;
|
59 |
+
elseif ( 'referer' == $redirection['logout_type'] )
|
60 |
+
$redirect_to = $http_referer;
|
61 |
+
else {
|
62 |
+
$redirect_to = $redirection['logout_url'];
|
63 |
+
// Allow a few user specific variables
|
64 |
+
$replace = array('%user_id%' => $user->ID, '%user_login%' => $user->user_login);
|
65 |
+
$redirect_to = str_replace(array_keys($replace), array_values($replace), $redirect_to);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( strpos($redirect_to, 'wp-admin') !== false )
|
70 |
+
$redirect_to = add_query_arg('loggedout', 'true', get_permalink(wdbj_tml_get_option('page_id')));
|
71 |
+
|
72 |
+
return $redirect_to;
|
73 |
+
}
|
74 |
+
|
75 |
+
?>
|
modules/custom-user-links/admin/admin.css
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div.user-links {
|
2 |
+
border: none;
|
3 |
+
padding: 10px;
|
4 |
+
}
|
5 |
+
|
6 |
+
div.user-links div.ajax-response {
|
7 |
+
border: none;
|
8 |
+
}
|
9 |
+
|
10 |
+
.user-links .submit input {
|
11 |
+
text-decoration: none;
|
12 |
+
font-size: 11px !important;
|
13 |
+
line-height: 13px;
|
14 |
+
padding: 3px 8px;
|
15 |
+
cursor: pointer;
|
16 |
+
border-width: 1px;
|
17 |
+
border-style: solid;
|
18 |
+
-moz-border-radius: 11px;
|
19 |
+
-khtml-border-radius: 11px;
|
20 |
+
-webkit-border-radius: 11px;
|
21 |
+
border-radius: 11px;
|
22 |
+
-moz-box-sizing: content-box;
|
23 |
+
-webkit-box-sizing: content-box;
|
24 |
+
-khtml-box-sizing: content-box;
|
25 |
+
box-sizing: content-box;
|
26 |
+
}
|
27 |
+
|
28 |
+
.user-links table,
|
29 |
+
.user-links input,
|
30 |
+
.user-links textarea {
|
31 |
+
border-width: 1px;
|
32 |
+
border-style: solid;
|
33 |
+
-moz-border-radius: 3px;
|
34 |
+
-khtml-border-radius: 3px;
|
35 |
+
-webkit-border-radius: 3px;
|
36 |
+
border-radius: 3px;
|
37 |
+
}
|
38 |
+
|
39 |
+
.user-links .updatelink,
|
40 |
+
.user-links .deletelink {
|
41 |
+
margin: auto;
|
42 |
+
}
|
43 |
+
|
44 |
+
.user-links thead th {
|
45 |
+
padding: 5px 8px 8px;
|
46 |
+
background-color: #f1f1f1;
|
47 |
+
}
|
48 |
+
|
49 |
+
.user-links .submit {
|
50 |
+
border: 0 none;
|
51 |
+
float: none;
|
52 |
+
padding: 5px 8px;
|
53 |
+
width: 25%;
|
54 |
+
}
|
55 |
+
|
56 |
+
.user-links table {
|
57 |
+
margin: 0;
|
58 |
+
width: 100%;
|
59 |
+
border-width: 1px;
|
60 |
+
border-style: solid;
|
61 |
+
border-spacing: 0;
|
62 |
+
border-color: #dfdfdf;
|
63 |
+
background-color: #f9f9f9;
|
64 |
+
}
|
65 |
+
|
66 |
+
.user-links table input,
|
67 |
+
.user-links table select {
|
68 |
+
width: 95%;
|
69 |
+
margin: 8px 0 8px 8px;
|
70 |
+
border-color: #dfdfdf;
|
71 |
+
background-color: #fff;
|
72 |
+
}
|
73 |
+
|
74 |
+
.user-links th.left,
|
75 |
+
.user-links td.left {
|
76 |
+
width: 35%;
|
77 |
+
}
|
78 |
+
|
79 |
+
.user-links td.center {
|
80 |
+
text-align: center;
|
81 |
+
}
|
82 |
+
|
83 |
+
.user-links .submit input {
|
84 |
+
width: auto;
|
85 |
+
}
|
modules/custom-user-links/admin/admin.php
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_custom_user_links_admin_menu() {
|
4 |
+
global $wp_roles;
|
5 |
+
$parent = plugin_basename(TML_MODULE_DIR . '/custom-user-links/admin/options.php');
|
6 |
+
wdbj_tml_add_menu_page(__('User Links', 'theme-my-login'), $parent);
|
7 |
+
foreach ( $wp_roles->get_names() as $role => $label ) {
|
8 |
+
if ( 'pending' == $role )
|
9 |
+
continue;
|
10 |
+
wdbj_tml_add_submenu_page($parent, translate_user_role($label), '', 'wdbj_tml_custom_user_links_user_role_admin_page', array('role' => $role));
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
function wdbj_tml_custom_user_links_save_settings($settings) {
|
15 |
+
if ( defined('DOING_AJAX') && DOING_AJAX )
|
16 |
+
return $settings;
|
17 |
+
if ( isset($_POST['user_links']) && is_array($_POST['user_links']) && !empty($_POST['user_links']) ) {
|
18 |
+
foreach ( $_POST['user_links'] as $role => $links ) {
|
19 |
+
foreach ( $links as $key => $link_data ) {
|
20 |
+
$clean_title = wp_kses($link_data['title'], null);
|
21 |
+
$clean_url = wp_kses($link_data['url'], null);
|
22 |
+
$links[$key] = array('title' => $clean_title, 'url' => $clean_url);
|
23 |
+
if ( ( empty($clean_title) && empty($clean_url) ) || ( isset($_POST['delete_user_link'][$role][$key]) && $_POST['delete_user_link'][$role][$key] ) )
|
24 |
+
unset($links[$key]);
|
25 |
+
}
|
26 |
+
$settings['user_links'][$role] = array_values($links);
|
27 |
+
}
|
28 |
+
unset($role, $links, $key, $link_data, $clean_title, $clean_url);
|
29 |
+
}
|
30 |
+
if ( isset($_POST['new_user_link']) && is_array($_POST['new_user_link']) && !empty($_POST['new_user_link']) ) {
|
31 |
+
foreach ( $_POST['new_user_link'] as $role => $link_data ) {
|
32 |
+
$clean_title = wp_kses($link_data['title'], null);
|
33 |
+
$clean_url = wp_kses($link_data['url'], null);
|
34 |
+
if ( !empty($clean_title) && !empty($clean_url) )
|
35 |
+
$settings['user_links'][$role][] = array('title' => $clean_title, 'url' => $clean_url);
|
36 |
+
}
|
37 |
+
unset($role, $link_data, $clean_title, $clean_url);
|
38 |
+
}
|
39 |
+
// Reset link keys
|
40 |
+
foreach ( $settings['user_links'] as $role => $links ) {
|
41 |
+
$settings['user_links'][$role] = array_values($links);
|
42 |
+
}
|
43 |
+
return $settings;
|
44 |
+
}
|
45 |
+
|
46 |
+
function wdbj_tml_custom_user_links_admin_styles() {
|
47 |
+
wp_enqueue_style('theme-my-login-custom-user-links-admin', plugins_url('theme-my-login/modules/custom-user-links/admin/admin.css'));
|
48 |
+
wp_enqueue_script('jquery');
|
49 |
+
wp_enqueue_script('wp-lists');
|
50 |
+
add_action('admin_print_footer_scripts', 'wdbj_tml_custom_user_links_admin_scripts', 20);
|
51 |
+
}
|
52 |
+
|
53 |
+
function wdbj_tml_custom_user_links_admin_scripts() {
|
54 |
+
global $wp_roles;
|
55 |
+
|
56 |
+
echo '<script type="text/javascript">' . "\n";
|
57 |
+
echo 'jQuery(document).ready(function($) {' . "\n";
|
58 |
+
foreach ( $wp_roles->get_names() as $role => $label ) {
|
59 |
+
?>
|
60 |
+
$('#<?php echo $role; ?>-link-list').wpList( {
|
61 |
+
addAfter: function( xml, s ) {
|
62 |
+
$('table#<?php echo $role; ?>-link-table').show();
|
63 |
+
},
|
64 |
+
addBefore: function( s ) {
|
65 |
+
s.data += '&user_role=<?php echo $role; ?>';
|
66 |
+
return s;
|
67 |
+
},
|
68 |
+
delBefore: function( s ) {
|
69 |
+
s.data.user_role = '<?php echo $role; ?>';
|
70 |
+
return s;
|
71 |
+
},
|
72 |
+
delAfter: function( r, s ) {
|
73 |
+
$('#' + s.element).remove();
|
74 |
+
}
|
75 |
+
} );
|
76 |
+
<?php
|
77 |
+
}
|
78 |
+
echo '});' . "\n";
|
79 |
+
echo '</script>' . "\n";
|
80 |
+
}
|
81 |
+
|
82 |
+
function wdbj_tml_custom_user_links_user_role_admin_page($role) {
|
83 |
+
$links = wdbj_tml_get_option('user_links', $role);
|
84 |
+
if ( empty($links) )
|
85 |
+
$links = array();
|
86 |
+
?>
|
87 |
+
<div id="<?php echo $role; ?>-user-links" class="user-links">
|
88 |
+
<div id="ajax-response-<?php echo $role; ?>" class="ajax-response"></div>
|
89 |
+
<?php
|
90 |
+
wdbj_tml_custom_user_links_list_links($links, $role);
|
91 |
+
wdbj_tml_custom_user_links_link_form($role); ?>
|
92 |
+
</div>
|
93 |
+
<?php
|
94 |
+
}
|
95 |
+
|
96 |
+
function wdbj_tml_custom_user_links_list_links($links, $role) {
|
97 |
+
// Exit if no links
|
98 |
+
if ( ! $links ) {
|
99 |
+
echo '
|
100 |
+
<table id="' . $role . '-link-table" style="display: none;">
|
101 |
+
<thead>
|
102 |
+
<tr>
|
103 |
+
<th class="left">' . __( 'Title', 'theme-my-login' ) . '</th>
|
104 |
+
<th>' . __( 'URL', 'theme-my-login' ) . '</th>
|
105 |
+
<th></th>
|
106 |
+
</tr>
|
107 |
+
</thead>
|
108 |
+
<tbody id="' . $role . '-link-list" class="list:' . $role . '-link">
|
109 |
+
<tr><td></td></tr>
|
110 |
+
</tbody>
|
111 |
+
</table>'; //TBODY needed for list-manipulation JS
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
$count = 0;
|
115 |
+
?>
|
116 |
+
<table id="<?php echo $role; ?>-link-table">
|
117 |
+
<thead>
|
118 |
+
<tr>
|
119 |
+
<th class="left"><?php _e( 'Title', 'theme-my-login' ) ?></th>
|
120 |
+
<th><?php _e( 'URL', 'theme-my-login' ) ?></th>
|
121 |
+
<th></th>
|
122 |
+
</tr>
|
123 |
+
</thead>
|
124 |
+
<tbody id='<?php echo $role; ?>-link-list' class='list:<?php echo $role; ?>-link'>
|
125 |
+
<?php
|
126 |
+
foreach ( $links as $key => $link ) {
|
127 |
+
$link['id'] = $key + 1; // Artificially inflate as not to use 0 as a key
|
128 |
+
echo _wdbj_tml_custom_user_links_link_row( $link, $role, $count );
|
129 |
+
}
|
130 |
+
?>
|
131 |
+
</tbody>
|
132 |
+
</table>
|
133 |
+
<?php
|
134 |
+
}
|
135 |
+
|
136 |
+
function _wdbj_tml_custom_user_links_link_row( $link, $role, &$count ) {
|
137 |
+
$r = '';
|
138 |
+
++ $count;
|
139 |
+
if ( $count % 2 )
|
140 |
+
$style = 'alternate';
|
141 |
+
else
|
142 |
+
$style = '';
|
143 |
+
|
144 |
+
$link = (object) $link;
|
145 |
+
|
146 |
+
$delete_nonce = wp_create_nonce( 'delete-' . $role . '-link_' . $link->id );
|
147 |
+
$update_nonce = wp_create_nonce( 'add-' . $role . '-link' );
|
148 |
+
|
149 |
+
$r .= "\n\t<tr id='$role-link-$link->id' class='$style'>";
|
150 |
+
$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='user_links[$role][$link->id][title]'>" . __( 'Title', 'theme-my-login' ) . "</label><input name='user_links[$role][$link->id][title]' id='user_links[$role][$link->id][title]' tabindex='6' type='text' size='20' value='$link->title' />";
|
151 |
+
$r .= wp_nonce_field( 'change-' . $role . '-link', '_ajax_nonce', false, false );
|
152 |
+
$r .= "</td>";
|
153 |
+
|
154 |
+
$r .= "\n\t\t<td class='center'><label class='screen-reader-text' for='user_links[$role][$link->id][url]'>" . __( 'URL', 'theme-my-login' ) . "</label><input name='user_links[$role][$link->id][url]' id='user_links[$role][$link->id][url]' tabindex='6' type='text' size='20' value='$link->url' /></td>";
|
155 |
+
|
156 |
+
$r .= "\n\t\t<td class='submit'><input name='delete_user_link[$role][$link->id]' type='submit' class='delete:$role-link-list:$role-link-$link->id::_ajax_nonce=$delete_nonce deletelink' tabindex='6' value='". esc_attr__( 'Delete' ) ."' />";
|
157 |
+
$r .= "\n\t\t<input name='updatelink' type='submit' class='add:$role-link-list:$role-link-$link->id::_ajax_nonce=$update_nonce updatelink' tabindex='6' value='". esc_attr__( 'Update' ) ."' /></td>\n\t</tr>";
|
158 |
+
return $r;
|
159 |
+
}
|
160 |
+
|
161 |
+
function wdbj_tml_custom_user_links_link_form($role) {
|
162 |
+
?>
|
163 |
+
<p><strong><?php _e( 'Add New link:' ) ?></strong></p>
|
164 |
+
<table id="new-<?php echo $role; ?>-link">
|
165 |
+
<thead>
|
166 |
+
<tr>
|
167 |
+
<th class="left"><label for="new_user_link[<?php echo $role; ?>][title]"><?php _e( 'Title', 'theme-my-login' ) ?></label></th>
|
168 |
+
<th><label for="new_user_link[<?php echo $role; ?>][url]"><?php _e( 'URL', 'theme-my-login' ) ?></label></th>
|
169 |
+
<th></th>
|
170 |
+
</tr>
|
171 |
+
</thead>
|
172 |
+
|
173 |
+
<tbody>
|
174 |
+
<tr>
|
175 |
+
<td class="left"><input id="new_user_link[<?php echo $role; ?>][title]" name="new_user_link[<?php echo $role; ?>][title]" type="text" tabindex="8" size="20" /></td>
|
176 |
+
<td class="center"><input id="new_user_link[<?php echo $role; ?>][url]" name="new_user_link[<?php echo $role; ?>][url]" type="text" tabindex="8" size="20" /></td>
|
177 |
+
|
178 |
+
<td class="submit">
|
179 |
+
<input type="submit" id="add_new_user_link_<?php echo $role; ?>" name="add_new_user_link[<?php echo $role; ?>]" class="add:<?php echo $role; ?>-link-list:new-<?php echo $role; ?>-link" tabindex="9" value="<?php esc_attr_e( 'Add link', 'theme-my-login' ) ?>" />
|
180 |
+
<?php wp_nonce_field( 'add-' . $role . '-link', '_ajax_nonce', false ); ?>
|
181 |
+
</td></tr>
|
182 |
+
</tbody>
|
183 |
+
</table>
|
184 |
+
<?php
|
185 |
+
}
|
186 |
+
|
187 |
+
function wdbj_tml_custom_user_links_add_user_link_ajax() {
|
188 |
+
|
189 |
+
$user_role = isset($_POST['user_role']) ? $_POST['user_role'] : '';
|
190 |
+
|
191 |
+
check_ajax_referer( 'add-' . $user_role . '-link' );
|
192 |
+
|
193 |
+
$c = 0;
|
194 |
+
if ( isset($_POST['new_user_link'][$user_role]['title']) || isset($_POST['new_user_link'][$user_role]['url']) ) {
|
195 |
+
if ( !current_user_can( 'manage_options' ) )
|
196 |
+
die('-1');
|
197 |
+
|
198 |
+
$clean_title = wp_kses($_POST['new_user_link'][$user_role]['title'], null);
|
199 |
+
$clean_url = wp_kses($_POST['new_user_link'][$user_role]['url'], null);
|
200 |
+
|
201 |
+
if ( empty($clean_title) || empty($clean_url) )
|
202 |
+
die('1');
|
203 |
+
|
204 |
+
// Get current links
|
205 |
+
$links = wdbj_tml_get_option('user_links', $user_role);
|
206 |
+
// Add new link
|
207 |
+
$links[] = array('title' => $clean_title, 'url' => $clean_url);
|
208 |
+
// Update links
|
209 |
+
wdbj_tml_update_option($links, 'user_links', $user_role);
|
210 |
+
// Save links
|
211 |
+
wdbj_tml_save_options();
|
212 |
+
|
213 |
+
$link_row = array_merge( array('id' => max(array_keys($links)) + 1), array_pop($links) );
|
214 |
+
|
215 |
+
$x = new WP_Ajax_Response( array(
|
216 |
+
'what' => 'tml-user-link',
|
217 |
+
'id' => $link_row['id'],
|
218 |
+
'data' => _wdbj_tml_custom_user_links_link_row( $link_row, $user_role, $c ),
|
219 |
+
'position' => 1,
|
220 |
+
'supplemental' => array('user_role' => $user_role)
|
221 |
+
) );
|
222 |
+
} else {
|
223 |
+
$user_links = array_pop($_POST['user_links']);
|
224 |
+
$id = (int) key($user_links);
|
225 |
+
$clean_title = wp_kses($user_links[$id]['title'], null);
|
226 |
+
$clean_url = wp_kses($user_links[$id]['url'], null);
|
227 |
+
--$id; // Fix id offset
|
228 |
+
if ( !$link = wdbj_tml_get_option( 'user_links', $user_role, $id ) )
|
229 |
+
die('0'); // if link doesn't exist
|
230 |
+
if ( !current_user_can( 'manage_options' ) )
|
231 |
+
die('-1');
|
232 |
+
if ( $link['title'] != $clean_title || $link['url'] != $clean_url ) {
|
233 |
+
$link_row = array('title' => $clean_title, 'url' => $clean_url);
|
234 |
+
if ( !$u = wdbj_tml_update_option( $link_row, 'user_links', $user_role, $id ) )
|
235 |
+
die('0'); // We know link exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
|
236 |
+
wdbj_tml_save_options();
|
237 |
+
}
|
238 |
+
|
239 |
+
++$id;
|
240 |
+
$link_row['id'] = $id;
|
241 |
+
|
242 |
+
$x = new WP_Ajax_Response( array(
|
243 |
+
'what' => $user_role . '-link',
|
244 |
+
'id' => $id, 'old_id' => $id,
|
245 |
+
'data' => _wdbj_tml_custom_user_links_link_row( $link_row, $user_role, $c ),
|
246 |
+
'position' => 0,
|
247 |
+
'supplemental' => array('user_role' => $user_role)
|
248 |
+
) );
|
249 |
+
}
|
250 |
+
$x->send();
|
251 |
+
}
|
252 |
+
|
253 |
+
function wdbj_tml_custom_user_links_delete_user_link_ajax() {
|
254 |
+
global $id;
|
255 |
+
|
256 |
+
$user_role = isset($_POST['user_role']) ? $_POST['user_role'] : '';
|
257 |
+
|
258 |
+
check_ajax_referer( "delete-$user_role-link_$id" );
|
259 |
+
|
260 |
+
--$id; // Fix id offset
|
261 |
+
|
262 |
+
// Get current links
|
263 |
+
if ( $links = wdbj_tml_get_option('user_links', $user_role) ) {
|
264 |
+
if ( isset($links[$id]) ) {
|
265 |
+
// Delete link
|
266 |
+
unset($links[$id]);
|
267 |
+
// Update links
|
268 |
+
wdbj_tml_update_option($links, 'user_links', $user_role);
|
269 |
+
// Save links
|
270 |
+
wdbj_tml_save_options();
|
271 |
+
}
|
272 |
+
die('1');
|
273 |
+
}
|
274 |
+
die('0');
|
275 |
+
}
|
276 |
+
|
277 |
+
?>
|
modules/custom-user-links/custom-user-links.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Custom User Links
|
4 |
+
Description: Enabling this module will initialize custom user links. You will then have to configure the settings via the "User Links" tab.
|
5 |
+
*/
|
6 |
+
|
7 |
+
add_action('tml_init', 'wdbj_tml_custom_user_links_init');
|
8 |
+
function wdbj_tml_custom_user_links_init() {
|
9 |
+
add_filter('tml_user_links', 'wdbj_tml_custom_user_links');
|
10 |
+
}
|
11 |
+
|
12 |
+
function wdbj_tml_custom_user_links($links) {
|
13 |
+
if ( !is_user_logged_in() )
|
14 |
+
return $links;
|
15 |
+
|
16 |
+
$current_user = wp_get_current_user();
|
17 |
+
$user_role = reset($current_user->roles);
|
18 |
+
|
19 |
+
$links = wdbj_tml_get_option('user_links', $user_role);
|
20 |
+
if ( !is_array($links) || empty($links) )
|
21 |
+
$links = array();
|
22 |
+
return $links;
|
23 |
+
}
|
24 |
+
|
25 |
+
add_action('tml_admin_init', 'wdbj_tml_custom_user_links_admin_init');
|
26 |
+
function wdbj_tml_custom_user_links_admin_init() {
|
27 |
+
global $wp_roles;
|
28 |
+
require_once (TML_MODULE_DIR . '/custom-user-links/admin/admin.php');
|
29 |
+
add_action('tml_admin_menu', 'wdbj_tml_custom_user_links_admin_menu');
|
30 |
+
add_filter('tml_save_settings', 'wdbj_tml_custom_user_links_save_settings');
|
31 |
+
add_action('tml_settings_page', 'wdbj_tml_custom_user_links_admin_styles');
|
32 |
+
foreach ( $wp_roles->get_names() as $role => $label ) {
|
33 |
+
add_action('wp_ajax_add-' . $role . '-link', 'wdbj_tml_custom_user_links_add_user_link_ajax');
|
34 |
+
add_action('wp_ajax_delete-' . $role . '-link', 'wdbj_tml_custom_user_links_delete_user_link_ajax');
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
add_action('activate_custom-user-links/custom-user-links.php', 'wdbj_tml_custom_user_links_activate');
|
39 |
+
function wdbj_tml_custom_user_links_activate() {
|
40 |
+
$current = wdbj_tml_get_option('user_links');
|
41 |
+
$default = wdbj_tml_custom_user_links_default_settings();
|
42 |
+
|
43 |
+
if ( is_array($current) )
|
44 |
+
wdbj_tml_update_option(array_merge($default, $current), 'user_links');
|
45 |
+
else
|
46 |
+
wdbj_tml_update_option($default, 'user_links');
|
47 |
+
|
48 |
+
unset($current, $default);
|
49 |
+
}
|
50 |
+
|
51 |
+
function wdbj_tml_custom_user_links_default_settings() {
|
52 |
+
global $wp_roles;
|
53 |
+
foreach ( $wp_roles->get_names() as $role => $label ) {
|
54 |
+
if ( 'pending' == $role )
|
55 |
+
continue;
|
56 |
+
$options[$role] = array(
|
57 |
+
array('title' => __('Dashboard'), 'url' => admin_url()),
|
58 |
+
array('title' => __('Profile'), 'url' => admin_url('profile.php'))
|
59 |
+
);
|
60 |
+
}
|
61 |
+
return $options;
|
62 |
+
}
|
63 |
+
|
64 |
+
?>
|
modules/themed-profiles/includes/hook-functions.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_themed_profiles_site_url($url, $path, $orig_scheme = '') {
|
4 |
+
global $wp_rewrite, $current_user;
|
5 |
+
|
6 |
+
if ( is_user_logged_in() ) {
|
7 |
+
if ( strpos($url, 'profile.php') !== false ) {
|
8 |
+
$orig_url = $url;
|
9 |
+
$url = add_query_arg('action', 'profile', get_permalink(wdbj_tml_get_option('page_id')));
|
10 |
+
if ( strpos($orig_url, '?') ) {
|
11 |
+
$query = substr($orig_url, strpos($orig_url, '?') + 1);
|
12 |
+
parse_str($query, $r);
|
13 |
+
$url = add_query_arg($r, $url);
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
return $url;
|
18 |
+
}
|
19 |
+
|
20 |
+
function wdbj_tml_themed_profiles_title($title, $action) {
|
21 |
+
if ( 'profile' == $action && is_user_logged_in() && '' == wdbj_tml_get_var('current_instance', 'instance_id') )
|
22 |
+
$title = __('Your Profile', 'theme-my-login');
|
23 |
+
return $title;
|
24 |
+
}
|
25 |
+
|
26 |
+
?>
|
modules/themed-profiles/includes/template-functions.php
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_themed_profiles_display() {
|
4 |
+
global $current_user, $action, $redirect, $profile, $user_id, $wp_http_referer;
|
5 |
+
|
6 |
+
$profileuser = get_user_to_edit($current_user->ID);
|
7 |
+
|
8 |
+
wdbj_tml_get_header();
|
9 |
+
?>
|
10 |
+
<form id="your-profile" action="" method="post">
|
11 |
+
<?php wp_nonce_field('update-user_' . $current_user->ID) ?>
|
12 |
+
<?php if ( $wp_http_referer ) : ?>
|
13 |
+
<input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
|
14 |
+
<?php endif; ?>
|
15 |
+
<p>
|
16 |
+
<input type="hidden" name="from" value="profile" />
|
17 |
+
<input type="hidden" name="checkuser_id" value="<?php echo $current_user->ID; ?>" />
|
18 |
+
</p>
|
19 |
+
|
20 |
+
<?php if ( has_filter('personal_options') || has_filter('profile_personal_options') ) : ?>
|
21 |
+
<h3><?php _e('Personal Options'); ?></h3>
|
22 |
+
|
23 |
+
<table class="form-table">
|
24 |
+
<?php do_action('personal_options', $profileuser); ?>
|
25 |
+
</table>
|
26 |
+
<?php do_action('profile_personal_options', $profileuser); ?>
|
27 |
+
<?php endif; ?>
|
28 |
+
|
29 |
+
<h3><?php _e('Name') ?></h3>
|
30 |
+
|
31 |
+
<table class="form-table">
|
32 |
+
<tr>
|
33 |
+
<th><label for="user_login"><?php _e('Username'); ?></label></th>
|
34 |
+
<td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e('Your username cannot be changed.'); ?></span></td>
|
35 |
+
</tr>
|
36 |
+
|
37 |
+
<tr>
|
38 |
+
<th><label for="first_name"><?php _e('First name') ?></label></th>
|
39 |
+
<td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td>
|
40 |
+
</tr>
|
41 |
+
|
42 |
+
<tr>
|
43 |
+
<th><label for="last_name"><?php _e('Last name') ?></label></th>
|
44 |
+
<td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td>
|
45 |
+
</tr>
|
46 |
+
|
47 |
+
<tr>
|
48 |
+
<th><label for="nickname"><?php _e('Nickname'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
|
49 |
+
<td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td>
|
50 |
+
</tr>
|
51 |
+
|
52 |
+
<tr>
|
53 |
+
<th><label for="display_name"><?php _e('Display name publicly as') ?></label></th>
|
54 |
+
<td>
|
55 |
+
<select name="display_name" id="display_name">
|
56 |
+
<?php
|
57 |
+
$public_display = array();
|
58 |
+
$public_display['display_nickname'] = $profileuser->nickname;
|
59 |
+
$public_display['display_username'] = $profileuser->user_login;
|
60 |
+
if ( !empty($profileuser->first_name) )
|
61 |
+
$public_display['display_firstname'] = $profileuser->first_name;
|
62 |
+
if ( !empty($profileuser->last_name) )
|
63 |
+
$public_display['display_lastname'] = $profileuser->last_name;
|
64 |
+
if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
|
65 |
+
$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
|
66 |
+
$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
|
67 |
+
}
|
68 |
+
if ( !in_array( $profileuser->display_name, $public_display ) )// Only add this if it isn't duplicated elsewhere
|
69 |
+
$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
|
70 |
+
$public_display = array_map( 'trim', $public_display );
|
71 |
+
foreach ( $public_display as $id => $item ) {
|
72 |
+
?>
|
73 |
+
<option id="<?php echo $id; ?>" value="<?php echo esc_attr($item); ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
|
74 |
+
<?php
|
75 |
+
}
|
76 |
+
?>
|
77 |
+
</select>
|
78 |
+
</td>
|
79 |
+
</tr>
|
80 |
+
</table>
|
81 |
+
|
82 |
+
<h3><?php _e('Contact Info') ?></h3>
|
83 |
+
|
84 |
+
<table class="form-table">
|
85 |
+
<tr>
|
86 |
+
<th><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
|
87 |
+
<td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text" /></td>
|
88 |
+
</tr>
|
89 |
+
|
90 |
+
<tr>
|
91 |
+
<th><label for="url"><?php _e('Website') ?></label></th>
|
92 |
+
<td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>
|
93 |
+
</tr>
|
94 |
+
|
95 |
+
<?php if ( function_exists('_wp_get_user_contactmethods') ) :
|
96 |
+
foreach (_wp_get_user_contactmethods() as $name => $desc) {
|
97 |
+
?>
|
98 |
+
<tr>
|
99 |
+
<th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
|
100 |
+
<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
|
101 |
+
</tr>
|
102 |
+
<?php
|
103 |
+
}
|
104 |
+
endif;
|
105 |
+
?>
|
106 |
+
</table>
|
107 |
+
|
108 |
+
<h3><?php _e('About Yourself'); ?></h3>
|
109 |
+
|
110 |
+
<table class="form-table">
|
111 |
+
<tr>
|
112 |
+
<th><label for="description"><?php _e('Biographical Info'); ?></label></th>
|
113 |
+
<td><textarea name="description" id="description" rows="5" cols="30"><?php echo esc_html($profileuser->description); ?></textarea><br />
|
114 |
+
<span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td>
|
115 |
+
</tr>
|
116 |
+
|
117 |
+
<?php
|
118 |
+
$show_password_fields = apply_filters('show_password_fields', true, $profileuser);
|
119 |
+
if ( $show_password_fields ) :
|
120 |
+
?>
|
121 |
+
<tr id="password">
|
122 |
+
<th><label for="pass1"><?php _e('New Password'); ?></label></th>
|
123 |
+
<td><input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> <span class="description"><?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?></span><br />
|
124 |
+
<input type="password" name="pass2" id="pass2" size="16" value="" autocomplete="off" /> <span class="description"><?php _e("Type your new password again."); ?></span><br />
|
125 |
+
<div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
|
126 |
+
<p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).'); ?></p>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
<?php endif; ?>
|
130 |
+
</table>
|
131 |
+
|
132 |
+
<?php
|
133 |
+
do_action('show_user_profile', $profileuser);
|
134 |
+
?>
|
135 |
+
|
136 |
+
<?php if ( count($profileuser->caps) > count($profileuser->roles) && apply_filters('additional_capabilities_display', true, $profileuser) ) { ?>
|
137 |
+
<br class="clear" />
|
138 |
+
<table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
|
139 |
+
<tr>
|
140 |
+
<th scope="row"><?php _e('Additional Capabilities') ?></th>
|
141 |
+
<td><?php
|
142 |
+
$output = '';
|
143 |
+
global $wp_roles;
|
144 |
+
foreach ( $profileuser->caps as $cap => $value ) {
|
145 |
+
if ( !$wp_roles->is_role($cap) ) {
|
146 |
+
if ( $output != '' )
|
147 |
+
$output .= ', ';
|
148 |
+
$output .= $value ? $cap : "Denied: {$cap}";
|
149 |
+
}
|
150 |
+
}
|
151 |
+
echo $output;
|
152 |
+
?></td>
|
153 |
+
</tr>
|
154 |
+
</table>
|
155 |
+
<?php } ?>
|
156 |
+
|
157 |
+
<p class="submit">
|
158 |
+
<input type="hidden" name="action" value="update" />
|
159 |
+
<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($current_user->ID); ?>" />
|
160 |
+
<input type="submit" class="button-primary" value="<?php esc_attr_e('Update Profile'); ?>" name="submit" />
|
161 |
+
</p>
|
162 |
+
</form>
|
163 |
+
</div>
|
164 |
+
<?php
|
165 |
+
}
|
166 |
+
|
167 |
+
?>
|
modules/themed-profiles/themed-profiles.css
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#pass-strength-result {
|
2 |
+
border-style: solid;
|
3 |
+
border-width: 1px;
|
4 |
+
float: left;
|
5 |
+
margin: 12px 5px 5px 1px;
|
6 |
+
padding: 3px 5px;
|
7 |
+
text-align: center;
|
8 |
+
width: 200px;
|
9 |
+
}
|
10 |
+
|
11 |
+
#pass-strength-result.strong,
|
12 |
+
#pass-strength-result.short {
|
13 |
+
font-weight: bold;
|
14 |
+
}
|
15 |
+
|
16 |
+
#pass-strength-result {
|
17 |
+
background-color: #eee;
|
18 |
+
border-color: #ddd !important;
|
19 |
+
}
|
20 |
+
|
21 |
+
#pass-strength-result.bad {
|
22 |
+
background-color: #ffb78c;
|
23 |
+
border-color: #ff853c !important;
|
24 |
+
}
|
25 |
+
|
26 |
+
#pass-strength-result.good {
|
27 |
+
background-color: #ffec8b;
|
28 |
+
border-color: #fc0 !important;
|
29 |
+
}
|
30 |
+
|
31 |
+
#pass-strength-result.short {
|
32 |
+
background-color: #ffa0a0;
|
33 |
+
border-color: #f04040 !important;
|
34 |
+
}
|
35 |
+
|
36 |
+
#pass-strength-result.strong {
|
37 |
+
background-color: #c3ff88;
|
38 |
+
border-color: #8dff1c !important;
|
39 |
+
}
|
modules/themed-profiles/themed-profiles.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Themed Profiles
|
4 |
+
Description: Enabling this module will initialize and enable themed profiles. There are no other settings for this module.
|
5 |
+
*/
|
6 |
+
|
7 |
+
add_action('tml_load', 'wdbj_tml_themed_profiles_load');
|
8 |
+
function wdbj_tml_themed_profiles_load() {
|
9 |
+
include_once( TML_MODULE_DIR . '/themed-profiles/includes/hook-functions.php' );
|
10 |
+
add_filter('site_url', 'wdbj_tml_themed_profiles_site_url', 10, 3);
|
11 |
+
add_filter('admin_url', 'wdbj_tml_themed_profiles_site_url', 10, 2);
|
12 |
+
}
|
13 |
+
|
14 |
+
add_action('tml_init', 'wdbj_tml_themed_profiles_init');
|
15 |
+
function wdbj_tml_themed_profiles_init() {
|
16 |
+
global $current_user, $action, $redirect, $profile, $user_id, $wp_http_referer;
|
17 |
+
|
18 |
+
include_once( TML_MODULE_DIR . '/themed-profiles/includes/template-functions.php' );
|
19 |
+
|
20 |
+
if ( ! ( is_user_logged_in() && is_page(wdbj_tml_get_option('page_id')) ) )
|
21 |
+
return;
|
22 |
+
|
23 |
+
add_filter('tml_title', 'wdbj_tml_themed_profiles_title', 10, 2);
|
24 |
+
|
25 |
+
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
26 |
+
require_once( ABSPATH . 'wp-admin/includes/template.php' );
|
27 |
+
require_once( ABSPATH . 'wp-admin/includes/user.php' );
|
28 |
+
require_once( ABSPATH . WPINC . '/registration.php' );
|
29 |
+
|
30 |
+
define('WP_ADMIN', true);
|
31 |
+
|
32 |
+
wp_enqueue_style('themed-profiles', plugins_url('theme-my-login/modules/themed-profiles/themed-profiles.css'));
|
33 |
+
|
34 |
+
wp_enqueue_script('user-profile');
|
35 |
+
wp_enqueue_script('password-strength-meter');
|
36 |
+
|
37 |
+
wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
|
38 |
+
|
39 |
+
$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
|
40 |
+
|
41 |
+
if ( 'update' == $action ) {
|
42 |
+
check_admin_referer('update-user_' . $current_user->ID);
|
43 |
+
|
44 |
+
if ( !current_user_can('edit_user', $current_user->ID) )
|
45 |
+
wp_die(__('You do not have permission to edit this user.'));
|
46 |
+
|
47 |
+
do_action('personal_options_update', $current_user->ID);
|
48 |
+
|
49 |
+
$errors = edit_user($current_user->ID);
|
50 |
+
|
51 |
+
if ( !is_wp_error( $errors ) ) {
|
52 |
+
$redirect = add_query_arg(array('updated' => 'true', 'wp_http_referer' => urlencode($wp_http_referer)));
|
53 |
+
wp_redirect($redirect);
|
54 |
+
exit;
|
55 |
+
} else wdbj_tml_set_error($errors);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
add_filter('the_content', 'wdbj_tml_themed_profiles_content');
|
60 |
+
function wdbj_tml_themed_profiles_content($content) {
|
61 |
+
if ( is_page( wdbj_tml_get_option('page_id') ) && is_user_logged_in() && 'profile' == wdbj_tml_get_var('request_action') )
|
62 |
+
return wdbj_tml_themed_profiles_display();
|
63 |
+
return $content;
|
64 |
+
}
|
65 |
+
|
66 |
+
?>
|
modules/user-moderation/admin/admin.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_user_mod_load_users_page() {
|
4 |
+
if ( 'admin' == wdbj_tml_get_option('moderation', 'type') ) {
|
5 |
+
add_action('delete_user', 'wdbj_tml_user_mod_deny_user');
|
6 |
+
add_filter('user_row_actions', 'wdbj_tml_user_mod_user_row_actions', 10, 2);
|
7 |
+
if ( isset($_GET['action']) && 'approve' == $_GET['action'] ) {
|
8 |
+
check_admin_referer('approve-user');
|
9 |
+
|
10 |
+
$user = isset($_GET['user']) ? $_GET['user'] : '';
|
11 |
+
if ( !$user )
|
12 |
+
wp_die(__('You can’t edit that user.', 'theme-my-login'));
|
13 |
+
|
14 |
+
if ( !current_user_can('edit_user', $user) )
|
15 |
+
wp_die(__('You can’t edit that user.', 'theme-my-login'));
|
16 |
+
|
17 |
+
include_once( TML_MODULE_DIR. '/user-moderation/includes/functions.php' );
|
18 |
+
|
19 |
+
$newpass = ( wdbj_tml_is_module_active('custom-passwords/custom-passwords.php') ) ? 0 : 1;
|
20 |
+
if ( ! wdbj_tml_user_mod_approve_new_user($user, $newpass) )
|
21 |
+
wp_die(__('You can’t edit that user.', 'theme-my-login'));
|
22 |
+
|
23 |
+
add_action('admin_notices', create_function('', "echo '<div id=\"message\" class=\"updated fade\"><p>' . __('User approved.', 'theme-my-login') . '</p></div>';"));
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
function wdbj_tml_user_mod_user_row_actions($actions, $user_object) {
|
29 |
+
$current_user = wp_get_current_user();
|
30 |
+
$user_role = reset($user_object->roles);
|
31 |
+
if ( $current_user->ID != $user_object->ID ) {
|
32 |
+
if ( 'pending' == $user_role ) {
|
33 |
+
$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", 'approve-user') ) . '">Approve</a>';
|
34 |
+
$actions = array_merge($approve, $actions);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
return $actions;
|
38 |
+
}
|
39 |
+
|
40 |
+
function wdbj_tml_user_mod_deny_user($user_id) {
|
41 |
+
$user = new WP_User($user_id);
|
42 |
+
$user_role = reset($user->roles);
|
43 |
+
if ( 'pending' != $user_role )
|
44 |
+
return;
|
45 |
+
|
46 |
+
do_action('deny_user', $user->ID);
|
47 |
+
|
48 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
49 |
+
// we want to reverse this for the plain text arena of emails.
|
50 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
51 |
+
|
52 |
+
$message = sprintf(__('You have been denied access to %s', 'theme-my-login'), $blogname);
|
53 |
+
$title = sprintf(__('[%s] Registration Denied', 'theme-my-login'), $blogname);
|
54 |
+
|
55 |
+
$title = apply_filters('user_denial_title', $title);
|
56 |
+
$message = apply_filters('user_denial_message', $message, $user_id);
|
57 |
+
|
58 |
+
if ( $message && !wp_mail($user->user_email, $title, $message) )
|
59 |
+
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
60 |
+
}
|
61 |
+
|
62 |
+
function wdbj_tml_user_mod_admin_menu() {
|
63 |
+
wdbj_tml_add_menu_page(__('Moderation', 'theme-my-login'), __FILE__, 'wdbj_tml_user_mod_admin_page');
|
64 |
+
if ( wdbj_tml_is_module_active('custom-email/custom-email.php') ) {
|
65 |
+
$parent = plugin_basename(TML_MODULE_DIR . '/custom-email/admin/options.php');
|
66 |
+
wdbj_tml_add_submenu_page($parent, __('User Activation', 'theme-my-login'), TML_MODULE_DIR . '/user-moderation/admin/options-user-activation-email.php');
|
67 |
+
wdbj_tml_add_submenu_page($parent, __('User Approval', 'theme-my-login'), TML_MODULE_DIR . '/user-moderation/admin/options-user-approval-email.php');
|
68 |
+
wdbj_tml_add_submenu_page($parent, __('User Denial', 'theme-my-login'), TML_MODULE_DIR . '/user-moderation/admin/options-user-denial-email.php');
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
function wdbj_tml_user_mod_admin_page() {
|
73 |
+
$moderation = wdbj_tml_get_option('moderation', 'type');
|
74 |
+
?>
|
75 |
+
<table class="form-table">
|
76 |
+
<tr valign="top">
|
77 |
+
<th scope="row"><?php _e('User Moderation', 'theme-my-login'); ?></th>
|
78 |
+
<td>
|
79 |
+
<input name="theme_my_login[moderation][type]" type="radio" id="theme_my_login_moderation_type_none" value="none" <?php if ( 'none' == $moderation ) { echo 'checked="checked"'; } ?> />
|
80 |
+
<label for="theme_my_login_moderation_type_none"><?php _e('None', 'theme-my-login'); ?></label>
|
81 |
+
<br />
|
82 |
+
<input name="theme_my_login[moderation][type]" type="radio" id="theme_my_login_moderation_type_email" value="email" <?php if ( 'email' == $moderation ) { echo 'checked="checked"'; } ?> />
|
83 |
+
<label for="theme_my_login_moderation_type_email"><?php _e('E-mail Confirmation', 'theme-my-login'); ?></label>
|
84 |
+
<br />
|
85 |
+
<input name="theme_my_login[moderation][type]" type="radio" id="theme_my_login_moderation_type_admin" value="admin" <?php if ( 'admin' == $moderation ) { echo 'checked="checked"'; } ?> />
|
86 |
+
<label for="theme_my_login_moderation_type_admin"><?php _e('Admin Approval', 'theme-my-login'); ?></label>
|
87 |
+
</td>
|
88 |
+
</tr>
|
89 |
+
</table>
|
90 |
+
<?php
|
91 |
+
}
|
92 |
+
|
93 |
+
?>
|
modules/user-moderation/admin/options-user-activation-email.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr>
|
3 |
+
<td>
|
4 |
+
<p><em><?php _e('Available Variables', 'theme-my-login'); ?>: %blogname%, %siteurl%, %activateurl%, %user_login%, %user_email%, %user_ip%</em></p>
|
5 |
+
<label for="theme_my_login_user_activation_title"><?php _e('Subject', 'theme-my-login'); ?></label><br />
|
6 |
+
<input name="theme_my_login[email][user_activation][title]" type="text" id="theme_my_login_user_activation_title" value="<?php if ( isset($theme_my_login->options['email']['user_activation']['title']) ) echo $theme_my_login->options['email']['user_activation']['title']; ?>" class="full-text" /><br />
|
7 |
+
<label for="theme_my_login_user_activation_message"><?php _e('Message', 'theme-my-login'); ?></label><br />
|
8 |
+
<textarea name="theme_my_login[email][user_activation][message]" id="theme_my_login_user_activation_message" class="large-text" rows="10"><?php if ( isset($theme_my_login->options['email']['user_activation']['message']) ) echo $theme_my_login->options['email']['user_activation']['message']; ?></textarea><br />
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</table>
|
modules/user-moderation/admin/options-user-approval-email.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr>
|
3 |
+
<td>
|
4 |
+
<p><em><?php _e('Available Variables', 'theme-my-login'); ?>: %blogname%, %siteurl%, %user_login%, %user_email%, %user_pass%</em></p>
|
5 |
+
<label for="theme_my_login_user_approval_title"><?php _e('Subject', 'theme-my-login'); ?></label><br />
|
6 |
+
<input name="theme_my_login[email][user_approval][title]" type="text" id="theme_my_login_user_approval_title" value="<?php if ( isset($theme_my_login->options['email']['user_approval']['title']) ) echo $theme_my_login->options['email']['user_approval']['title']; ?>" class="full-text" /><br />
|
7 |
+
<label for="theme_my_login_user_approval_message"><?php _e('Message', 'theme-my-login'); ?></label><br />
|
8 |
+
<textarea name="theme_my_login[email][user_approval][message]" id="theme_my_login_user_approval_message" class="large-text" rows="10"><?php if ( isset($theme_my_login->options['email']['user_approval']['message']) ) echo $theme_my_login->options['email']['user_approval']['message']; ?></textarea><br />
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</table>
|
modules/user-moderation/admin/options-user-denial-email.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table">
|
2 |
+
<tr>
|
3 |
+
<td>
|
4 |
+
<p><em><?php _e('Available Variables', 'theme-my-login'); ?>: %blogname%, %siteurl%, %user_login%, %user_email%</em></p>
|
5 |
+
<label for="theme_my_login_user_denial_title"><?php _e('Subject', 'theme-my-login'); ?></label><br />
|
6 |
+
<input name="theme_my_login[email][user_denial][title]" type="text" id="theme_my_login_user_denial_title" value="<?php if ( isset($theme_my_login->options['email']['user_denial']['title']) ) echo $theme_my_login->options['email']['user_denial']['title']; ?>" class="full-text" /><br />
|
7 |
+
<label for="theme_my_login_user_denial_message"><?php _e('Message', 'theme-my-login'); ?></label><br />
|
8 |
+
<textarea name="theme_my_login[email][user_denial][message]" id="theme_my_login_user_denial_message" class="large-text" rows="10"><?php if ( isset($theme_my_login->options['email']['user_denial']['message']) ) echo $theme_my_login->options['email']['user_denial']['message']; ?></textarea><br />
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</table>
|
modules/user-moderation/includes/email-functions.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
include_once( TML_MODULE_DIR . '/custom-email/includes/hook-functions.php' );
|
4 |
+
|
5 |
+
function wdbj_tml_user_mod_custom_email_user_activation_filters() {
|
6 |
+
wdbj_tml_custom_email_headers();
|
7 |
+
add_filter('user_activation_title', 'wdbj_tml_user_mod_user_activation_title');
|
8 |
+
add_filter('user_activation_message', 'wdbj_tml_user_mod_user_activation_message', 10, 3);
|
9 |
+
}
|
10 |
+
|
11 |
+
function wdbj_tml_user_mod_custom_email_user_approval_filters() {
|
12 |
+
wdbj_tml_custom_email_headers();
|
13 |
+
add_filter('user_approval_title', 'wdbj_tml_user_mod_user_approval_title');
|
14 |
+
add_filter('user_approval_message', 'wdbj_tml_user_mod_user_approval_message', 10, 3);
|
15 |
+
}
|
16 |
+
|
17 |
+
function wdbj_tml_user_mod_custom_email_user_denial_filters() {
|
18 |
+
wdbj_tml_custom_email_headers();
|
19 |
+
add_filter('user_denial_title', 'wdbj_tml_user_mod_user_denial_title');
|
20 |
+
add_filter('user_denial_message', 'wdbj_tml_user_mod_user_denial_message', 10, 2);
|
21 |
+
}
|
22 |
+
|
23 |
+
function wdbj_tml_user_mod_user_activation_title($title) {
|
24 |
+
$_title = wdbj_tml_get_option('email', 'user_activation', 'title');
|
25 |
+
return empty($_title) ? $title : wdbj_tml_custom_email_replace_vars($_title, $user_id);
|
26 |
+
}
|
27 |
+
|
28 |
+
function wdbj_tml_user_mod_user_activation_message($message, $user_id, $activation_url) {
|
29 |
+
$_message = wdbj_tml_get_option('email', 'user_activation', 'message');
|
30 |
+
$replacements = array(
|
31 |
+
'%activateurl%' => $activation_url,
|
32 |
+
'%user_pass%' => $new_pass
|
33 |
+
);
|
34 |
+
return empty($_message) ? $message : wdbj_tml_custom_email_replace_vars($_message, $user_id, $replacements);
|
35 |
+
}
|
36 |
+
|
37 |
+
function wdbj_tml_user_mod_user_approval_title($title) {
|
38 |
+
$_title = wdbj_tml_get_option('email', 'user_approval', 'title');
|
39 |
+
return empty($_title) ? $title : wdbj_tml_custom_email_replace_vars($_title, $user_id);
|
40 |
+
}
|
41 |
+
|
42 |
+
function wdbj_tml_user_mod_user_approval_message($message, $new_pass, $user_id) {
|
43 |
+
$_message = wdbj_tml_get_option('email', 'user_approval', 'message');
|
44 |
+
$replacements = array(
|
45 |
+
'%loginurl%' => site_url('wp-login.php', 'login'),
|
46 |
+
'%user_pass%' => $new_pass
|
47 |
+
);
|
48 |
+
return empty($_message) ? $message : wdbj_tml_custom_email_replace_vars($_message, $user_id, $replacements);
|
49 |
+
}
|
50 |
+
|
51 |
+
function wdbj_tml_user_mod_user_denial_title($title) {
|
52 |
+
$_title = wdbj_tml_get_option('email', 'user_denial', 'title');
|
53 |
+
return empty($_title) ? $title : wdbj_tml_custom_email_replace_vars($_title, $user_id);
|
54 |
+
}
|
55 |
+
|
56 |
+
function wdbj_tml_user_mod_user_denial_message($message, $user_id) {
|
57 |
+
$_message = wdbj_tml_get_option('email', 'user_denial', 'message');
|
58 |
+
$replacements = array(
|
59 |
+
'%loginurl%' => site_url('wp-login.php', 'login'),
|
60 |
+
'%user_pass%' => $new_pass
|
61 |
+
);
|
62 |
+
return empty($_message) ? $message : wdbj_tml_custom_email_replace_vars($_message, $user_id, $replacements);
|
63 |
+
}
|
64 |
+
|
65 |
+
?>
|
modules/user-moderation/includes/functions.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles activating a new user by user email confirmation.
|
5 |
+
*
|
6 |
+
* @param string $key Hash to validate sending confirmation email
|
7 |
+
* @param string $login User's username for logging in
|
8 |
+
* @param bool $newpass Whether or not to assign a new password
|
9 |
+
* @return bool|WP_Error
|
10 |
+
*/
|
11 |
+
function wdbj_tml_user_mod_activate_new_user($key, $login, $newpass = false) {
|
12 |
+
global $wpdb;
|
13 |
+
|
14 |
+
$key = preg_replace('/[^a-z0-9]/i', '', $key);
|
15 |
+
|
16 |
+
if ( empty($key) || !is_string($key) )
|
17 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
18 |
+
|
19 |
+
if ( empty($login) || !is_string($login) )
|
20 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
21 |
+
|
22 |
+
$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login));
|
23 |
+
if ( empty( $user ) )
|
24 |
+
return new WP_Error('invalid_key', __('Invalid key'));
|
25 |
+
|
26 |
+
do_action('user_activation_post', $user->user_login, $user->user_email, $errors);
|
27 |
+
|
28 |
+
// Allow plugins to short-circuit process and send errors
|
29 |
+
$errors = new WP_Error();
|
30 |
+
$errors = apply_filters( 'user_activation_errors', $errors, $user->user_login, $user->user_email );
|
31 |
+
|
32 |
+
if ( $errors->get_error_code() )
|
33 |
+
return $errors;
|
34 |
+
|
35 |
+
$wpdb->update($wpdb->users, array('user_activation_key' => ''), array('user_login' => $login) );
|
36 |
+
|
37 |
+
$user_object = new WP_User($user->ID);
|
38 |
+
$user_object->set_role(get_option('default_role'));
|
39 |
+
unset($user_object);
|
40 |
+
|
41 |
+
$pass = __('Same as when you signed up.', 'theme-my-login');
|
42 |
+
if ( $newpass ) {
|
43 |
+
$pass = wp_generate_password();
|
44 |
+
wp_set_password($pass, $user->ID);
|
45 |
+
}
|
46 |
+
|
47 |
+
wp_new_user_notification($user->ID, $pass);
|
48 |
+
|
49 |
+
return true;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Handles activating a new user by admin approval.
|
54 |
+
*
|
55 |
+
* @param string $id User's ID
|
56 |
+
* @param bool $newpass Whether or not to assign a new password
|
57 |
+
* @return bool Returns false if not a valid user
|
58 |
+
*/
|
59 |
+
function wdbj_tml_user_mod_approve_new_user($id, $newpass = false) {
|
60 |
+
global $wpdb;
|
61 |
+
|
62 |
+
$id = (int) $id;
|
63 |
+
|
64 |
+
$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE ID = %d", $id));
|
65 |
+
if ( empty( $user ) )
|
66 |
+
return false;
|
67 |
+
|
68 |
+
do_action('approve_user', $user->ID);
|
69 |
+
|
70 |
+
$wpdb->update($wpdb->users, array('user_activation_key' => ''), array('ID' => $id) );
|
71 |
+
|
72 |
+
$user_object = new WP_User($user->ID);
|
73 |
+
$user_object->set_role(get_option('default_role'));
|
74 |
+
unset($user_object);
|
75 |
+
|
76 |
+
$user_pass = __('Same as when you signed up.', 'theme-my-login');
|
77 |
+
if ( $newpass ) {
|
78 |
+
$user_pass = wp_generate_password();
|
79 |
+
wp_set_password($user_pass, $user->ID);
|
80 |
+
}
|
81 |
+
|
82 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
83 |
+
// we want to reverse this for the plain text arena of emails.
|
84 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
85 |
+
|
86 |
+
$message = sprintf(__('You have been approved access to %s', 'theme-my-login'), $blogname) . "\r\n\r\n";
|
87 |
+
$message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n";
|
88 |
+
$message .= sprintf(__('Password: %s'), $user_pass) . "\r\n\r\n";
|
89 |
+
$message .= site_url('wp-login.php', 'login') . "\r\n";
|
90 |
+
|
91 |
+
$title = sprintf(__('[%s] Registration Approved', 'theme-my-login'), $blogname);
|
92 |
+
|
93 |
+
$title = apply_filters('user_approval_title', $title);
|
94 |
+
$message = apply_filters('user_approval_message', $message, $user_pass, $user->ID);
|
95 |
+
|
96 |
+
if ( $message && !wp_mail($user->user_email, $title, $message) )
|
97 |
+
die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
|
98 |
+
|
99 |
+
return true;
|
100 |
+
}
|
101 |
+
|
102 |
+
function wdbj_tml_user_mod_new_user_activation_notification($user_id, $key = '') {
|
103 |
+
global $wpdb;
|
104 |
+
|
105 |
+
if ( apply_filters('new_user_activation_notification', true) ) {
|
106 |
+
|
107 |
+
$user = new WP_User($user_id);
|
108 |
+
|
109 |
+
$user_login = stripslashes($user->user_login);
|
110 |
+
$user_email = stripslashes($user->user_email);
|
111 |
+
|
112 |
+
if ( empty($key) ) {
|
113 |
+
$key = $wpdb->get_var( $wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login) );
|
114 |
+
if ( empty($key) ) {
|
115 |
+
$key = wp_generate_password(20, false);
|
116 |
+
$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
121 |
+
// we want to reverse this for the plain text arena of emails.
|
122 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
123 |
+
|
124 |
+
$activation_url = add_query_arg(array('action' => 'activate', 'key' => $key, 'login' => $user_login), wp_login_url());
|
125 |
+
|
126 |
+
$title = sprintf(__('[%s] Activate Your Account', 'theme-my-login'), $blogname);
|
127 |
+
$message = sprintf(__('Thanks for registering at %s! To complete the activation of your account please click the following link: ', 'theme-my-login'), $blogname) . "\r\n\r\n";
|
128 |
+
$message .= $activation_url . "\r\n";
|
129 |
+
|
130 |
+
$title = apply_filters('user_activation_title', $title, $user_id);
|
131 |
+
$message = apply_filters('user_activation_message', $message, $user_id, $activation_url);
|
132 |
+
|
133 |
+
wp_mail($user_email, $title, $message);
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
function wdbj_tml_user_mod_new_user_approval_admin_notification($user_id) {
|
138 |
+
if ( apply_filters('new_user_approval_admin_notification', true) ) {
|
139 |
+
|
140 |
+
$user = new WP_User($user_id);
|
141 |
+
|
142 |
+
$user_login = stripslashes($user->user_login);
|
143 |
+
$user_email = stripslashes($user->user_email);
|
144 |
+
|
145 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
146 |
+
// we want to reverse this for the plain text arena of emails.
|
147 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
148 |
+
|
149 |
+
$message = sprintf(__('New user requires approval on your blog %s:', 'theme-my-login'), $blogname) . "\r\n\r\n";
|
150 |
+
$message .= sprintf(__('Username: %s', 'theme-my-login'), $user_login) . "\r\n";
|
151 |
+
$message .= sprintf(__('E-mail: %s', 'theme-my-login'), $user_email) . "\r\n\r\n";
|
152 |
+
$message .= __('To approve or deny this user:', 'theme-my-login') . "\r\n";
|
153 |
+
$message .= admin_url('users.php');
|
154 |
+
|
155 |
+
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Awaiting Approval', 'theme-my-login'), $blogname), $message);
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
?>
|
modules/user-moderation/includes/hook-functions.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wdbj_tml_user_mod_user_moderation($user_id) {
|
4 |
+
global $wpdb;
|
5 |
+
|
6 |
+
require_once (TML_MODULE_DIR . '/user-moderation/includes/functions.php');
|
7 |
+
|
8 |
+
// Disable original notification
|
9 |
+
add_filter('new_user_admin_notification', create_function('', "return false;"), 100);
|
10 |
+
add_filter('new_user_notification', create_function('', "return false;"), 100);
|
11 |
+
|
12 |
+
$user = new WP_User($user_id);
|
13 |
+
$user->set_role('pending');
|
14 |
+
if ( 'email' == wdbj_tml_get_option('moderation', 'type') ) {
|
15 |
+
$key = wp_generate_password(20, false);
|
16 |
+
$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user->user_login));
|
17 |
+
wdbj_tml_user_mod_new_user_activation_notification($user_id, $key);
|
18 |
+
} elseif ( 'admin' == wdbj_tml_get_option('moderation', 'type') ) {
|
19 |
+
wdbj_tml_user_mod_new_user_approval_admin_notification($user_id);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
function wdbj_tml_user_mod_authenticate($user, $username, $password) {
|
24 |
+
global $wpdb;
|
25 |
+
|
26 |
+
if ( is_a($user, 'WP_User') ) {
|
27 |
+
$user_role = reset($user->roles);
|
28 |
+
if ( 'pending' == $user_role ) {
|
29 |
+
if ( 'email' == wdbj_tml_get_option('moderation', 'type') )
|
30 |
+
return new WP_Error('pending', __('<strong>ERROR</strong>: You have not yet confirmed your e-mail address.', 'theme-my-login'));
|
31 |
+
else
|
32 |
+
return new WP_Error('pending', __('<strong>ERROR</strong>: Your registration has not yet been approved.', 'theme-my-login'));
|
33 |
+
}
|
34 |
+
}
|
35 |
+
return $user;
|
36 |
+
}
|
37 |
+
|
38 |
+
function wdbj_tml_user_mod_user_activation() {
|
39 |
+
require_once( TML_MODULE_DIR . '/user-moderation/includes/functions.php' );
|
40 |
+
|
41 |
+
$newpass = ( wdbj_tml_is_module_active('custom-passwords/custom-passwords.php') ) ? 0 : 1;
|
42 |
+
$errors = wdbj_tml_user_mod_activate_new_user($_GET['key'], $_GET['login'], $newpass);
|
43 |
+
|
44 |
+
if ( !is_wp_error($errors) ) {
|
45 |
+
$redirect_to = site_url('wp-login.php?activation=complete');
|
46 |
+
if ( 'tml-page' != wdbj_tml_get_var('request_instance') )
|
47 |
+
$redirect_to = wdbj_tml_get_current_url('activation=complete&instance=' . wdbj_tml_get_var('request_instance'));
|
48 |
+
wp_redirect($redirect_to);
|
49 |
+
exit();
|
50 |
+
}
|
51 |
+
|
52 |
+
$redirect_to = site_url('wp-login.php?activation=invalidkey');
|
53 |
+
if ( 'tml-page' != wdbj_tml_get_var('request_instance') )
|
54 |
+
$redirect_to = wdbj_tml_get_current_url('activation=invalidkey&instance=' . wdbj_tml_get_var('request_instance'));
|
55 |
+
wp_redirect($redirect_to);
|
56 |
+
exit();
|
57 |
+
}
|
58 |
+
|
59 |
+
function wdbj_tml_user_mod_allow_password_reset($allow, $user_id) {
|
60 |
+
$user = new WP_User($user_id);
|
61 |
+
$user_role = reset($user->roles);
|
62 |
+
if ( 'pending' == $user_role )
|
63 |
+
$allow = false;
|
64 |
+
return $allow;
|
65 |
+
}
|
66 |
+
|
67 |
+
function wdbj_tml_user_mod_register_redirect($redirect_to) {
|
68 |
+
$redirect_to = site_url('wp-login.php');
|
69 |
+
if ( 'tml-page' != wdbj_tml_get_var('request_instance') )
|
70 |
+
$redirect_to = wdbj_tml_get_current_url('instance=' . wdbj_tml_get_var('request_instance'));
|
71 |
+
|
72 |
+
if ( 'email' == wdbj_tml_get_option('moderation', 'type') )
|
73 |
+
$redirect_to = add_query_arg('pending', 'activation', $redirect_to);
|
74 |
+
elseif ( 'admin' == wdbj_tml_get_option('moderation', 'type') )
|
75 |
+
$redirect_to = add_query_arg('pending', 'approval', $redirect_to);
|
76 |
+
return $redirect_to;
|
77 |
+
}
|
78 |
+
|
79 |
+
?>
|
modules/user-moderation/user-moderation.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: User Moderation
|
4 |
+
Description: Enabling this module will initialize user moderation. You will then have to configure the settings via the "Moderation" tab.
|
5 |
+
*/
|
6 |
+
|
7 |
+
add_action('tml_init', 'wdbj_tml_user_mod_init');
|
8 |
+
function wdbj_tml_user_mod_init() {
|
9 |
+
include( TML_MODULE_DIR . '/user-moderation/includes/hook-functions.php' );
|
10 |
+
$moderation = wdbj_tml_get_option('moderation', 'type');
|
11 |
+
if ( in_array($moderation, array('admin', 'email')) ) {
|
12 |
+
add_action('user_register', 'wdbj_tml_user_mod_user_moderation', 100);
|
13 |
+
add_action('authenticate', 'wdbj_tml_user_mod_authenticate', 100, 3);
|
14 |
+
add_filter('allow_password_reset', 'wdbj_tml_user_mod_allow_password_reset', 10, 2);
|
15 |
+
add_filter('register_redirect', 'wdbj_tml_user_mod_register_redirect', 100);
|
16 |
+
if ( 'email' == $moderation ) {
|
17 |
+
add_action('login_action_activate', 'wdbj_tml_user_mod_user_activation');
|
18 |
+
if ( wdbj_tml_is_module_active('custom-email/custom-email.php') ) {
|
19 |
+
require_once( TML_MODULE_DIR . '/user-moderation/includes/email-functions.php' );
|
20 |
+
add_action('register_post', 'wdbj_tml_user_mod_custom_email_user_activation_filters');
|
21 |
+
add_action('user_activation_post', 'wdbj_tml_custom_email_new_user_filters', 10, 2);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
add_action('template_redirect', 'wdbj_tml_user_mod_login_message', 100);
|
28 |
+
function wdbj_tml_user_mod_login_message() {
|
29 |
+
if ( isset($_GET['pending']) && 'activation' == $_GET['pending'] )
|
30 |
+
wdbj_tml_set_error('pending_activation', __('Your registration was successful but you must now confirm your email address before you can log in. Please check your email and click on the link provided.', 'theme-my-login'), 'message');
|
31 |
+
elseif ( isset($_GET['pending']) && 'approval' == $_GET['pending'] )
|
32 |
+
wdbj_tml_set_error('pending_approval', __('Your registration was successful but you must now be approved by an administrator before you can log in. You will be notified by e-mail once your account has been reviewed.', 'theme-my-login'), 'message');
|
33 |
+
elseif ( isset($_GET['activation']) && 'complete' == $_GET['activation'] ) {
|
34 |
+
if ( wdbj_tml_is_module_active('custom-passwords/custom-passwords.php') )
|
35 |
+
wdbj_tml_set_error('activation_complete', __('Your account has been activated. You may now log in.', 'theme-my-login'), 'message');
|
36 |
+
else
|
37 |
+
wdbj_tml_set_error('activation_complete', __('Your account has been activated. Please check your e-mail for your password.', 'theme-my-login'), 'message');
|
38 |
+
}
|
39 |
+
|
40 |
+
if ( wdbj_tml_get_var('request_instance') == wdbj_tml_get_var('current_instance', 'instance_id') && isset($_GET['activation']) && 'invalidkey' == $_GET['activation'] )
|
41 |
+
wdbj_tml_set_error('invalid_key', __('<strong>ERROR</strong>: Sorry, that key does not appear to be valid.'));
|
42 |
+
}
|
43 |
+
|
44 |
+
add_action('tml_admin_init', 'wdbj_tml_user_mod_admin_init');
|
45 |
+
function wdbj_tml_user_mod_admin_init() {
|
46 |
+
include( TML_MODULE_DIR . '/user-moderation/admin/admin.php' );
|
47 |
+
|
48 |
+
add_action('tml_admin_menu', 'wdbj_tml_user_mod_admin_menu');
|
49 |
+
|
50 |
+
add_action('load-users.php', 'wdbj_tml_user_mod_load_users_page');
|
51 |
+
|
52 |
+
if ( wdbj_tml_is_module_active('custom-email/custom-email.php') ) {
|
53 |
+
require_once( TML_MODULE_DIR . '/user-moderation/includes/email-functions.php' );
|
54 |
+
add_action('approve_user', 'wdbj_tml_user_mod_custom_email_user_approval_filters');
|
55 |
+
add_action('deny_user', 'wdbj_tml_user_mod_custom_email_user_denial_filters');
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
add_action('activate_user-moderation/user-moderation.php', 'wdbj_tml_user_mod_activate');
|
60 |
+
function wdbj_tml_user_mod_activate() {
|
61 |
+
$current = wdbj_tml_get_option('moderation');
|
62 |
+
$default = wdbj_tml_user_mod_default_settings();
|
63 |
+
|
64 |
+
add_role( 'pending', 'Pending', array() );
|
65 |
+
|
66 |
+
if ( is_array($current) )
|
67 |
+
wdbj_tml_update_option(array_merge($default, $current), 'moderation');
|
68 |
+
else
|
69 |
+
wdbj_tml_update_option($default, 'moderation');
|
70 |
+
|
71 |
+
unset($current, $default);
|
72 |
+
}
|
73 |
+
|
74 |
+
add_action('deactivate_user-moderation/user-moderation.php', 'wdbj_tml_user_mod_deactivate');
|
75 |
+
add_action('uninstall_user-moderation/user-moderation.php', 'wdbj_tml_user_mod_deactivate');
|
76 |
+
function wdbj_tml_user_mod_deactivate() {
|
77 |
+
remove_role( 'pending' );
|
78 |
+
}
|
79 |
+
|
80 |
+
function wdbj_tml_user_mod_default_settings() {
|
81 |
+
$options = array(
|
82 |
+
'type' => 'none'
|
83 |
+
);
|
84 |
+
return $options;
|
85 |
+
}
|
86 |
+
|
87 |
+
?>
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: jfarthing84
|
|
3 |
Donate link: http://www.jfarthing.com/donate
|
4 |
Tags: widget, login, registration, theme, custom, log in, register, sidebar, gravatar, redirection, e-mail
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to:
|
7 |
-
Stable tag:
|
8 |
|
9 |
Themes the WordPress login pages according to your theme.
|
10 |
|
@@ -13,23 +13,27 @@ Themes the WordPress login pages according to your theme.
|
|
13 |
|
14 |
This plugin themes the WordPress login, registration and forgot password pages according to your current theme. It replaces the wp-login.php file by using a page template from your theme. Also includes a widget for sidebar login.
|
15 |
|
|
|
|
|
|
|
16 |
= Features =
|
17 |
-
* Your registration, log in and password recovery pages will all match the rest of your website
|
18 |
* Includes a customizeable widget to login anywhere from your blog
|
19 |
-
* Redirect users upon log in based
|
20 |
-
* Customize titles and messages for the registration, log in and password recovery forms
|
21 |
* Show gravatar to users who are logged in
|
22 |
* Assign custom links to users who are logged in based on their role
|
23 |
* Customize user emails for registration and/or password recovery
|
24 |
* Send user emails in HTML format
|
25 |
* Allow users to set their own password upon registration
|
26 |
-
*
|
|
|
27 |
|
28 |
|
29 |
== Installation ==
|
30 |
|
31 |
1. Upload the plugin to your 'wp-content/plugins' directory
|
32 |
1. Activate the plugin
|
|
|
33 |
|
34 |
|
35 |
== Frequently Asked Questions ==
|
@@ -39,6 +43,17 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
|
|
39 |
|
40 |
== Changelog ==
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
= 4.4 =
|
43 |
* Added the option to require new registrations to confirm e-mail address
|
44 |
* Added the option to redirect users upon log out according to their role
|
3 |
Donate link: http://www.jfarthing.com/donate
|
4 |
Tags: widget, login, registration, theme, custom, log in, register, sidebar, gravatar, redirection, e-mail
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 3.0-alpha
|
7 |
+
Stable tag: 5.0
|
8 |
|
9 |
Themes the WordPress login pages according to your theme.
|
10 |
|
13 |
|
14 |
This plugin themes the WordPress login, registration and forgot password pages according to your current theme. It replaces the wp-login.php file by using a page template from your theme. Also includes a widget for sidebar login.
|
15 |
|
16 |
+
= NOTICE =
|
17 |
+
Upgrading to version 5.0 will drop all previous options!
|
18 |
+
|
19 |
= Features =
|
20 |
+
* Your registration, log in, and password recovery pages will all match the rest of your website
|
21 |
* Includes a customizeable widget to login anywhere from your blog
|
22 |
+
* Redirect users upon log in and log out based upon their role
|
|
|
23 |
* Show gravatar to users who are logged in
|
24 |
* Assign custom links to users who are logged in based on their role
|
25 |
* Customize user emails for registration and/or password recovery
|
26 |
* Send user emails in HTML format
|
27 |
* Allow users to set their own password upon registration
|
28 |
+
* Require users to be approved or confirm e-mail address upon registration
|
29 |
+
* Theme user profiles
|
30 |
|
31 |
|
32 |
== Installation ==
|
33 |
|
34 |
1. Upload the plugin to your 'wp-content/plugins' directory
|
35 |
1. Activate the plugin
|
36 |
+
1. Visit the [Theme My Login Official Usage Thread](http://www.jfarthing.com/forum/theme-my-login/theme-my-login-official-usage-thread/) for further instruction.
|
37 |
|
38 |
|
39 |
== Frequently Asked Questions ==
|
43 |
|
44 |
== Changelog ==
|
45 |
|
46 |
+
= 5.0 =
|
47 |
+
* Rewrite code in a modular fashion in order to speed up plugin
|
48 |
+
* Convert custom e-mails, passwords, redirection, user links and user moderation to "modules"
|
49 |
+
* Add the option to enable/disable link rewriting, widget and template tag
|
50 |
+
* Simplify/optimize admin tabs style
|
51 |
+
* Remember current admin tab after save
|
52 |
+
* When using custom passwords, allow users to set their own password upon reset
|
53 |
+
* When using custom redirection, specify redirection type per user role/per link type
|
54 |
+
* New ajax interface for user links admin
|
55 |
+
* Theme My Profile now merged into module
|
56 |
+
|
57 |
= 4.4 =
|
58 |
* Added the option to require new registrations to confirm e-mail address
|
59 |
* Added the option to redirect users upon log out according to their role
|
css/theme-my-login.css → theme-my-login.css
RENAMED
File without changes
|
theme-my-login.php
CHANGED
@@ -3,988 +3,108 @@
|
|
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:
|
7 |
Author: Jeff Farthing
|
8 |
Author URI: http://www.jfarthing.com
|
9 |
Text Domain: theme-my-login
|
10 |
*/
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
add_action('register_form', array(&$this, 'customPassForm'));
|
44 |
-
add_action('registration_errors', array(&$this, 'customPassErrors'));
|
45 |
-
add_action('user_register', array(&$this, 'setUserPassword'));
|
46 |
-
}
|
47 |
-
|
48 |
-
if ( in_array($this->options['moderation'], array('email', 'admin')) ) {
|
49 |
-
add_action('user_register', array(&$this, 'userModeration'), 100);
|
50 |
-
add_action('login_form_activate', array(&$this, 'userActivation'));
|
51 |
-
add_action('authenticate', array(&$this, 'authenticate'), 100, 3);
|
52 |
-
add_action('delete_user', array(&$this, 'denyUser'));
|
53 |
-
add_filter('allow_password_reset', array(&$this, 'allowPasswordReset'), 10, 2);
|
54 |
-
add_filter('user_row_actions', array(&$this, 'userRowActions'), 10, 2);
|
55 |
-
}
|
56 |
-
|
57 |
-
add_action('admin_init', array(&$this, 'adminInit'));
|
58 |
-
add_action('admin_menu', array(&$this, 'adminMenu'));
|
59 |
-
|
60 |
-
add_filter('the_posts', array(&$this, 'createPage'));
|
61 |
-
add_filter('page_rewrite_rules', array(&$this, 'pageRewriteRules'));
|
62 |
-
add_filter('site_url', array(&$this, 'siteURL'), 10, 3);
|
63 |
-
add_filter('login_redirect', array(&$this, 'loginRedirect'), 10, 3);
|
64 |
-
add_filter('logout_redirect', array(&$this, 'logoutRedirect'), 10, 3);
|
65 |
-
|
66 |
-
add_shortcode('theme-my-login', array(&$this, 'shortcode'));
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
function init() {
|
71 |
-
// This happens before $wp and $wp_query are populated, but after all plugins, pluggable functions and widgets are loaded.
|
72 |
-
$this->request_instance = ( isset($_REQUEST['instance']) ) ? $_REQUEST['instance'] : 'tml-page';
|
73 |
-
$this->action = ( isset($_REQUEST['action']) ) ? $_REQUEST['action'] : '';
|
74 |
-
$this->errors = new WP_Error();
|
75 |
-
|
76 |
-
// validate action so as to default to the login screen
|
77 |
-
if ( !in_array($this->action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login'), true) && false === has_filter('login_form_' . $this->action) )
|
78 |
-
$this->action = 'login';
|
79 |
-
}
|
80 |
-
|
81 |
-
// Create a dummy page to handle our actions
|
82 |
-
function createPage($posts) {
|
83 |
-
|
84 |
-
if ( defined('IS_TML') && IS_TML )
|
85 |
-
return $posts;
|
86 |
-
|
87 |
-
$pagename = get_query_var('pagename');
|
88 |
-
|
89 |
-
$action = ( isset($_REQUEST['action']) && 'tml-page' == $this->request_instance ) ? $_REQUEST['action'] : 'login';
|
90 |
-
|
91 |
-
if ( 'login' == $pagename ) {
|
92 |
-
$posts[] = (object) array(
|
93 |
-
'post_content' => '[theme-my-login show_title="0" before_widget="" after_widget="" instance="tml-page"]',
|
94 |
-
'post_title' => $this->getTitle($action),
|
95 |
-
'post_excerpt' => '',
|
96 |
-
'post_status' => 'publish',
|
97 |
-
'comment_status' => 'closed',
|
98 |
-
'ping_status' => 'closed',
|
99 |
-
'post_name' => 'login',
|
100 |
-
'post_type' => 'page'
|
101 |
-
);
|
102 |
-
}
|
103 |
-
return $posts;
|
104 |
-
}
|
105 |
-
|
106 |
-
// Make our dummy page work with permalinks
|
107 |
-
function pageRewriteRules($rules) {
|
108 |
-
global $wp_rewrite;
|
109 |
-
$wp_rewrite->add_rewrite_tag('%pagename%', '(login)', 'pagename=');
|
110 |
-
$rules = array_merge($rules, $wp_rewrite->generate_rewrite_rules($wp_rewrite->get_page_permastruct(), EP_PAGES));
|
111 |
-
return $rules;
|
112 |
-
}
|
113 |
-
|
114 |
-
function adminInit() {
|
115 |
-
global $user_ID, $wp_version, $pagenow;
|
116 |
-
|
117 |
-
if ( 'options-general.php' == $pagenow ) {
|
118 |
-
$page = isset($_GET['page']) ? $_GET['page'] : '';
|
119 |
-
if ( 'theme-my-login/admin/admin.php'== $page ) {
|
120 |
-
wp_enqueue_script('theme-my-login-admin', plugins_url('/theme-my-login/js/theme-my-login-admin.js'));
|
121 |
-
wp_enqueue_script('jquery-ui-tabs');
|
122 |
-
wp_enqueue_style('theme-my-login-admin', plugins_url('/theme-my-login/css/theme-my-login-admin.css'));
|
123 |
-
|
124 |
-
$admin_color = get_usermeta($user_ID, 'admin_color');
|
125 |
-
if ( 'classic' == $admin_color )
|
126 |
-
wp_enqueue_style('jquery-colors-classic', plugins_url('/theme-my-login/css/wp-colors-classic/wp-colors-classic.css'));
|
127 |
-
else
|
128 |
-
wp_enqueue_style('jquery-colors-fresh', plugins_url('/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css'));
|
129 |
-
}
|
130 |
-
} elseif ( 'users.php' == $pagenow && 'admin' == $this->options['moderation'] ) {
|
131 |
-
if ( isset($_GET['action']) && 'approve' == $_GET['action'] ) {
|
132 |
-
check_admin_referer('approve-user');
|
133 |
-
|
134 |
-
$user = isset($_GET['user']) ? $_GET['user'] : '';
|
135 |
-
if ( !$user )
|
136 |
-
wp_die(__('You can’t edit that user.', 'theme-my-login'));
|
137 |
-
|
138 |
-
if ( !current_user_can('edit_user', $user) )
|
139 |
-
wp_die(__('You can’t edit that user.', 'theme-my-login'));
|
140 |
-
|
141 |
-
require_once(WP_PLUGIN_DIR . '/theme-my-login/includes/functions.php');
|
142 |
-
if ( !approve_new_user($user) )
|
143 |
-
wp_die(__('You can’t edit that user.', 'theme-my-login'));
|
144 |
-
|
145 |
-
add_action('admin_notices', create_function('', "echo '<div id=\"message\" class=\"updated fade\"><p>' . __('User approved.', 'theme-my-login') . '</p></div>';"));
|
146 |
-
}
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
function userRowActions($actions, $user_object) {
|
151 |
-
$current_user = wp_get_current_user();
|
152 |
-
$user_role = reset($user_object->roles);
|
153 |
-
if ( $current_user->ID != $user_object->ID ) {
|
154 |
-
if ( 'pending' == $user_role ) {
|
155 |
-
$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", 'approve-user') ) . '">Approve</a>';
|
156 |
-
$actions = array_merge($approve, $actions);
|
157 |
-
}
|
158 |
-
}
|
159 |
-
return $actions;
|
160 |
-
}
|
161 |
-
|
162 |
-
function adminMenu() {
|
163 |
-
add_options_page(__('Theme My Login', 'theme-my-login'), __('Theme My Login', 'theme-my-login'), 8, 'theme-my-login/admin/admin.php');
|
164 |
-
}
|
165 |
-
|
166 |
-
// If our virtual page is reached, redirect to the right template
|
167 |
-
function templateRedirect() {
|
168 |
-
if ( is_page('login') )
|
169 |
-
define('IS_TML', true);
|
170 |
-
|
171 |
-
if ( is_page('login') || is_active_widget(false, null, 'theme-my-login') ) {
|
172 |
-
|
173 |
-
if ( $this->options['use_css'] ) {
|
174 |
-
if ( file_exists(get_stylesheet_directory() . '/theme-my-login.css') )
|
175 |
-
$css_file = get_stylesheet_directory_uri() . '/theme-my-login.css';
|
176 |
-
elseif ( file_exists(get_template_directory() . '/theme-my-login.css') )
|
177 |
-
$css_file = get_template_directory_uri() . '/theme-my-login.css';
|
178 |
-
else
|
179 |
-
$css_file = plugins_url('/theme-my-login/css/theme-my-login.css');
|
180 |
-
|
181 |
-
wp_enqueue_style('theme-my-login', $css_file);
|
182 |
-
}
|
183 |
-
|
184 |
-
//Set a cookie now to see if they are supported by the browser.
|
185 |
-
setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
|
186 |
-
if ( SITECOOKIEPATH != COOKIEPATH )
|
187 |
-
setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
|
188 |
-
|
189 |
-
// allow plugins to override the default actions, and to add extra actions if they want
|
190 |
-
do_action('login_form_' . $this->action);
|
191 |
-
|
192 |
-
$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
|
193 |
-
switch ( $this->action ) {
|
194 |
-
case 'logout' :
|
195 |
-
check_admin_referer('log-out');
|
196 |
-
|
197 |
-
$user = wp_get_current_user();
|
198 |
-
|
199 |
-
$redirect_to = site_url('wp-login.php?loggedout=true');
|
200 |
-
if ( isset( $_REQUEST['redirect_to'] ) )
|
201 |
-
$redirect_to = $_REQUEST['redirect_to'];
|
202 |
-
|
203 |
-
$redirect_to = apply_filters('logout_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
|
204 |
-
|
205 |
-
wp_logout();
|
206 |
-
|
207 |
-
wp_safe_redirect($redirect_to);
|
208 |
-
exit();
|
209 |
-
break;
|
210 |
-
case 'lostpassword' :
|
211 |
-
case 'retrievepassword' :
|
212 |
-
if ( $http_post ) {
|
213 |
-
require_once(WP_PLUGIN_DIR . '/theme-my-login/includes/functions.php');
|
214 |
-
$this->errors = retrieve_password();
|
215 |
-
if ( !is_wp_error($this->errors) ) {
|
216 |
-
$redirect_to = site_url('wp-login.php?checkemail=confirm');
|
217 |
-
if ( 'tml-page' != $this->request_instance )
|
218 |
-
$redirect_to = $this->getCurrentURL('checkemail=confirm&instance=' . $this->request_instance);
|
219 |
-
wp_redirect($redirect_to);
|
220 |
-
exit();
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
if ( isset($_REQUEST['error']) && 'invalidkey' == $_REQUEST['error'] ) $this->errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'theme-my-login'));
|
225 |
-
break;
|
226 |
-
case 'resetpass' :
|
227 |
-
case 'rp' :
|
228 |
-
require_once(WP_PLUGIN_DIR . '/theme-my-login/includes/functions.php');
|
229 |
-
$this->errors = reset_password($_GET['key'], $_GET['login']);
|
230 |
-
|
231 |
-
if ( ! is_wp_error($this->errors) ) {
|
232 |
-
$redirect_to = site_url('wp-login.php?checkemail=newpass');
|
233 |
-
if ( 'tml-page' != $this->request_instance )
|
234 |
-
$redirect_to = $this->getCurrentURL('checkemail=newpass&instance=' . $this->request_instance);
|
235 |
-
wp_redirect($redirect_to);
|
236 |
-
exit();
|
237 |
-
}
|
238 |
-
|
239 |
-
$redirect_to = site_url('wp-login.php?action=lostpassword&error=invalidkey');
|
240 |
-
if ( 'tml-page' != $this->request_instance )
|
241 |
-
$redirect_to = $this->getCurrentURL('action=lostpassword&error=invalidkey&instance=' . $this->request_instance);
|
242 |
-
wp_redirect($redirect_to);
|
243 |
-
exit();
|
244 |
-
break;
|
245 |
-
case 'register' :
|
246 |
-
if ( !get_option('users_can_register') ) {
|
247 |
-
wp_redirect($this->getCurrentURL('registration=disabled'));
|
248 |
-
exit();
|
249 |
-
}
|
250 |
-
|
251 |
-
$user_login = '';
|
252 |
-
$user_email = '';
|
253 |
-
if ( $http_post ) {
|
254 |
-
require_once(ABSPATH . WPINC . '/registration.php');
|
255 |
-
require_once(WP_PLUGIN_DIR . '/theme-my-login/includes/functions.php');
|
256 |
-
|
257 |
-
$user_login = $_POST['user_login'];
|
258 |
-
$user_email = $_POST['user_email'];
|
259 |
-
$this->errors = register_new_user($user_login, $user_email);
|
260 |
-
if ( !is_wp_error($this->errors) ) {
|
261 |
-
if ( 'email' == $this->options['moderation'] )
|
262 |
-
$redirect_to = $this->getCurrentURL('pending=activation&instance=' . $this->request_instance);
|
263 |
-
elseif ( 'admin' == $this->options['moderation'] )
|
264 |
-
$redirect_to = $this->getCurrentURL('pending=approval&instance=' . $this->request_instance);
|
265 |
-
else
|
266 |
-
$redirect_to = $this->getCurrentURL('checkemail=registered&instance=' . $this->request_instance);
|
267 |
-
wp_redirect($redirect_to);
|
268 |
-
exit();
|
269 |
-
}
|
270 |
-
}
|
271 |
-
break;
|
272 |
-
case 'login' :
|
273 |
-
default:
|
274 |
-
$secure_cookie = '';
|
275 |
-
|
276 |
-
// If the user wants ssl but the session is not ssl, force a secure cookie.
|
277 |
-
if ( !empty($_POST['log']) && !force_ssl_admin() ) {
|
278 |
-
$user_name = sanitize_user($_POST['log']);
|
279 |
-
if ( $user = get_userdatabylogin($user_name) ) {
|
280 |
-
if ( get_user_option('use_ssl', $user->ID) ) {
|
281 |
-
$secure_cookie = true;
|
282 |
-
force_ssl_admin(true);
|
283 |
-
}
|
284 |
-
}
|
285 |
-
}
|
286 |
-
|
287 |
-
if ( isset( $_REQUEST['redirect_to'] ) ) {
|
288 |
-
$this->redirect_to = $_REQUEST['redirect_to'];
|
289 |
-
// Redirect to https if user wants ssl
|
290 |
-
if ( $secure_cookie && false !== strpos($this->redirect_to, 'wp-admin') )
|
291 |
-
$this->redirect_to = preg_replace('|^http://|', 'https://', $this->redirect_to);
|
292 |
-
} else {
|
293 |
-
$this->redirect_to = admin_url();
|
294 |
-
}
|
295 |
-
|
296 |
-
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($this->redirect_to, 'https') ) && ( 0 === strpos($this->redirect_to, 'http') ) )
|
297 |
-
$secure_cookie = false;
|
298 |
-
|
299 |
-
$user = wp_signon('', $secure_cookie);
|
300 |
-
|
301 |
-
$this->redirect_to = apply_filters('login_redirect', $this->redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
|
302 |
-
|
303 |
-
if ( !is_wp_error($user) ) {
|
304 |
-
// If the user can't edit posts, send them to their profile.
|
305 |
-
if ( !$user->has_cap('edit_posts') && ( empty( $this->redirect_to ) || $this->redirect_to == 'wp-admin/' || $this->redirect_to == admin_url() ) )
|
306 |
-
$this->redirect_to = admin_url('profile.php');
|
307 |
-
wp_safe_redirect($this->redirect_to);
|
308 |
-
exit();
|
309 |
-
}
|
310 |
-
|
311 |
-
$this->errors = $user;
|
312 |
-
break;
|
313 |
-
}
|
314 |
-
}
|
315 |
-
}
|
316 |
-
|
317 |
-
function display($args = '') {
|
318 |
-
|
319 |
-
$this->instance_options = wp_parse_args($args, $this->options);
|
320 |
-
|
321 |
-
$this->action = ( isset($this->instance_options['default_action']) ) ? $this->instance_options['default_action'] : 'login';
|
322 |
-
if ( $this->request_instance == $this->current_instance )
|
323 |
-
$this->action = $_REQUEST['action'];
|
324 |
-
|
325 |
-
ob_start();
|
326 |
-
echo $this->instance_options['before_widget'];
|
327 |
-
if ( $this->instance_options['show_title'] )
|
328 |
-
echo $this->instance_options['before_title'] . $this->getTitle($this->action) . $this->instance_options['after_title'] . "\n";
|
329 |
-
if ( is_user_logged_in() ) {
|
330 |
-
$user = wp_get_current_user();
|
331 |
-
$user_role = reset($user->roles);
|
332 |
-
if ( $this->instance_options['show_gravatar'] )
|
333 |
-
echo '<div class="tml-user-avatar">' . get_avatar( $user->ID, $this->instance_options['gravatar_size'] ) . '</div>' . "\n";
|
334 |
-
echo '<ul class="tml-user-links">' . "\n";
|
335 |
-
if ( $this->instance_options['links'][$user_role] ) {
|
336 |
-
foreach ( $this->instance_options['links'][$user_role] as $key => $data ) {
|
337 |
-
echo '<li><a href="' . $data['url'] . '">' . $data['title'] . '</a></li>' . "\n";
|
338 |
-
}
|
339 |
-
}
|
340 |
-
echo '<li><a href="' . wp_logout_url() . '">' . __('Log Out', 'theme-my-login') . '</a></li>' . "\n" . '</ul>' . "\n";
|
341 |
-
} else {
|
342 |
-
switch ( $this->action ) {
|
343 |
-
case 'lostpassword' :
|
344 |
-
case 'retrievepassword' :
|
345 |
-
$this->getLostPasswordForm();
|
346 |
-
break;
|
347 |
-
case 'register' :
|
348 |
-
$this->getRegisterForm();
|
349 |
-
break;
|
350 |
-
case 'login' :
|
351 |
-
default :
|
352 |
-
$this->getLoginForm();
|
353 |
-
break;
|
354 |
-
}
|
355 |
-
}
|
356 |
-
echo $this->instance_options['after_widget'] . "\n";
|
357 |
-
$contents = ob_get_contents();
|
358 |
-
ob_end_clean();
|
359 |
-
return $contents;
|
360 |
-
}
|
361 |
-
|
362 |
-
function getHeader($message = '') {
|
363 |
-
global $error;
|
364 |
-
|
365 |
-
echo '<div class="login" id="' . $this->current_instance . '">';
|
366 |
-
|
367 |
-
$message = apply_filters('login_message', $message);
|
368 |
-
if ( !empty($message) ) echo '<p class="message">' . $message . "</p>\n";
|
369 |
-
|
370 |
-
// Incase a plugin uses $error rather than the $errors object
|
371 |
-
if ( !empty( $error ) ) {
|
372 |
-
$this->errors->add('error', $error);
|
373 |
-
unset($error);
|
374 |
-
}
|
375 |
-
|
376 |
-
if ( $this->request_instance == $this->current_instance ) {
|
377 |
-
if ( $this->errors->get_error_code() ) {
|
378 |
-
$errors = '';
|
379 |
-
$messages = '';
|
380 |
-
foreach ( $this->errors->get_error_codes() as $code ) {
|
381 |
-
$severity = $this->errors->get_error_data($code);
|
382 |
-
foreach ( $this->errors->get_error_messages($code) as $error ) {
|
383 |
-
if ( 'message' == $severity )
|
384 |
-
$messages .= ' ' . $error . "<br />\n";
|
385 |
-
else
|
386 |
-
$errors .= ' ' . $error . "<br />\n";
|
387 |
-
}
|
388 |
-
}
|
389 |
-
if ( !empty($errors) )
|
390 |
-
echo '<p class="error">' . apply_filters('login_errors', $errors) . "</p>\n";
|
391 |
-
if ( !empty($messages) )
|
392 |
-
echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
|
393 |
-
}
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
function getFooter($login_link = true, $register_link = true, $password_link = true) {
|
398 |
-
echo '<ul class="tml-links">' . "\n";
|
399 |
-
if ( $login_link ) {
|
400 |
-
$url = $this->getCurrentURL('instance=' . $this->current_instance);
|
401 |
-
echo '<li><a href="' . $url . '">' . $this->getTitle('login') . '</a></li>' . "\n";
|
402 |
-
}
|
403 |
-
if ( $register_link && get_option('users_can_register') ) {
|
404 |
-
$url = ($this->instance_options['register_widget']) ? $this->getCurrentURL('action=register&instance=' . $this->current_instance) : site_url('wp-login.php?action=register', 'login');
|
405 |
-
echo '<li><a href="' . $url . '">' . $this->getTitle('register') . '</a></li>' . "\n";
|
406 |
-
}
|
407 |
-
if ( $password_link ) {
|
408 |
-
$url = ($this->instance_options['lost_pass_widget']) ? $this->getCurrentURL('action=lostpassword&instance=' . $this->current_instance) : site_url('wp-login.php?action=lostpassword', 'login');
|
409 |
-
echo '<li><a href="' . $url . '">' . $this->getTitle('lostpassword') . '</a></li>' . "\n";
|
410 |
-
}
|
411 |
-
echo '</ul>' . "\n";
|
412 |
-
echo '</div>' . "\n";
|
413 |
-
}
|
414 |
-
|
415 |
-
function getLoginForm() {
|
416 |
-
|
417 |
-
$this->redirect_to = apply_filters('login_redirect', $this->redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
|
418 |
-
|
419 |
-
// Clear errors if loggedout is set.
|
420 |
-
if ( !empty($_GET['loggedout']) )
|
421 |
-
$this->errors = new WP_Error();
|
422 |
-
|
423 |
-
// If cookies are disabled we can't log in even with a valid user+pass
|
424 |
-
if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
|
425 |
-
$this->errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'theme-my-login'));
|
426 |
-
|
427 |
-
// Some parts of this script use the main login form to display a message
|
428 |
-
if ( $this->request_instance == $this->current_instance ) {
|
429 |
-
if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] )
|
430 |
-
$this->errors->add('loggedout', __('You are now logged out.', 'theme-my-login'), 'message');
|
431 |
-
elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] )
|
432 |
-
$this->errors->add('registerdisabled', __('User registration is currently not allowed.', 'theme-my-login'));
|
433 |
-
elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )
|
434 |
-
$this->errors->add('confirm', __('Check your e-mail for the confirmation link.', 'theme-my-login'), 'message');
|
435 |
-
elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )
|
436 |
-
$this->errors->add('newpass', __('Check your e-mail for your new password.', 'theme-my-login'), 'message');
|
437 |
-
elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) {
|
438 |
-
if ( $this->options['custom_pass'] )
|
439 |
-
$this->errors->add('registered', __('Registration complete. You may now log in.', 'theme-my-login'), 'message');
|
440 |
-
else
|
441 |
-
$this->errors->add('registered', __('Registration complete. Please check your e-mail.', 'theme-my-login'), 'message');
|
442 |
-
} elseif ( isset($_GET['pending']) && 'activation' == $_GET['pending'] )
|
443 |
-
$this->errors->add('pending', __('Registration successful. You must now confirm your email address before you can log in.', 'theme-my-login'), 'message');
|
444 |
-
elseif ( isset($_GET['pending']) && 'approval' == $_GET['pending'] )
|
445 |
-
$this->errors->add('registered', __('Registration successful. You must now be approved by an administrator before you can log in. You will be notified by e-mail once your account has been reviewed.', 'theme-my-login'), 'message');
|
446 |
-
elseif ( isset($_GET['activation']) && 'complete' == $_GET['activation'] ) {
|
447 |
-
if ( $this->options['custom_pass'] )
|
448 |
-
$this->errors->add('activated', __('Your account was activated successfully! You can now log in with the username and password you provided when you signed up.', 'theme-my-login'), 'message');
|
449 |
-
else
|
450 |
-
$this->errors->add('activated', __('Your account was activated successfully! Please check your e-mail for your password.', 'theme-my-login'), 'message');
|
451 |
-
} elseif ( isset($_GET['activation']) && 'invalidkey' == $_GET['activation'] )
|
452 |
-
$this->errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'theme-my-login'));
|
453 |
-
}
|
454 |
-
|
455 |
-
$this->getHeader();
|
456 |
-
|
457 |
-
if ( isset($_POST['log']) )
|
458 |
-
$user_login = ( 'incorrect_password' == $this->errors->get_error_code() || 'empty_password' == $this->errors->get_error_code() ) ? attribute_escape(stripslashes($_POST['log'])) : '';
|
459 |
-
|
460 |
-
$user_login = ( $this->request_instance == $this->current_instance && isset($user_login) ) ? $user_login : '';
|
461 |
-
|
462 |
-
if ( !isset($_GET['checkemail']) ||
|
463 |
-
( isset($_GET['checkemail']) && $this->request_instance != $this->current_instance ) ||
|
464 |
-
( !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) && $this->request_instance == $this->current_instance ) ||
|
465 |
-
( in_array( $_GET['checkemail'], array('confirm', 'newpass') ) && $this->request_instance != $this->current_instance ) ) {
|
466 |
-
?>
|
467 |
-
<form name="loginform" id="loginform-<?php echo $this->current_instance; ?>" action="<?php echo $this->getCurrentURL('action=login&instance=' . $this->current_instance); ?>" method="post">
|
468 |
-
<p>
|
469 |
-
<label for="log-<?php echo $this->current_instance; ?>"><?php _e('Username', 'theme-my-login') ?></label>
|
470 |
-
<input type="text" name="log" id="log-<?php echo $this->current_instance; ?>" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20" />
|
471 |
-
</p>
|
472 |
-
<p>
|
473 |
-
<label for="pwd-<?php echo $this->current_instance; ?>"><?php _e('Password', 'theme-my-login') ?></label>
|
474 |
-
<input type="password" name="pwd" id="pwd-<?php echo $this->current_instance; ?>" class="input" value="" size="20" />
|
475 |
-
</p>
|
476 |
-
<?php do_action('login_form', $this->current_instance); ?>
|
477 |
-
<p class="forgetmenot"><input name="rememberme" type="checkbox" id="rememberme-<?php echo $this->current_instance; ?>" value="forever" /> <label for="rememberme-<?php echo $this->current_instance; ?>"><?php _e('Remember Me', 'theme-my-login'); ?></label></p>
|
478 |
-
<p class="submit">
|
479 |
-
<input type="submit" name="wp-submit" id="wp-submit-<?php echo $this->current_instance; ?>" value="<?php _e('Log In', 'theme-my-login'); ?>" />
|
480 |
-
<input type="hidden" name="redirect_to" value="<?php echo esc_attr($this->redirect_to); ?>" />
|
481 |
-
<input type="hidden" name="testcookie" value="1" />
|
482 |
-
</p>
|
483 |
-
</form>
|
484 |
-
<?php
|
485 |
-
}
|
486 |
-
if ( $this->request_instance == $this->current_instance && isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) )
|
487 |
-
$login_link = true;
|
488 |
-
else
|
489 |
-
$login_link = false;
|
490 |
-
$this->getFooter($login_link, true, true);
|
491 |
-
}
|
492 |
-
|
493 |
-
function getRegisterForm() {
|
494 |
-
$user_login = isset($_POST['user_login']) ? $_POST['user_login'] : '';
|
495 |
-
$user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
|
496 |
-
|
497 |
-
$message = ( $this->options['custom_pass'] ) ? '' : __('A password will be e-mailed to you.', 'theme-my-login');
|
498 |
-
if ( 'email' == $this->options['moderation'] )
|
499 |
-
$message = __('E-mail moderation is currently enabled. You must confirm your e-mail before you can log in.', 'theme-my-login');
|
500 |
-
elseif ( 'admin' == $this->options['moderation'] )
|
501 |
-
$message = __('User moderation is currently enabled. Your registration must be approved before you can log in.', 'theme-my-login');
|
502 |
-
$message = apply_filters('tml_register_foreword', $message);
|
503 |
-
|
504 |
-
$this->getHeader($message);
|
505 |
-
?>
|
506 |
-
<form name="registerform" id="registerform-<?php echo $this->current_instance; ?>" action="<?php echo $this->getCurrentURL('action=register&instance=' . $this->current_instance); ?>" method="post">
|
507 |
-
<p>
|
508 |
-
<label for="user_login-<?php echo $this->current_instance; ?>"><?php _e('Username', 'theme-my-login') ?></label>
|
509 |
-
<input type="text" name="user_login" id="user_login-<?php echo $this->current_instance; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" />
|
510 |
-
</p>
|
511 |
-
<p>
|
512 |
-
<label for="user_email-<?php echo $this->current_instance; ?>"><?php _e('E-mail', 'theme-my-login') ?></label>
|
513 |
-
<input type="text" name="user_email" id="user_email-<?php echo $this->current_instance; ?>" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" />
|
514 |
-
</p>
|
515 |
-
<?php do_action('register_form', $this->current_instance); ?>
|
516 |
-
<p class="submit">
|
517 |
-
<input type="submit" name="wp-submit" id="wp-submit-<?php echo $this->current_instance; ?>" value="<?php _e('Register', 'theme-my-login'); ?>" />
|
518 |
-
</p>
|
519 |
-
</form>
|
520 |
-
<?php
|
521 |
-
$this->getFooter(true, false, true);
|
522 |
-
}
|
523 |
-
|
524 |
-
function getLostPasswordForm() {
|
525 |
-
do_action('lost_password', $this->current_instance);
|
526 |
-
$this->getHeader(__('Please enter your username or e-mail address. You will receive a new password via e-mail.', 'theme-my-login'));
|
527 |
-
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
528 |
-
?>
|
529 |
-
<form name="lostpasswordform" id="lostpasswordform-<?php echo $this->current_instance; ?>" action="<?php echo $this->getCurrentURL('action=lostpassword&instance=' . $this->current_instance); ?>" method="post">
|
530 |
-
<p>
|
531 |
-
<label for="user_login-<?php echo $this->current_instance; ?>"><?php _e('Username or E-mail:', 'theme-my-login') ?></label>
|
532 |
-
<input type="text" name="user_login" id="user_login-<?php echo $this->current_instance; ?>" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" />
|
533 |
-
</p>
|
534 |
-
<?php do_action('lostpassword_form', $this->current_instance); ?>
|
535 |
-
<p class="submit">
|
536 |
-
<input type="submit" name="wp-submit" id="wp-submit-<?php echo $this->current_instance; ?>" value="<?php _e('Get New Password', 'theme-my-login'); ?>" />
|
537 |
-
</p>
|
538 |
-
</form>
|
539 |
-
<?php
|
540 |
-
$this->getFooter(true, true, false);
|
541 |
-
}
|
542 |
-
|
543 |
-
// Get title depending on current action
|
544 |
-
function getTitle($action = '') {
|
545 |
-
if ( empty($action) )
|
546 |
-
$action = $this->action;
|
547 |
-
|
548 |
-
if ( is_user_logged_in() ) {
|
549 |
-
$user = wp_get_current_user();
|
550 |
-
$title = sprintf(__('Welcome, %s', 'theme-my-login'), $user->display_name);
|
551 |
-
} else {
|
552 |
-
switch ( $action ) {
|
553 |
-
case 'register':
|
554 |
-
$title = __('Register', 'theme-my-login');
|
555 |
-
break;
|
556 |
-
case 'lostpassword':
|
557 |
-
case 'retrievepassword':
|
558 |
-
case 'resetpass':
|
559 |
-
case 'rp':
|
560 |
-
$title = __('Lost Password', 'theme-my-login');
|
561 |
-
break;
|
562 |
-
case 'login':
|
563 |
-
default:
|
564 |
-
$title = __('Log In', 'theme-my-login');
|
565 |
-
}
|
566 |
-
}
|
567 |
-
return apply_filters('tml_title', $title);
|
568 |
-
}
|
569 |
-
|
570 |
-
function getNewInstance() {
|
571 |
-
static $instance = 0;
|
572 |
-
++$instance;
|
573 |
-
$this->current_instance = 'tml-' . $instance;
|
574 |
-
}
|
575 |
-
|
576 |
-
function shortcode($atts = '') {
|
577 |
-
if ( isset($atts['instance']) )
|
578 |
-
$this->current_instance = $atts['instance'];
|
579 |
-
else
|
580 |
-
$this->getNewInstance();
|
581 |
-
$atts = shortcode_atts($this->options, $atts);
|
582 |
-
return $this->display($atts);
|
583 |
-
}
|
584 |
-
|
585 |
-
function siteURL($url, $path, $orig_scheme) {
|
586 |
-
global $wp_rewrite;
|
587 |
-
|
588 |
-
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
589 |
-
$self = $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
590 |
-
|
591 |
-
if ( preg_match('/wp-login.php/', $url) && !isset($_REQUEST['interim-login']) ) {
|
592 |
-
$orig_url = $url;
|
593 |
-
$url = $this->getPermalink();
|
594 |
-
if ( strpos($orig_url, '?') ) {
|
595 |
-
$query = substr($orig_url, strpos($orig_url, '?') + 1);
|
596 |
-
parse_str($query, $r);
|
597 |
-
$url = add_query_arg($r, $url);
|
598 |
-
}
|
599 |
-
}
|
600 |
-
return $url;
|
601 |
-
}
|
602 |
-
|
603 |
-
function getCurrentURL($query = '') {
|
604 |
-
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
605 |
-
$self = $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
606 |
-
|
607 |
-
$keys = array('instance', 'action', 'checkemail', 'error', 'loggedout', 'registered', 'redirect_to', 'updated', 'key', '_wpnonce');
|
608 |
-
$url = remove_query_arg($keys, $self);
|
609 |
-
|
610 |
-
if ( !empty($query) ) {
|
611 |
-
$query = wp_parse_args($query);
|
612 |
-
$url = add_query_arg($query, $url);
|
613 |
-
}
|
614 |
-
|
615 |
-
return $url;
|
616 |
-
}
|
617 |
-
|
618 |
-
function getPermalink() {
|
619 |
-
global $wp_rewrite;
|
620 |
-
|
621 |
-
$pagestruct = $wp_rewrite->get_page_permastruct();
|
622 |
-
|
623 |
-
if ( '' != $pagestruct ) {
|
624 |
-
$link = str_replace('%pagename%', 'login', $pagestruct);
|
625 |
-
$link = trailingslashit(get_option('home')) . "$link";
|
626 |
-
$link = user_trailingslashit($link, 'page');
|
627 |
-
} else {
|
628 |
-
$link = trailingslashit(get_option('home')) . '?pagename=login';
|
629 |
-
}
|
630 |
-
return $link;
|
631 |
-
}
|
632 |
-
|
633 |
-
function loginRedirect($redirect_to, $request, $user) {
|
634 |
-
global $pagenow;
|
635 |
-
|
636 |
-
if ( 'wp-login.php' == $pagenow )
|
637 |
-
return $redirect_to;
|
638 |
-
|
639 |
-
$orig_redirect = $redirect_to;
|
640 |
-
|
641 |
-
$redirect_to = ( 'tml-page' == $this->current_instance ) ? $_SERVER['HTTP_REFERER'] : $this->getCurrentURL();
|
642 |
-
|
643 |
-
if ( is_object($user) && !is_wp_error($user) ) {
|
644 |
-
$user_role = reset($user->roles);
|
645 |
-
if ( '' != $this->options['redirects'][$user_role]['login_url'] )
|
646 |
-
$role_redirect = $this->options['redirects'][$user_role]['login_url'];
|
647 |
-
}
|
648 |
-
|
649 |
-
if ( !empty($request) && $this->options['override_redirect'] )
|
650 |
-
$redirect_to = $request;
|
651 |
-
elseif ( isset($role_redirect) && !$this->options['override_redirect'] )
|
652 |
-
$redirect_to = $role_redirect;
|
653 |
-
|
654 |
-
return $redirect_to;
|
655 |
-
}
|
656 |
-
|
657 |
-
function logoutRedirect($redirect_to, $request, $user) {
|
658 |
-
$orig_redirect = $redirect_to;
|
659 |
-
|
660 |
-
$redirect_to = remove_query_arg(array('instance', 'action', 'checkemail', 'error', 'loggedout', 'registered', 'redirect_to', 'updated', 'key', '_wpnonce'), $_SERVER['HTTP_REFERER']);
|
661 |
-
|
662 |
-
if ( is_object($user) && !is_wp_error($user) ) {
|
663 |
-
$user_role = reset($user->roles);
|
664 |
-
if ( '' != $this->options['redirects'][$user_role]['logout_url'] )
|
665 |
-
$role_redirect = $this->options['redirects'][$user_role]['logout_url'];
|
666 |
-
}
|
667 |
-
|
668 |
-
if ( !empty($request) && $this->options['override_redirect'] )
|
669 |
-
$redirect_to = $request;
|
670 |
-
elseif ( isset($role_redirect) && !$this->options['override_redirect'] )
|
671 |
-
$redirect_to = $role_redirect;
|
672 |
-
|
673 |
-
return $redirect_to;
|
674 |
-
}
|
675 |
-
|
676 |
-
function customPassForm($instance) {
|
677 |
-
?>
|
678 |
-
<p><label for="pass1-<?php echo $instance; ?>"><?php _e('Password:', 'theme-my-login');?></label>
|
679 |
-
<input autocomplete="off" name="pass1" id="pass1-<?php echo $instance; ?>" class="input" size="20" value="" type="password" /></p>
|
680 |
-
<p><label for="pass2-<?php echo $instance; ?>"><?php _e('Confirm Password:', 'theme-my-login');?></label>
|
681 |
-
<input autocomplete="off" name="pass2" id="pass2-<?php echo $instance; ?>" class="input" size="20" value="" type="password" /></p>
|
682 |
-
<?php
|
683 |
-
}
|
684 |
-
|
685 |
-
function customPassErrors($errors){
|
686 |
-
if (empty($_POST['pass1']) || $_POST['pass1'] == '' || empty($_POST['pass2']) || $_POST['pass2'] == ''){
|
687 |
-
$errors->add('empty_password', __('<strong>ERROR</strong>: Please enter a password.', 'theme-my-login'));
|
688 |
-
} elseif ($_POST['pass1'] !== $_POST['pass2']){
|
689 |
-
$errors->add('password_mismatch', __('<strong>ERROR</strong>: Your passwords do not match.', 'theme-my-login'));
|
690 |
-
} elseif (strlen($_POST['pass1'])<6){
|
691 |
-
$errors->add('password_length', __('<strong>ERROR</strong>: Your password must be at least 6 characters in length.', 'theme-my-login'));
|
692 |
-
} else {
|
693 |
-
$_POST['user_pw'] = $_POST['pass1'];
|
694 |
-
}
|
695 |
-
return $errors;
|
696 |
-
}
|
697 |
-
|
698 |
-
function setUserPassword($user_id) {
|
699 |
-
if ( $this->options['custom_pass'] && isset($_POST['user_pw']) && '' != $_POST['user_pw'] )
|
700 |
-
wp_set_password(stripslashes($_POST['user_pw']), $user_id);
|
701 |
-
}
|
702 |
-
|
703 |
-
function userModeration($user_id) {
|
704 |
-
$user = new WP_User($user_id);
|
705 |
-
$user->set_role('pending');
|
706 |
-
if ( 'email' == $this->options['moderation'] ) {
|
707 |
-
global $wpdb;
|
708 |
-
$key = wp_generate_password(20, false);
|
709 |
-
$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user->user_login));
|
710 |
-
}
|
711 |
-
}
|
712 |
-
|
713 |
-
function userActivation() {
|
714 |
-
require_once(WP_PLUGIN_DIR . '/theme-my-login/includes/functions.php');
|
715 |
-
$newpass = ( $this->options['custom_pass'] ) ? 0 : 1;
|
716 |
-
$this->errors = activate_new_user($_GET['key'], $_GET['login'], $newpass);
|
717 |
-
|
718 |
-
if ( ! is_wp_error($this->errors) ) {
|
719 |
-
$redirect_to = site_url('wp-login.php?activation=complete');
|
720 |
-
if ( 'tml-page' != $this->request_instance )
|
721 |
-
$redirect_to = $this->getCurrentURL('activation=complete&instance=' . $this->request_instance);
|
722 |
-
wp_redirect($redirect_to);
|
723 |
-
exit();
|
724 |
-
}
|
725 |
-
|
726 |
-
$redirect_to = site_url('wp-login.php?activation=invalidkey');
|
727 |
-
if ( 'tml-page' != $this->request_instance )
|
728 |
-
$redirect_to = $this->getCurrentURL('activation=invalidkey&instance=' . $this->request_instance);
|
729 |
-
wp_redirect($redirect_to);
|
730 |
-
exit();
|
731 |
-
}
|
732 |
-
|
733 |
-
function authenticate($user, $username, $password) {
|
734 |
-
global $wpdb;
|
735 |
-
|
736 |
-
if ( is_a($user, 'WP_User') ) {
|
737 |
-
$user_role = reset($user->roles);
|
738 |
-
if ( 'pending' == $user_role ) {
|
739 |
-
if ( $this->options['redirects'][$user_role]['login_url'] ) {
|
740 |
-
wp_safe_redirect($this->options['redirects'][$user_role]['login_url']);
|
741 |
-
exit();
|
742 |
-
} else {
|
743 |
-
if ( 'email' == $this->options['moderation'] )
|
744 |
-
return new WP_Error('pending', __('<strong>ERROR</strong>: You have not yet confirmed your e-mail address.', 'theme-my-login'));
|
745 |
-
else
|
746 |
-
return new WP_Error('pending', __('<strong>ERROR</strong>: Your registration has not yet been approved.', 'theme-my-login'));
|
747 |
-
}
|
748 |
-
}
|
749 |
-
}
|
750 |
-
return $user;
|
751 |
-
}
|
752 |
-
|
753 |
-
function denyUser($id) {
|
754 |
-
$user = new WP_User($id);
|
755 |
-
$user_role = reset($user->roles);
|
756 |
-
if ( 'pending' != $user_role )
|
757 |
-
return;
|
758 |
-
|
759 |
-
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
760 |
-
// we want to reverse this for the plain text arena of emails.
|
761 |
-
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
762 |
-
|
763 |
-
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/');
|
764 |
-
$replace_with = array($blogname, get_option('siteurl'), $user->user_login, $user->user_email);
|
765 |
-
$subject = $this->options['user_denial_email']['subject'];
|
766 |
-
$message = $this->options['user_denial_email']['message'];
|
767 |
-
|
768 |
-
if ( !empty($subject) )
|
769 |
-
$subject = preg_replace($replace_this, $replace_with, $subject);
|
770 |
-
else
|
771 |
-
$subject = sprintf(__('[%s] Registration Denied', 'theme-my-login'), $blogname);
|
772 |
-
if ( !empty($message) )
|
773 |
-
$message = preg_replace($replace_this, $replace_with, $message);
|
774 |
-
else
|
775 |
-
$message = sprintf(__('You have been denied access to %s', 'theme-my-login'), $blogname);
|
776 |
-
|
777 |
-
$this->sendEmail($user->user_email, $subject, $message);
|
778 |
-
}
|
779 |
-
|
780 |
-
function allowPasswordReset($allow, $user_id) {
|
781 |
-
$user = new WP_User($user_id);
|
782 |
-
$user_role = reset($user->roles);
|
783 |
-
if ( 'pending' == $user_role )
|
784 |
-
$allow = false;
|
785 |
-
|
786 |
-
return $allow;
|
787 |
-
}
|
788 |
-
|
789 |
-
function sendEmail($to, $subject, $message) {
|
790 |
-
$headers = '';
|
791 |
-
if ( $this->options['email_from'] && $this->options['email_from_name'] )
|
792 |
-
$headers .= 'From: ' . $this->options['email_from_name'] . ' <' . $this->options['email_from'] . '>' . "\r\n";
|
793 |
-
elseif ( $this->options['email_from'] )
|
794 |
-
$headers .= 'From: ' . $this->options['email_from'] . "\r\n";
|
795 |
-
|
796 |
-
if ( 'text/html' == $this->options['email_content_type'] )
|
797 |
-
$headers .= 'Content-type: text/html; charset=' . get_option('blog_charset') . "\r\n";
|
798 |
-
else
|
799 |
-
$headers .= 'Content-type: text/plain; charset=' . get_option('blog_charset') . "\r\n";
|
800 |
-
|
801 |
-
return wp_mail($to, $subject, $message, $headers);
|
802 |
-
}
|
803 |
-
|
804 |
-
function defaultOptions($save = false) {
|
805 |
-
|
806 |
-
// General
|
807 |
-
$this->options['custom_pass'] = 0;
|
808 |
-
$this->options['moderation'] = 'none';
|
809 |
-
$this->options['email_from'] = '';
|
810 |
-
$this->options['email_from_name'] = '';
|
811 |
-
$this->options['email_content_type'] = 'text/plain';
|
812 |
-
$this->options['use_css'] = 1;
|
813 |
-
$this->options['override_redirect'] = 1;
|
814 |
-
|
815 |
-
// Widget
|
816 |
-
$this->options['default_action'] = 'login';
|
817 |
-
$this->options['show_title'] = 1;
|
818 |
-
$this->options['show_log_link'] = 1;
|
819 |
-
$this->options['show_reg_link'] = 1;
|
820 |
-
$this->options['show_pass_link'] = 1;
|
821 |
-
$this->options['register_widget'] = 1;
|
822 |
-
$this->options['lost_pass_widget'] = 1;
|
823 |
-
$this->options['logged_in_widget'] = 1;
|
824 |
-
$this->options['show_gravatar'] = 1;
|
825 |
-
$this->options['gravatar_size'] = 50;
|
826 |
-
$this->options['before_widget'] = '<li>';
|
827 |
-
$this->options['after_widget'] = '</li>';
|
828 |
-
$this->options['before_title'] = '<h2>';
|
829 |
-
$this->options['after_title'] = '</h2>';
|
830 |
-
|
831 |
-
// E-mails
|
832 |
-
$this->options['retrieve_pass_email'] = array('subject' => '', 'message' => '');
|
833 |
-
$this->options['reset_pass_email'] = array('subject' => '', 'message' => '', 'admin_disable' => 0);
|
834 |
-
$this->options['registration_email'] = array('subject' => '', 'message' => '', 'admin_disable' => 0);
|
835 |
-
$this->options['confirmation_email'] = array('subject' => '', 'message' => '');
|
836 |
-
$this->options['user_approval_email'] = array('subject' => '', 'message' => '');
|
837 |
-
$this->options['user_denial_email'] = array('subject' => '', 'message' => '');
|
838 |
-
|
839 |
-
// Links & Redirects
|
840 |
-
global $wp_roles;
|
841 |
-
if ( empty($wp_roles) )
|
842 |
-
$wp_roles = new WP_Roles();
|
843 |
-
$user_roles = $wp_roles->get_names();
|
844 |
-
foreach ( $user_roles as $role => $title ) {
|
845 |
-
if ( 'pending' == $role )
|
846 |
-
continue;
|
847 |
-
$this->options['links'][$role][] = array('title' => 'Dashboard', 'url' => admin_url());
|
848 |
-
$this->options['links'][$role][] = array('title' => 'Profile', 'url' => admin_url('profile.php'));
|
849 |
-
$this->options['redirects'][$role] = array('login_url' => '', 'logout_url' => '');
|
850 |
-
}
|
851 |
-
|
852 |
-
if ( $save )
|
853 |
-
$this->saveOptions();
|
854 |
-
}
|
855 |
-
|
856 |
-
function loadOptions() {
|
857 |
-
|
858 |
-
$this->defaultOptions();
|
859 |
-
|
860 |
-
$storedoptions = get_option('theme_my_login');
|
861 |
-
if ( $storedoptions && is_array($storedoptions) ) {
|
862 |
-
foreach ( $storedoptions as $key => $value ) {
|
863 |
-
$this->options[$key] = $value;
|
864 |
-
}
|
865 |
-
} else update_option('theme_my_login', $this->options);
|
866 |
-
}
|
867 |
-
|
868 |
-
function getOption($key) {
|
869 |
-
if ( array_key_exists($key, $this->options) ) {
|
870 |
-
return $this->options[$key];
|
871 |
-
} else return null;
|
872 |
-
}
|
873 |
-
|
874 |
-
function setOption($key, $value) {
|
875 |
-
$this->options[$key] = $value;
|
876 |
-
}
|
877 |
-
|
878 |
-
function saveOptions() {
|
879 |
-
$oldvalue = get_option('theme_my_login');
|
880 |
-
if ( $oldvalue == $this->options ) {
|
881 |
-
return true;
|
882 |
-
} else return update_option('theme_my_login', $this->options);
|
883 |
-
}
|
884 |
-
|
885 |
-
function install() {
|
886 |
-
$plugin_data = get_plugin_data(__FILE__);
|
887 |
-
$this->setOption('version', $plugin_data['Version']);
|
888 |
-
$this->saveOptions();
|
889 |
-
}
|
890 |
-
|
891 |
-
function uninstall() {
|
892 |
-
delete_option('theme_my_login');
|
893 |
-
}
|
894 |
}
|
|
|
895 |
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
function theme_my_login($args = '') {
|
903 |
-
global $ThemeMyLogin;
|
904 |
-
$args = wp_parse_args($args);
|
905 |
-
echo $ThemeMyLogin->shortcode($args);
|
906 |
-
}
|
907 |
-
endif;
|
908 |
-
|
909 |
-
if ( !function_exists('wp_new_user_notification') ) :
|
910 |
-
function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
911 |
-
global $ThemeMyLogin;
|
912 |
-
|
913 |
-
$user = new WP_User($user_id);
|
914 |
-
|
915 |
-
$user_login = stripslashes($user->user_login);
|
916 |
-
$user_email = stripslashes($user->user_email);
|
917 |
-
$user_role = reset($user->roles);
|
918 |
|
919 |
-
|
920 |
-
|
921 |
-
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
922 |
|
923 |
-
|
924 |
-
global $wpdb;
|
925 |
-
$key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login));
|
926 |
-
if ( empty($key) ) {
|
927 |
-
$key = wp_generate_password(20, false);
|
928 |
-
$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
|
929 |
-
}
|
930 |
-
$confirm_url = add_query_arg(array('action' => 'activate', 'key' => $key, 'login' => $user_login), $ThemeMyLogin->getPermalink());
|
931 |
-
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%confirmurl%/', '/%user_login%/', '/%user_email%/', '/%user_pass%/', '/%user_ip%/');
|
932 |
-
$replace_with = array($blogname, get_option('siteurl'), $confirm_url, $user_login, $user_email, $plaintext_pass, $_SERVER['REMOTE_ADDR']);
|
933 |
-
$subject = $ThemeMyLogin->options['confirmation_email']['subject'];
|
934 |
-
$message = $ThemeMyLogin->options['confirmation_email']['message'];
|
935 |
-
|
936 |
-
if ( !empty($subject) )
|
937 |
-
$subject = preg_replace($replace_this, $replace_with, $subject);
|
938 |
-
else
|
939 |
-
$subject = sprintf(__('[%s] Activate Your Account', 'theme-my-login'), $blogname);
|
940 |
-
if ( !empty($message) )
|
941 |
-
$message = preg_replace($replace_this, $replace_with, $message);
|
942 |
-
else {
|
943 |
-
$message = sprintf(__('Thanks for registering at %s! To complete the activation of your account please click the following link: ', 'theme-my-login'), $blogname) . "\r\n\r\n";
|
944 |
-
$message .= $confirm_url;
|
945 |
-
}
|
946 |
-
$ThemeMyLogin->sendEmail($user_email, $subject, $message);
|
947 |
-
} elseif ( 'admin' == $ThemeMyLogin->options['moderation'] && 'pending' == $user_role ) {
|
948 |
-
$message = sprintf(__('New user requires approval on your blog %s:', 'theme-my-login'), $blogname) . "\r\n\r\n";
|
949 |
-
$message .= sprintf(__('Username: %s', 'theme-my-login'), $user_login) . "\r\n\r\n";
|
950 |
-
$message .= sprintf(__('E-mail: %s', 'theme-my-login'), $user_email) . "\r\n\r\n";
|
951 |
-
$message .= __('To approve or deny this user:', 'theme-my-login') . "\r\n";
|
952 |
-
$message .= admin_url('users.php');
|
953 |
-
|
954 |
-
@$ThemeMyLogin->sendEmail(get_option('admin_email'), sprintf(__('[%s] New User Awaiting Approval', 'theme-my-login'), $blogname), $message);
|
955 |
-
} else {
|
956 |
-
if ( !$ThemeMyLogin->options['registration_email']['admin_disable'] ) {
|
957 |
-
$message = sprintf(__('New user registration on your blog %s:', 'theme-my-login'), $blogname) . "\r\n\r\n";
|
958 |
-
$message .= sprintf(__('Username: %s', 'theme-my-login'), $user_login) . "\r\n\r\n";
|
959 |
-
$message .= sprintf(__('E-mail: %s', 'theme-my-login'), $user_email) . "\r\n";
|
960 |
-
|
961 |
-
@$ThemeMyLogin->sendEmail(get_option('admin_email'), sprintf(__('[%s] New User Registration', 'theme-my-login'), $blogname), $message);
|
962 |
-
}
|
963 |
-
|
964 |
-
if ( empty($plaintext_pass) || $ThemeMyLogin->options['custom_pass'] )
|
965 |
-
return;
|
966 |
-
|
967 |
-
$replace_this = array('/%blogname%/', '/%siteurl%/', '/%user_login%/', '/%user_email%/', '/%user_pass%/', '/%user_ip%/');
|
968 |
-
$replace_with = array($blogname, get_option('siteurl'), $user_login, $user_email, $plaintext_pass, $_SERVER['REMOTE_ADDR']);
|
969 |
-
$subject = $ThemeMyLogin->options['registration_email']['subject'];
|
970 |
-
$message = $ThemeMyLogin->options['registration_email']['message'];
|
971 |
-
|
972 |
-
if ( !empty($subject) )
|
973 |
-
$subject = preg_replace($replace_this, $replace_with, $subject);
|
974 |
-
else
|
975 |
-
$subject = sprintf(__('[%s] Your username and password', 'theme-my-login'), $blogname);
|
976 |
-
if ( !empty($message) )
|
977 |
-
$message = preg_replace($replace_this, $replace_with, $message);
|
978 |
-
else {
|
979 |
-
$message = sprintf(__('Username: %s', 'theme-my-login'), $user_login) . "\r\n";
|
980 |
-
$message .= sprintf(__('Password: %s', 'theme-my-login'), $plaintext_pass) . "\r\n";
|
981 |
-
$message .= wp_login_url() . "\r\n";
|
982 |
-
}
|
983 |
-
$ThemeMyLogin->sendEmail($user_email, $subject, $message);
|
984 |
-
}
|
985 |
-
}
|
986 |
-
endif;
|
987 |
}
|
988 |
}
|
989 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
990 |
?>
|
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: 5.0
|
7 |
Author: Jeff Farthing
|
8 |
Author URI: http://www.jfarthing.com
|
9 |
Text Domain: theme-my-login
|
10 |
*/
|
11 |
|
12 |
+
// Bailout if we're at the default login
|
13 |
+
if ( 'wp-login.php' == $pagenow )
|
14 |
+
return;
|
15 |
+
|
16 |
+
// Set the default module directory
|
17 |
+
if ( !defined('TML_MODULE_DIR') )
|
18 |
+
define('TML_MODULE_DIR', WP_PLUGIN_DIR . '/theme-my-login/modules');
|
19 |
+
|
20 |
+
// Require global configuration class file
|
21 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/class.php' );
|
22 |
+
|
23 |
+
// Declare $theme_my_login as global for use within functions
|
24 |
+
global $theme_my_login;
|
25 |
+
|
26 |
+
// Initialize global configuration class
|
27 |
+
$theme_my_login = new Theme_My_Login();
|
28 |
+
|
29 |
+
// Require general plugin functions file
|
30 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/functions.php' );
|
31 |
+
|
32 |
+
// Load the plugin textdomain
|
33 |
+
load_plugin_textdomain('theme-my-login', '', 'theme-my-login/language');
|
34 |
+
|
35 |
+
// Load active modules
|
36 |
+
wdbj_tml_load_active_modules();
|
37 |
+
|
38 |
+
// Include admin-functions.php for install/uninstall process
|
39 |
+
if ( is_admin() ) {
|
40 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/admin/includes/admin.php' );
|
41 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/admin/includes/module.php' );
|
42 |
+
|
43 |
+
register_activation_hook(__FILE__, 'wdbj_tml_install');
|
44 |
+
register_uninstall_hook(__FILE__, 'wdbj_tml_uninstall');
|
45 |
+
|
46 |
+
add_action('admin_init', 'wdbj_tml_admin_init');
|
47 |
+
add_action('admin_menu', 'wdbj_tml_admin_menu');
|
48 |
+
|
49 |
+
if ( function_exists('wp_new_user_notification') )
|
50 |
+
add_action('admin_notices', 'wdbj_tml_new_user_notification_override_notice');
|
51 |
+
if ( function_exists('wp_password_change_notification') )
|
52 |
+
add_action('admin_notices', 'wdbj_tml_password_change_notification_override_notice');
|
53 |
+
}
|
54 |
|
55 |
+
// Load pluggable functions after modules (in case a module needs to override a function)
|
56 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/pluggable-functions.php' );
|
57 |
+
|
58 |
+
add_action('plugins_loaded', 'wdbj_tml_load');
|
59 |
+
function wdbj_tml_load() {
|
60 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/hook-functions.php' );
|
61 |
+
|
62 |
+
do_action('tml_load');
|
63 |
+
|
64 |
+
add_action('template_redirect', 'wdbj_tml_template_redirect');
|
65 |
+
|
66 |
+
add_filter('the_title', 'wdbj_tml_the_title', 10, 2);
|
67 |
+
add_filter('single_post_title', 'wdbj_tml_single_post_title');
|
68 |
+
|
69 |
+
if ( wdbj_tml_get_option('rewrite_links') )
|
70 |
+
add_filter('site_url', 'wdbj_tml_site_url', 10, 3);
|
71 |
+
|
72 |
+
if ( wdbj_tml_get_option('show_page') )
|
73 |
+
add_filter('get_pages', 'wdbj_tml_get_pages', 10, 2);
|
74 |
+
else
|
75 |
+
add_filter('wp_list_pages_excludes', 'wdbj_tml_list_pages_excludes');
|
76 |
+
|
77 |
+
add_shortcode('theme-my-login', 'wdbj_tml_shortcode');
|
78 |
+
|
79 |
+
if ( wdbj_tml_get_option('enable_widget') ) {
|
80 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/widget.php' );
|
81 |
+
add_action('widgets_init', 'wdbj_tml_register_widget');
|
82 |
+
function wdbj_tml_register_widget() {
|
83 |
+
return register_widget("Theme_My_Login_Widget");
|
84 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
+
}
|
87 |
|
88 |
+
function wdbj_tml_template_redirect() {
|
89 |
+
if ( is_page(wdbj_tml_get_option('page_id')) || wdbj_tml_get_option('enable_template_tag') || is_active_widget(false, null, 'theme-my-login') ) {
|
90 |
+
|
91 |
+
wdbj_tml_set_error();
|
92 |
+
|
93 |
+
do_action('tml_init');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
+
if ( wdbj_tml_get_option('enable_css') )
|
96 |
+
wdbj_tml_get_css();
|
|
|
97 |
|
98 |
+
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/login-actions.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
}
|
101 |
|
102 |
+
// Template tag
|
103 |
+
function theme_my_login($args = '') {
|
104 |
+
if ( ! wdbj_tml_get_option('enable_template_tag') )
|
105 |
+
return false;
|
106 |
+
$args = wp_parse_args($args);
|
107 |
+
echo wdbj_tml_shortcode($args);
|
108 |
+
}
|
109 |
+
|
110 |
?>
|