Version Description
- Removed a link after request from WordPress.org staff
- wp_lostpassword_url() for lost password link
- sanitized user_login
- Uses wp_ajax for ajax login instead of init functions
- Secure cookie logic change
Download this release
Release Info
Developer | jolley_small |
Plugin | Sidebar Login |
Version | 2.3.3 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.3.3
- js/sidebar-login.js +24 -13
- langs/sblogin-fi_FI.mo +0 -0
- langs/sblogin-fi_FI.po +200 -0
- readme.txt +9 -2
- sidebar-login.php +88 -28
js/sidebar-login.js
CHANGED
@@ -2,26 +2,37 @@ jQuery(function(){
|
|
2 |
|
3 |
// Ajax Login
|
4 |
jQuery('.widget_wp_sidebarlogin form').submit(function(){
|
|
|
5 |
var thisform = this;
|
|
|
6 |
jQuery(thisform).block({ message: null, overlayCSS: {
|
7 |
backgroundColor: '#fff',
|
8 |
opacity: 0.6
|
9 |
} });
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
});
|
|
|
25 |
return false;
|
26 |
});
|
27 |
|
2 |
|
3 |
// Ajax Login
|
4 |
jQuery('.widget_wp_sidebarlogin form').submit(function(){
|
5 |
+
|
6 |
var thisform = this;
|
7 |
+
|
8 |
jQuery(thisform).block({ message: null, overlayCSS: {
|
9 |
backgroundColor: '#fff',
|
10 |
opacity: 0.6
|
11 |
} });
|
12 |
+
|
13 |
+
var data = {
|
14 |
+
action: 'sidebar_login_process',
|
15 |
+
security: sidebar_login_params.login_nonce,
|
16 |
+
user_login: jQuery('input[name="log"]', thisform).val(),
|
17 |
+
user_password: jQuery('input[name="pwd"]', thisform).val(),
|
18 |
+
remember: jQuery('input[name="rememberme"]', thisform).val(),
|
19 |
+
redirect_to: jQuery('.redirect_to:eq(0)', thisform).val()
|
20 |
+
};
|
21 |
+
|
22 |
+
// Ajax action
|
23 |
+
jQuery.post( sidebar_login_params.ajax_url, data, function(response) {
|
24 |
+
jQuery('.login_error').remove();
|
25 |
+
|
26 |
+
result = jQuery.parseJSON( response );
|
27 |
+
|
28 |
+
if (result.success==1) {
|
29 |
+
window.location = result.redirect;
|
30 |
+
} else {
|
31 |
+
jQuery(thisform).prepend('<p class="login_error">' + result.error + '</p>');
|
32 |
+
jQuery(thisform).unblock();
|
33 |
}
|
34 |
});
|
35 |
+
|
36 |
return false;
|
37 |
});
|
38 |
|
langs/sblogin-fi_FI.mo
ADDED
Binary file
|
langs/sblogin-fi_FI.po
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Sidebar Login 2.2.15\n"
|
4 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/sidebar-login\n"
|
5 |
+
"POT-Creation-Date: 2011-02-23 19:11:19+00:00\n"
|
6 |
+
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
7 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: \n"
|
14 |
+
"X-Poedit-Country: \n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: \n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: admin.php:106
|
23 |
+
#: sidebar-login.php:210
|
24 |
+
#@ sblogin
|
25 |
+
msgid "Sidebar Login"
|
26 |
+
msgstr "Sidebar Login"
|
27 |
+
|
28 |
+
#: admin.php:55
|
29 |
+
#@ sblogin
|
30 |
+
msgid "Show Register Link"
|
31 |
+
msgstr "Näytä 'Rekisteröidy' linkki"
|
32 |
+
|
33 |
+
#: admin.php:62
|
34 |
+
#@ sblogin
|
35 |
+
msgid "Show Lost Password Link"
|
36 |
+
msgstr "Näytä 'Salasana hukassa' linkki"
|
37 |
+
|
38 |
+
#: admin.php:76
|
39 |
+
#@ sblogin
|
40 |
+
msgid "Logged in links"
|
41 |
+
msgstr "Sisäänkirjautuneen linkit"
|
42 |
+
|
43 |
+
#: admin.php:75
|
44 |
+
#@ sblogin
|
45 |
+
msgid "Dashboard"
|
46 |
+
msgstr "Ohjausnäkymä"
|
47 |
+
|
48 |
+
#: admin.php:75
|
49 |
+
#@ sblogin
|
50 |
+
msgid "Profile"
|
51 |
+
msgstr "Profiili"
|
52 |
+
|
53 |
+
#: admin.php:69
|
54 |
+
#@ sblogin
|
55 |
+
msgid "Show Logged in Avatar"
|
56 |
+
msgstr "Näytä käyttäjän avatar"
|
57 |
+
|
58 |
+
#: sidebar-login.php:39
|
59 |
+
#@ sblogin
|
60 |
+
msgid "Username:"
|
61 |
+
msgstr "Käyttäjänimi"
|
62 |
+
|
63 |
+
#: sidebar-login.php:40
|
64 |
+
#@ sblogin
|
65 |
+
msgid "Password:"
|
66 |
+
msgstr "Salasana"
|
67 |
+
|
68 |
+
#: sidebar-login.php:41
|
69 |
+
#@ sblogin
|
70 |
+
msgid "Remember me"
|
71 |
+
msgstr "Muista minut"
|
72 |
+
|
73 |
+
#: sidebar-login.php:42
|
74 |
+
#@ sblogin
|
75 |
+
msgid "Register"
|
76 |
+
msgstr "Rekisteröidy"
|
77 |
+
|
78 |
+
#: sidebar-login.php:43
|
79 |
+
#@ sblogin
|
80 |
+
msgid "Password Lost and Found"
|
81 |
+
msgstr "Salasana hukassa"
|
82 |
+
|
83 |
+
#: sidebar-login.php:44
|
84 |
+
#@ sblogin
|
85 |
+
msgid "Lost your password?"
|
86 |
+
msgstr "Salasana hukassa?"
|
87 |
+
|
88 |
+
#: sidebar-login.php:45
|
89 |
+
#@ sblogin
|
90 |
+
msgid "Logout"
|
91 |
+
msgstr "Kirjaudu ulos"
|
92 |
+
|
93 |
+
#: sidebar-login.php:144
|
94 |
+
#@ sblogin
|
95 |
+
msgid "Or login using an <a href=\"http://openid.net/what/\" title=\"Learn about OpenID\">OpenID</a>"
|
96 |
+
msgstr "Tai kirjaudu käyttäen <a href=\"http://openid.net/what/\" title=\"Mikä on OpenID?\">OpenID:tä</a>"
|
97 |
+
|
98 |
+
#: sidebar-login.php:209
|
99 |
+
#@ sblogin
|
100 |
+
msgid "Sidebar Login."
|
101 |
+
msgstr "Sidebar Login."
|
102 |
+
|
103 |
+
#: admin.php:18
|
104 |
+
#@ sblogin
|
105 |
+
msgid "Login"
|
106 |
+
msgstr "Kirjaudu"
|
107 |
+
|
108 |
+
#: admin.php:19
|
109 |
+
#@ sblogin
|
110 |
+
msgid "Logged out heading"
|
111 |
+
msgstr "Kirjautumattoman otsikko"
|
112 |
+
|
113 |
+
#: admin.php:20
|
114 |
+
#@ sblogin
|
115 |
+
msgid "Heading for the widget when the user is logged out."
|
116 |
+
msgstr "Vimpaimen otsikko käyttäjän ollessa kirjautumaton."
|
117 |
+
|
118 |
+
#: admin.php:24
|
119 |
+
#, php-format
|
120 |
+
#@ sblogin
|
121 |
+
msgid "Welcome %username%"
|
122 |
+
msgstr "Tervetuloa %username%"
|
123 |
+
|
124 |
+
#: admin.php:25
|
125 |
+
#@ sblogin
|
126 |
+
msgid "Logged in heading"
|
127 |
+
msgstr "Kirjautuneen otsikko"
|
128 |
+
|
129 |
+
#: admin.php:26
|
130 |
+
#@ sblogin
|
131 |
+
msgid "Heading for the widget when the user is logged in."
|
132 |
+
msgstr "Vimpaimen otsikko käyttäjän ollessa kirjautuneena."
|
133 |
+
|
134 |
+
#: admin.php:31
|
135 |
+
#@ sblogin
|
136 |
+
msgid "Redirects"
|
137 |
+
msgstr "Uudelleenohjaukset"
|
138 |
+
|
139 |
+
#: admin.php:36
|
140 |
+
#@ sblogin
|
141 |
+
msgid "Login redirect"
|
142 |
+
msgstr "Sisäänkirjautumisen uudelleenohjaus"
|
143 |
+
|
144 |
+
#: admin.php:37
|
145 |
+
#@ sblogin
|
146 |
+
msgid "Url to redirect the user to after login. Leave blank to use the current page."
|
147 |
+
msgstr "URL johon käyttäjä siirretään sisäänkirjautumisen jälkeen. Jätä tyhjäksi käyttääksesi nykyistä sivua."
|
148 |
+
|
149 |
+
#: admin.php:43
|
150 |
+
#@ sblogin
|
151 |
+
msgid "Logout redirect"
|
152 |
+
msgstr "Uloskirjautumisen uudelleenohjaus"
|
153 |
+
|
154 |
+
#: admin.php:44
|
155 |
+
#@ sblogin
|
156 |
+
msgid "Url to redirect the user to after logout. Leave blank to use the current page."
|
157 |
+
msgstr "URL johon käyttäjä siirretään uloskirjautumisen jälkeen. Jätä tyhjäksi käyttääksesi nykyistä sivua."
|
158 |
+
|
159 |
+
#: admin.php:50
|
160 |
+
#@ sblogin
|
161 |
+
msgid "Links"
|
162 |
+
msgstr "Linkit"
|
163 |
+
|
164 |
+
#: admin.php:56
|
165 |
+
#, php-format
|
166 |
+
#@ sblogin
|
167 |
+
msgid "The <a href=\"%s\" target=\"_blank\">'Anyone can register'</a> setting must be turned on for this option to work."
|
168 |
+
msgstr "Valinta <a href=\"%s\" target=\"_blank\">'Kuka tahansa voi rekisteröityä'</a> täytyy olla käytössä, jotta tämä asetus toimii."
|
169 |
+
|
170 |
+
#: admin.php:77
|
171 |
+
#, php-format
|
172 |
+
#@ sblogin
|
173 |
+
msgid "One link per line. Note: Logout link will always show regardless. Tip: Add <code>|true</code> after a link to only show it to admin users or alternatively use a <code>|user_capability</code> and the link will only be shown to users with that capability (see <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_blank'>Roles and Capabilities</a>).<br/> You can also type <code>%%USERNAME%%</code> and <code>%%USERID%%</code> which will be replaced by the user's info. Default: <br/><a href=\"%s/wp-admin/\">Dashboard</a><br/><a href=\"%s/wp-admin/profile.php\">Profile</a>"
|
174 |
+
msgstr "Yksi linkki per rivi. Huom: Kirjaudu ulos linkki näytetään aina. Vinkki: Lisää <code>|true</code> linkin perään näyttääksesi vain ylläpitäjille tai vaihtoehtoisesti käytä <code>|user_capability</code> näyttääksesi linkin niille kenellä on määrittelemäsi oikeudet (Katso <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_blank'>Roolit ja oikeudet (englanniksi)</a>).<br/> Voit myös kirjoittaa <code>%%USERNAME%%</code> ja/tai <code>%%USERID%%</code>, jotka korvataan käyttäjän tiedoilla. Oletus:<br/><a href=\"%s/wp-admin/\">Dashboard</a><br/><a href=\"%s/wp-admin/profile.php\">Profile</a>"
|
175 |
+
|
176 |
+
#: admin.php:119
|
177 |
+
#@ sblogin
|
178 |
+
msgid "Sidebar Login Options"
|
179 |
+
msgstr "Sidebar Login asetukset"
|
180 |
+
|
181 |
+
#: admin.php:175
|
182 |
+
#@ sblogin
|
183 |
+
msgid "Save Options"
|
184 |
+
msgstr "Tallenna asetukset"
|
185 |
+
|
186 |
+
#: sidebar-login.php:154
|
187 |
+
#@ sblogin
|
188 |
+
msgid "Login »"
|
189 |
+
msgstr "Kirjaudu »"
|
190 |
+
|
191 |
+
#: sidebar-login.php:254
|
192 |
+
#@ sblogin
|
193 |
+
msgid "<strong>ERROR</strong>: Please enter a username."
|
194 |
+
msgstr "<strong>VIRHE</strong>: Ole hyvä ja kirjoita käyttäjänimi"
|
195 |
+
|
196 |
+
#: sidebar-login.php:257
|
197 |
+
#@ sblogin
|
198 |
+
msgid "<strong>ERROR</strong>: Please enter your password."
|
199 |
+
msgstr "<strong>VIRHE</strong>: Ole hyvä ja kirjoita salasanasi."
|
200 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://mikejolley.com/projects/sidebar-login-for-wordpress/
|
|
4 |
Tags: login, sidebar, widget, sidebar login, meta, form, register
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.2
|
7 |
-
Stable tag: 2.3.
|
8 |
|
9 |
Adds a sidebar widget to let users login. Displayed links can be changed from the <a href="options-general.php?page=Sidebar%20Login">settings page</a>.
|
10 |
|
@@ -31,7 +31,7 @@ Added localizations are listed below. If you want to contribute or improve a loc
|
|
31 |
* Italian Translation by Alessandro Spadavecchia
|
32 |
* Hungarian translation by Laszlo Dvornik
|
33 |
* Hungarian (2) translation by Balint Vereskuti
|
34 |
-
* Russian translation by Fat Cow
|
35 |
* Romanian translation by Victor Osorhan
|
36 |
* Spanish translation by Tribak (http://blog.tribak.org/sidebar-login-es_es/)
|
37 |
* Spanish (2) translation by Ricardo Vilella (http://www.ifconfig.com.ar/general/traduccion-al-espanol-del-plugin-sidebar-login-para-wordpress/)
|
@@ -78,6 +78,13 @@ You will find a config page in tools/settings > Sidebar Login. Here you can set
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
= 2.3.2 =
|
82 |
* Login redirect fix
|
83 |
|
4 |
Tags: login, sidebar, widget, sidebar login, meta, form, register
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.2
|
7 |
+
Stable tag: 2.3.3
|
8 |
|
9 |
Adds a sidebar widget to let users login. Displayed links can be changed from the <a href="options-general.php?page=Sidebar%20Login">settings page</a>.
|
10 |
|
31 |
* Italian Translation by Alessandro Spadavecchia
|
32 |
* Hungarian translation by Laszlo Dvornik
|
33 |
* Hungarian (2) translation by Balint Vereskuti
|
34 |
+
* Russian translation by Fat Cow
|
35 |
* Romanian translation by Victor Osorhan
|
36 |
* Spanish translation by Tribak (http://blog.tribak.org/sidebar-login-es_es/)
|
37 |
* Spanish (2) translation by Ricardo Vilella (http://www.ifconfig.com.ar/general/traduccion-al-espanol-del-plugin-sidebar-login-para-wordpress/)
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= 2.3.3 =
|
82 |
+
* Removed a link after request from WordPress.org staff
|
83 |
+
* wp_lostpassword_url() for lost password link
|
84 |
+
* sanitized user_login
|
85 |
+
* Uses wp_ajax for ajax login instead of init functions
|
86 |
+
* Secure cookie logic change
|
87 |
+
|
88 |
= 2.3.2 =
|
89 |
* Login redirect fix
|
90 |
|
sidebar-login.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Sidebar Login
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/sidebar-login/
|
5 |
Description: Adds a sidebar widget to let users login
|
6 |
-
Version: 2.3.
|
7 |
Author: Mike Jolley
|
8 |
Author URI: http://mikejolley.com
|
9 |
*/
|
@@ -83,8 +83,8 @@ function widget_wp_sidebarlogin($args) {
|
|
83 |
}
|
84 |
}
|
85 |
// Parse %USERNAME%
|
86 |
-
$link[0] = str_replace('%USERNAME%'
|
87 |
-
$link[0] = str_replace('%username%'
|
88 |
// Parse %USERID%
|
89 |
$link[0] = str_replace('%USERID%',$current_user->ID,$link[0]);
|
90 |
$link[0] = str_replace('%userid%',$current_user->ID,$link[0]);
|
@@ -177,7 +177,7 @@ function widget_wp_sidebarlogin($args) {
|
|
177 |
}
|
178 |
if (get_option('sidebarlogin_forgotton_link')=='1') :
|
179 |
|
180 |
-
$links .= '<li><a href="'.
|
181 |
|
182 |
endif;
|
183 |
if ($links) echo '<ul class="sidebarlogin_otherlinks">'.$links.'</ul>';
|
@@ -203,6 +203,13 @@ function widget_wp_sidebarlogin_init() {
|
|
203 |
wp_enqueue_script('blockui');
|
204 |
wp_enqueue_script('sidebar-login');
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
// Register widget
|
207 |
class SidebarLoginMultiWidget extends WP_Widget {
|
208 |
function SidebarLoginMultiWidget() {
|
@@ -238,16 +245,28 @@ function widget_wp_sidebarlogin_check() {
|
|
238 |
endif;
|
239 |
|
240 |
// Check for Secure Cookie
|
241 |
-
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
// Login
|
245 |
$user = wp_signon('', $secure_cookie);
|
246 |
|
247 |
// Redirect filter
|
248 |
if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
249 |
-
|
250 |
-
|
251 |
// Check the username
|
252 |
if ( !$_POST['log'] ) :
|
253 |
$user = new WP_Error();
|
@@ -256,23 +275,11 @@ function widget_wp_sidebarlogin_check() {
|
|
256 |
$user = new WP_Error();
|
257 |
$user->add('empty_username', __('<strong>ERROR</strong>: Please enter your password.', 'sblogin'));
|
258 |
endif;
|
259 |
-
|
260 |
-
//
|
261 |
-
if (
|
262 |
-
|
263 |
-
echo 'SBL_SUCCESS';
|
264 |
-
else :
|
265 |
-
foreach ($user->errors as $error) {
|
266 |
-
echo $error[0];
|
267 |
-
break;
|
268 |
-
}
|
269 |
-
endif;
|
270 |
exit;
|
271 |
-
else :
|
272 |
-
if ( !is_wp_error($user) ) :
|
273 |
-
wp_safe_redirect($redirect_to);
|
274 |
-
exit;
|
275 |
-
endif;
|
276 |
endif;
|
277 |
|
278 |
$login_errors = $user;
|
@@ -282,13 +289,66 @@ function widget_wp_sidebarlogin_check() {
|
|
282 |
add_action('init', 'widget_wp_sidebarlogin_check', 0);
|
283 |
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
}
|
291 |
|
|
|
292 |
/* Get Current URL */
|
293 |
if ( !function_exists('sidebar_login_current_url') ) {
|
294 |
function sidebar_login_current_url( $url = '' ) {
|
3 |
Plugin Name: Sidebar Login
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/sidebar-login/
|
5 |
Description: Adds a sidebar widget to let users login
|
6 |
+
Version: 2.3.3
|
7 |
Author: Mike Jolley
|
8 |
Author URI: http://mikejolley.com
|
9 |
*/
|
83 |
}
|
84 |
}
|
85 |
// Parse %USERNAME%
|
86 |
+
$link[0] = str_replace('%USERNAME%',sanitize_title($current_user->user_login),$link[0]);
|
87 |
+
$link[0] = str_replace('%username%',sanitize_title($current_user->user_login),$link[0]);
|
88 |
// Parse %USERID%
|
89 |
$link[0] = str_replace('%USERID%',$current_user->ID,$link[0]);
|
90 |
$link[0] = str_replace('%userid%',$current_user->ID,$link[0]);
|
177 |
}
|
178 |
if (get_option('sidebarlogin_forgotton_link')=='1') :
|
179 |
|
180 |
+
$links .= '<li><a href="'.wp_lostpassword_url().'" rel="nofollow">'. $thelostpass .'</a></li>';
|
181 |
|
182 |
endif;
|
183 |
if ($links) echo '<ul class="sidebarlogin_otherlinks">'.$links.'</ul>';
|
203 |
wp_enqueue_script('blockui');
|
204 |
wp_enqueue_script('sidebar-login');
|
205 |
|
206 |
+
// Pass variables to script
|
207 |
+
$sidebar_login_params = array(
|
208 |
+
'ajax_url' => admin_url('admin-ajax.php'),
|
209 |
+
'login_nonce' => wp_create_nonce("sidebar-login-action")
|
210 |
+
);
|
211 |
+
wp_localize_script( 'sidebar-login', 'sidebar_login_params', $sidebar_login_params );
|
212 |
+
|
213 |
// Register widget
|
214 |
class SidebarLoginMultiWidget extends WP_Widget {
|
215 |
function SidebarLoginMultiWidget() {
|
245 |
endif;
|
246 |
|
247 |
// Check for Secure Cookie
|
248 |
+
$secure_cookie = '';
|
249 |
+
|
250 |
+
// If the user wants ssl but the session is not ssl, force a secure cookie.
|
251 |
+
if ( !empty($_POST['log']) && !force_ssl_admin() ) {
|
252 |
+
$user_name = sanitize_user($_POST['log']);
|
253 |
+
if ( $user = get_userdatabylogin($user_name) ) {
|
254 |
+
if ( get_user_option('use_ssl', $user->ID) ) {
|
255 |
+
$secure_cookie = true;
|
256 |
+
force_ssl_admin(true);
|
257 |
+
}
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
|
262 |
+
$secure_cookie = false;
|
263 |
|
264 |
// Login
|
265 |
$user = wp_signon('', $secure_cookie);
|
266 |
|
267 |
// Redirect filter
|
268 |
if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
269 |
+
|
|
|
270 |
// Check the username
|
271 |
if ( !$_POST['log'] ) :
|
272 |
$user = new WP_Error();
|
275 |
$user = new WP_Error();
|
276 |
$user->add('empty_username', __('<strong>ERROR</strong>: Please enter your password.', 'sblogin'));
|
277 |
endif;
|
278 |
+
|
279 |
+
// Redirect if successful
|
280 |
+
if ( !is_wp_error($user) ) :
|
281 |
+
wp_safe_redirect( apply_filters('login_redirect', $redirect_to, isset( $redirect_to ) ? $redirect_to : '', $user) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
exit;
|
|
|
|
|
|
|
|
|
|
|
283 |
endif;
|
284 |
|
285 |
$login_errors = $user;
|
289 |
add_action('init', 'widget_wp_sidebarlogin_check', 0);
|
290 |
|
291 |
|
292 |
+
/**
|
293 |
+
* Process ajax login
|
294 |
+
*/
|
295 |
+
add_action('wp_ajax_sidebar_login_process', 'sidebar_login_ajax_process');
|
296 |
+
add_action('wp_ajax_nopriv_sidebar_login_process', 'sidebar_login_ajax_process');
|
297 |
+
|
298 |
+
function sidebar_login_ajax_process() {
|
299 |
+
|
300 |
+
check_ajax_referer( 'sidebar-login-action', 'security' );
|
301 |
+
|
302 |
+
// Get post data
|
303 |
+
$creds = array();
|
304 |
+
$creds['user_login'] = esc_attr($_POST['user_login']);
|
305 |
+
$creds['user_password'] = esc_attr($_POST['user_password']);
|
306 |
+
$creds['remember'] = esc_attr($_POST['remember']);
|
307 |
+
$redirect_to = esc_attr($_POST['redirect_to']);
|
308 |
+
|
309 |
+
// Check for Secure Cookie
|
310 |
+
$secure_cookie = '';
|
311 |
+
|
312 |
+
// If the user wants ssl but the session is not ssl, force a secure cookie.
|
313 |
+
if ( !empty($_POST['log']) && !force_ssl_admin() ) {
|
314 |
+
$user_name = sanitize_user($_POST['log']);
|
315 |
+
if ( $user = get_userdatabylogin($user_name) ) {
|
316 |
+
if ( get_user_option('use_ssl', $user->ID) ) {
|
317 |
+
$secure_cookie = true;
|
318 |
+
force_ssl_admin(true);
|
319 |
+
}
|
320 |
+
}
|
321 |
}
|
322 |
+
|
323 |
+
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
|
324 |
+
$secure_cookie = false;
|
325 |
+
|
326 |
+
// Login
|
327 |
+
$user = wp_signon($creds, $secure_cookie);
|
328 |
+
|
329 |
+
// Redirect filter
|
330 |
+
if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
331 |
+
|
332 |
+
// Result
|
333 |
+
$result = array();
|
334 |
+
|
335 |
+
if ( !is_wp_error($user) ) :
|
336 |
+
$result['success'] = 1;
|
337 |
+
$result['redirect'] = $redirect_to;
|
338 |
+
else :
|
339 |
+
$result['success'] = 0;
|
340 |
+
foreach ($user->errors as $error) {
|
341 |
+
$result['error'] = $error[0];
|
342 |
+
break;
|
343 |
+
}
|
344 |
+
endif;
|
345 |
+
|
346 |
+
echo json_encode($result);
|
347 |
+
|
348 |
+
die();
|
349 |
}
|
350 |
|
351 |
+
|
352 |
/* Get Current URL */
|
353 |
if ( !function_exists('sidebar_login_current_url') ) {
|
354 |
function sidebar_login_current_url( $url = '' ) {
|