Login With Ajax - Version 3.1.3

Version Description

  • fixed JS/CSS file overriding problems
  • fixed class html error in widget/default/widget_in.php
  • fixed redirection issues when not using JS
  • fixed MultiSite registrations not adding user to blog with default role only 'subscriber' (props to Renato Baccaro)
  • fixed vulnerability where registration is still possible even if registration is disabled in settings (props to Kevin Niehage @weizenspreu)
  • fixed problems when trying to log in from an http page when admin ssl is enforced
  • fixed CSS to hide table borders of default widget for the twenty fourteen theme
  • added Hebrew, thanks to Menachem Shapiro
  • fixed HTML validation issues in widgets
  • added error fallback during ajax request
  • added new icons and headers for wordpress.org plugin pages
Download this release

Release Info

Developer netweblogic
Plugin Icon 128x128 Login With Ajax
Version 3.1.3
Comparing to
See all releases

Code changes from version 3.1.2 to 3.1.3

langs/login-with-ajax-he_IL.mo ADDED
Binary file
langs/login-with-ajax-he_IL.po ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of Login With Ajax in Russian
2
+ # This file is distributed under the same license as the Login With Ajax package.
3
+ msgid ""
4
+ msgstr ""
5
+ "PO-Revision-Date: 2013-10-18 19:27+0100\n"
6
+ "MIME-Version: 1.0\n"
7
+ "Content-Type: text/plain; charset=UTF-8\n"
8
+ "Content-Transfer-Encoding: 8bit\n"
9
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
10
+ "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
11
+ "X-Generator: Poedit 1.5.7\n"
12
+ "Project-Id-Version: Login With Ajax\n"
13
+ "POT-Creation-Date: \n"
14
+ "Last-Translator: Marcus Sykes <wp.plugins@netweblogic.com>\n"
15
+ "Language-Team: \n"
16
+
17
+ #: login-with-ajax-admin.php:198 login-with-ajax-admin.php:250
18
+ msgid ""
19
+ "With WPML enabled you can provide different redirection destinations based "
20
+ "on language too."
21
+ msgstr ""
22
+
23
+ #: login-with-ajax-admin.php:303
24
+ msgid ""
25
+ "If you'd like to override the default Wordpress email users receive once "
26
+ "registered, make sure you check the box below and enter a new email subject "
27
+ "and message."
28
+ msgstr ""
29
+
30
+ #: login-with-ajax-admin.php:339
31
+ msgid ""
32
+ "Thanks for signing up to our blog. \n"
33
+ "\n"
34
+ "You can login with the following credentials by visiting %BLOGURL%\n"
35
+ "\n"
36
+ "Username : %USERNAME%\n"
37
+ "Password : %PASSWORD%\n"
38
+ "\n"
39
+ "We look forward to your next visit!\n"
40
+ "\n"
41
+ "The team at %BLOGNAME%"
42
+ msgstr ""
43
+
44
+ #: login-with-ajax-widget.php:48
45
+ msgid "Title"
46
+ msgstr "כותרת"
47
+
48
+ #: login-with-ajax-widget.php:56
49
+ msgid "Recover Password?"
50
+ msgstr "שחזור סיסמא"
51
+
52
+ #: registration.php:18
53
+ msgid "<strong>ERROR</strong>: Please enter a username."
54
+ msgstr ""
55
+
56
+ #: registration.php:20
57
+ msgid ""
58
+ "<strong>ERROR</strong>: This username is invalid because it uses illegal "
59
+ "characters. Please enter a valid username."
60
+ msgstr ""
61
+
62
+ #: registration.php:23
63
+ msgid ""
64
+ "<strong>ERROR</strong>: This username is already registered. Please choose "
65
+ "another one."
66
+ msgstr ""
67
+
68
+ #: registration.php:28
69
+ msgid "<strong>ERROR</strong>: Please type your e-mail address."
70
+ msgstr ""
71
+
72
+ #: registration.php:30
73
+ msgid "<strong>ERROR</strong>: The email address isn&#8217;t correct."
74
+ msgstr ""
75
+
76
+ #: registration.php:33
77
+ msgid ""
78
+ "<strong>ERROR</strong>: This email is already registered, please choose "
79
+ "another one."
80
+ msgstr ""
81
+
82
+ #: registration.php:46
83
+ msgid ""
84
+ "<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a "
85
+ "href=\"mailto:%s\">webmaster</a> !"
86
+ msgstr ""
87
+
88
+ #: login-with-ajax-widget.php:14
89
+ msgid "Login widget with AJAX capabilities."
90
+ msgstr "אפשרויות וידגט כניסה"
91
+
92
+ #: login-with-ajax-widget.php:52
93
+ msgid "Show profile link?"
94
+ msgstr "הצג לינק לפרופיל"
95
+
96
+ #: login-with-ajax-widget.php:60
97
+ msgid "AJAX Registration?"
98
+ msgstr "רישום בAJAX"
99
+
100
+ #: login-with-ajax-widget.php:65
101
+ msgid "Template"
102
+ msgstr "תבנית"
103
+
104
+ #: login-with-ajax.php:157
105
+ msgid "Login Successful, redirecting..."
106
+ msgstr "כניסה מוצלחת, מעביר"
107
+
108
+ #: login-with-ajax.php:169
109
+ msgid "Login successful, updating..."
110
+ msgstr "כניסה מוצלחת, מעדכן"
111
+
112
+ #: login-with-ajax.php:179 login-with-ajax.php:233
113
+ msgid "An undefined error has ocurred"
114
+ msgstr "שגיאה בלתי מוכרת"
115
+
116
+ #: login-with-ajax.php:183
117
+ msgid "Please supply your username and password."
118
+ msgstr "הכנס שם משתמש וסיסמא"
119
+
120
+ #: login-with-ajax.php:203
121
+ msgid "Registration complete. Please check your e-mail."
122
+ msgstr "הרישום בוצע בהצלחה. בבקשה בדוק את הדואר אלקטרוני שלך"
123
+
124
+ #: login-with-ajax.php:224
125
+ msgid "We have sent you an email"
126
+ msgstr "שלחנו לך אימייל"
127
+
128
+ #: pluggable.php:25
129
+ msgid "New user registration on your blog %s:"
130
+ msgstr "משתמש חדש באתר שלך %s:"
131
+
132
+ #: pluggable.php:26 pluggable.php:40
133
+ msgid "Username: %s"
134
+ msgstr "שם משתמש: %s"
135
+
136
+ #: pluggable.php:27
137
+ msgid "E-mail: %s"
138
+ msgstr "אימייל: %s"
139
+
140
+ #: pluggable.php:29
141
+ msgid "[%s] New User Registration"
142
+ msgstr "[%s] רישום משתמש חדש"
143
+
144
+ #: pluggable.php:41
145
+ msgid "Password: %s"
146
+ msgstr "סיסמא: %s"
147
+
148
+ #: pluggable.php:44
149
+ msgid "[%s] Your username and password"
150
+ msgstr "[%s] שם משתמש וסיסמא שלך"
151
+
152
+ #: widget/default/widget_in.php:13
153
+ msgid "Hi"
154
+ msgstr "היי"
155
+
156
+ #: widget/default/widget_in.php:25 widget/default/widget_in.php:29
157
+ msgid "Profile"
158
+ msgstr "פרופיל"
159
+
160
+ #: widget/default/widget_in.php:35
161
+ msgid "Log Out"
162
+ msgstr "יציאה"
163
+
164
+ #: widget/default/widget_in.php:40
165
+ msgid "blog admin"
166
+ msgstr "ניהול האתר"
167
+
168
+ #: login-with-ajax-widget.php:8 widget/default/widget_out.php:31
169
+ #: widget/divs-only/widget_out.php:22 widget/modal/widget_out.php:9
170
+ #: widget/modal/widget_out.php:35
171
+ msgid "Log In"
172
+ msgstr "כניסה"
173
+
174
+ #: widget/default/widget_out.php:14 widget/default/widget_out.php:82
175
+ #: widget/divs-only/widget_out.php:12 widget/divs-only/widget_out.php:59
176
+ #: widget/modal/widget_out.php:19 widget/modal/widget_out.php:91
177
+ msgid "Username"
178
+ msgstr "שם משתמש"
179
+
180
+ #: widget/default/widget_out.php:22 widget/divs-only/widget_out.php:17
181
+ #: widget/modal/widget_out.php:27
182
+ msgid "Password"
183
+ msgstr "סיסמא"
184
+
185
+ #: widget/default/widget_out.php:36 widget/divs-only/widget_out.php:28
186
+ #: widget/modal/widget_out.php:40
187
+ msgid "Remember Me"
188
+ msgstr "זכור אותי"
189
+
190
+ #: widget/default/widget_out.php:39 widget/divs-only/widget_out.php:31
191
+ #: widget/modal/widget_out.php:43
192
+ msgid "Password Lost and Found"
193
+ msgstr "שחזור סיסמאות אבודות ונשכחות"
194
+
195
+ #: widget/default/widget_out.php:39 widget/divs-only/widget_out.php:31
196
+ #: widget/modal/widget_out.php:43
197
+ msgid "Lost your password?"
198
+ msgstr "שכחת סיסמא?"
199
+
200
+ #: widget/default/widget_out.php:43 widget/default/widget_out.php:92
201
+ #: widget/divs-only/widget_out.php:35 widget/divs-only/widget_out.php:72
202
+ #: widget/modal/widget_out.php:47 widget/modal/widget_out.php:112
203
+ msgid "Register"
204
+ msgstr "הרשמה"
205
+
206
+ #: widget/default/widget_out.php:55 widget/divs-only/widget_out.php:41
207
+ #: widget/modal/widget_out.php:59
208
+ msgid "Forgotten Password"
209
+ msgstr "סיסמא שנשכחה"
210
+
211
+ #: widget/default/widget_out.php:60 widget/divs-only/widget_out.php:43
212
+ #: widget/modal/widget_out.php:64
213
+ msgid "Enter username or email"
214
+ msgstr "הכנס שם משתמש או אימייל"
215
+
216
+ #: widget/default/widget_out.php:67 widget/divs-only/widget_out.php:48
217
+ #: widget/modal/widget_out.php:71
218
+ msgid "Get New Password"
219
+ msgstr "קבל סיסמא חדשה"
220
+
221
+ #: widget/default/widget_out.php:68 widget/divs-only/widget_out.php:49
222
+ #: widget/divs-only/widget_out.php:73 widget/modal/widget_out.php:72
223
+ #: widget/modal/widget_out.php:113
224
+ msgid "Cancel"
225
+ msgstr "ביטול"
226
+
227
+ #: widget/default/widget_out.php:77 widget/divs-only/widget_out.php:57
228
+ #: widget/modal/widget_out.php:86
229
+ msgid "Register For This Site"
230
+ msgstr "הרשם לאתר"
231
+
232
+ #: widget/default/widget_out.php:86 widget/divs-only/widget_out.php:63
233
+ #: widget/modal/widget_out.php:97
234
+ msgid "E-mail"
235
+ msgstr "אימייל"
236
+
237
+ #: widget/default/widget_out.php:78 widget/divs-only/widget_out.php:71
238
+ #: widget/modal/widget_out.php:111
239
+ msgid "A password will be e-mailed to you."
240
+ msgstr "סיסמתך תשלח אליך בדואר אלקטרוני"
241
+
242
+ #: login-with-ajax-admin.php:167
243
+ msgid "Redirection Settings"
244
+ msgstr "הגדרות העברה"
245
+
246
+ #: login-with-ajax-admin.php:171
247
+ msgid "Global Login Redirect"
248
+ msgstr "העברה גלובלית בכניסה"
249
+
250
+ #: login-with-ajax-admin.php:175
251
+ msgid ""
252
+ "If you'd like to send the user to a specific URL after login, enter it here "
253
+ "(e.g. http://wordpress.org/)"
254
+ msgstr ""
255
+ "אם ברצונך להעביר משתמש לעמוד מסויים אחרי הכניסה הכנס אותו כאן (דוגמא, http://"
256
+ "wordpress.org/)"
257
+
258
+ #: login-with-ajax-admin.php:176
259
+ msgid ""
260
+ "Use %USERNAME% and it will be replaced with the username of person logging "
261
+ "in."
262
+ msgstr "%USERNAME% יוחלף בשם המשתמש שנכנס"
263
+
264
+ #: login-with-ajax-admin.php:209
265
+ msgid "Global Logout Redirect"
266
+ msgstr "העברה גלובלית ביציאה"
267
+
268
+ #: login-with-ajax-admin.php:213
269
+ msgid ""
270
+ "If you'd like to send the user to a specific URL after logout, enter it here "
271
+ "(e.g. http://wordpress.org/)"
272
+ msgstr ""
273
+ "אם ברצונך להעביר משתמש לעמוד מסויים אחרי היציאה הכנס אותו כאן (לדוגמא, "
274
+ "http://wordpress.org/)"
275
+
276
+ #: login-with-ajax-admin.php:214
277
+ msgid ""
278
+ "Enter %LASTURL% to send the user back to the page they were previously on."
279
+ msgstr "הכנס %LASTURL% על מנת להעביר את המשתמש לעמוד הקודם"
280
+
281
+ #: login-with-ajax-admin.php:222
282
+ msgid "Role-Based Custom Login Redirects"
283
+ msgstr "העברת משתמש בכניסה בהתאם לסוג המשתמש"
284
+
285
+ #: login-with-ajax-admin.php:225
286
+ msgid ""
287
+ "If you would like a specific user role to be redirected to a custom URL upon "
288
+ "login, place it here (blank value will default to the global redirect)"
289
+ msgstr ""
290
+ "אם ברצונך להעביר סוג מסויים של משתמשים לעמוד מסויים אחרי הכניסה, הכנס אותו "
291
+ "כאן (אם ריק המשתמש יועבר בהתאם להעברה גלובלית)"
292
+
293
+ #: login-with-ajax-admin.php:275
294
+ msgid "Role-Based Custom Logout Redirects"
295
+ msgstr "העברה בהתאם לסוג משתמש ביציאה"
296
+
297
+ #: login-with-ajax-admin.php:278
298
+ msgid ""
299
+ "If you would like a specific user role to be redirected to a custom URL upon "
300
+ "logout, place it here (blank value will default to the global redirect)"
301
+ msgstr "אם ברצונך להעביר סוג מסויים של משתמשים לעמוד מסויים"
302
+
303
+ #: login-with-ajax-admin.php:301
304
+ msgid "Notification Settings"
305
+ msgstr "הגדרות התראות"
306
+
307
+ #: login-with-ajax-admin.php:304
308
+ msgid ""
309
+ "If this feature doesn't work, please make sure that you don't have another "
310
+ "plugin installed which also manages user registrations (e.g. BuddyPress and "
311
+ "MU)."
312
+ msgstr ""
313
+ "אם משהו לא עובד נסה לכבות פלאגינים הקשורים ברישום משתמשים (למשל BuddyPress "
314
+ "או MU)"
315
+
316
+ #: login-with-ajax-admin.php:309
317
+ msgid "Override Default Email?"
318
+ msgstr "להחליף את אימייל ברירת מחדל?"
319
+
320
+ #: login-with-ajax-admin.php:317
321
+ msgid "Subject"
322
+ msgstr "נושא"
323
+
324
+ #: login-with-ajax-admin.php:322
325
+ msgid "Your registration at %BLOGNAME%"
326
+ msgstr "ההרשמה ב%BLOGNAME% בוצע בהצלחה"
327
+
328
+ #: login-with-ajax-admin.php:326
329
+ msgid "<code>%USERNAME%</code> will be replaced with a username."
330
+ msgstr "<code>%USERNAME%</code> יוחלף בשם משתמש"
331
+
332
+ #: login-with-ajax-admin.php:327
333
+ msgid "<code>%PASSWORD%</code> will be replaced with the user's password."
334
+ msgstr "<code>%PASSWORD%</code> יוחלף בסיסמא"
335
+
336
+ #: login-with-ajax-admin.php:328 login-with-ajax-admin.php:352
337
+ msgid "<code>%BLOGNAME%</code> will be replaced with the name of your blog."
338
+ msgstr "<code>%BLOGNAME%</code> יוחלף בשם האתר"
339
+
340
+ #: login-with-ajax-admin.php:329 login-with-ajax-admin.php:353
341
+ msgid "<code>%BLOGURL%</code> will be replaced with the url of your blog."
342
+ msgstr "<br /><code>%BLOGURL%</code> יוחלף בכתובת האתר"
343
+
344
+ #: login-with-ajax-admin.php:334
345
+ msgid "Message"
346
+ msgstr "הודעה"
347
+
348
+ #: login-with-ajax-admin.php:361
349
+ msgid "Save Changes"
350
+ msgstr "שמור שינויים"
351
+
352
+ #: login-with-ajax-admin.php:44
353
+ msgid ""
354
+ "New features in Login With AJAX (including registration!), check out the "
355
+ "settings and widget pages!"
356
+ msgstr "אפשרויות חדשות בפלאגין כניסה עם אדגאקס, בדוק את עמוד ההגדרות והוידגטים"
357
+
358
+ #: login-with-ajax-admin.php:46
359
+ msgid "Dismiss"
360
+ msgstr "התעלם"
361
+
362
+ #: login-with-ajax-admin.php:92
363
+ msgid "Changes saved."
364
+ msgstr "ההגדרות נשמרו בהצלחה"
365
+
366
+ #: login-with-ajax-admin.php:135
367
+ msgid "General Settings"
368
+ msgstr "הגדרות כלליות"
369
+
370
+ #: login-with-ajax-admin.php:140
371
+ msgid "Default Template"
372
+ msgstr "תבנית ברירת מחדל"
373
+
374
+ #: login-with-ajax-admin.php:149
375
+ msgid ""
376
+ "Choose the default theme you'd like to use. This can be overriden in the "
377
+ "widget, shortcode and template tags."
378
+ msgstr "בחר תבנית ברירת מחדל. ניתן לעקוף את זה בוידגט קוד קיצור ותגיות תבנית"
379
+
380
+ #: login-with-ajax-admin.php:150
381
+ msgid "Further documentation for this feature coming soon..."
382
+ msgstr "הסברים ליכולת זו עדיין אינם מוכנים"
383
+
384
+ #: login-with-ajax-admin.php:156
385
+ msgid "Disable refresh upon login?"
386
+ msgstr "לבטל רענון עמוד בכניסה?"
387
+
388
+ #: login-with-ajax-admin.php:161
389
+ msgid ""
390
+ "If the user logs in and you check the button above, only the login widget "
391
+ "will update itself without refreshing the page. Not a good idea if your site "
392
+ "shows different content to users once logged in, as a refresh would be "
393
+ "needed."
394
+ msgstr ""
395
+ "אם אופציה זו סומנה, אזי אחרי הכניסה רק החלק של הוידגט יתעדכן ללא רענון הדף. "
396
+ "לא רעיון כל כך טוב אם מוצג תוכן שונה למשתמשים רשומים כי זה מצריך רענון כל הדף"
login-with-ajax.php CHANGED
@@ -147,7 +147,8 @@ class LoginWithAjax {
147
  public static function login(){
148
  $return = array(); //What we send back
149
  if( !empty($_REQUEST['log']) && !empty($_REQUEST['pwd']) && trim($_REQUEST['log']) != '' && trim($_REQUEST['pwd'] != '') ){
150
- $loginResult = wp_signon();
 
151
  $user_role = 'null';
152
  if ( strtolower(get_class($loginResult)) == 'wp_user' ) {
153
  //User login successful
@@ -193,24 +194,29 @@ class LoginWithAjax {
193
  */
194
  public static function register(){
195
  $return = array();
196
- if( !function_exists('register_new_user') ){
197
- include_once('registration.php'); //in ajax we don't have access to this function, so include our own copy of the function
198
- }
199
- $errors = register_new_user($_POST['user_login'], $_POST['user_email']);
200
- if ( !is_wp_error($errors) ) {
201
- //Success
202
- $return['result'] = true;
203
- $return['message'] = __('Registration complete. Please check your e-mail.','login-with-ajax');
204
- //add user to blog if multisite
205
- if( is_multisite() ){
206
- add_user_to_blog(get_current_blog_id(), $errors, 'subscriber');
 
 
 
 
 
 
207
  }
208
- }else{
209
- //Something's wrong
210
- $return['result'] = false;
211
- $return['error'] = $errors->get_error_message();
212
- }
213
- $return['action'] = 'register';
214
  return $return;
215
  }
216
 
@@ -312,11 +318,10 @@ class LoginWithAjax {
312
 
313
  public static function loginRedirect( $redirect, $redirect_notsurewhatthisis, $user ){
314
  $data = self::$data;
315
- if(is_user_logged_in()){
316
  $lwa_redirect = self::getLoginRedirect($user);
317
  if( $lwa_redirect != '' ){
318
- wp_redirect($lwa_redirect);
319
- exit();
320
  }
321
  }
322
  return $redirect;
@@ -348,10 +353,11 @@ class LoginWithAjax {
348
  $redirect = $data["role_login"][$user_role."_".$code];
349
  }
350
  }
 
 
351
  }
352
  //Do string replacements
353
- $redirect = str_replace('%USERNAME%', $user->user_login, $redirect);
354
- $redirect = str_replace("%LASTURL%", $_SERVER['HTTP_REFERER'], $redirect);
355
  if( !empty($_REQUEST['icl_language_code']) ){
356
  $redirect = str_replace("%LANG%", $code.'/', $redirect);
357
  }
@@ -432,9 +438,9 @@ class LoginWithAjax {
432
  * @return string
433
  */
434
  public static function locate_template_url($template_path){
435
- if( file_exists(get_stylesheet_directory().'/plugins/login-with-ajax/login-with-ajax.js') ){ //Child Theme (or just theme)
436
  return trailingslashit(get_stylesheet_directory_uri())."plugins/login-with-ajax/$template_path";
437
- }else if( file_exists(get_template_directory().'/plugins/login-with-ajax/login-with-ajax.js') ){ //Parent Theme (if parent exists)
438
  return trailingslashit(get_template_directory_uri())."plugins/login-with-ajax/$template_path";
439
  }
440
  //Default file in plugin folder
147
  public static function login(){
148
  $return = array(); //What we send back
149
  if( !empty($_REQUEST['log']) && !empty($_REQUEST['pwd']) && trim($_REQUEST['log']) != '' && trim($_REQUEST['pwd'] != '') ){
150
+ $credentials = array('user_login' => $_REQUEST['log'], 'user_password'=> $_REQUEST['pwd'], 'remember' => !empty($_REQUEST['rememberme']));
151
+ $loginResult = wp_signon($credentials);
152
  $user_role = 'null';
153
  if ( strtolower(get_class($loginResult)) == 'wp_user' ) {
154
  //User login successful
194
  */
195
  public static function register(){
196
  $return = array();
197
+ if( get_option('users_can_register') ){
198
+ if( !function_exists('register_new_user') ){
199
+ include_once('registration.php'); //in ajax we don't have access to this function, so include our own copy of the function
200
+ }
201
+ $errors = register_new_user($_REQUEST['user_login'], $_REQUEST['user_email']);
202
+ if ( !is_wp_error($errors) ) {
203
+ //Success
204
+ $return['result'] = true;
205
+ $return['message'] = __('Registration complete. Please check your e-mail.','login-with-ajax');
206
+ //add user to blog if multisite
207
+ if( is_multisite() ){
208
+ add_user_to_blog(get_current_blog_id(), $errors, get_option('default_role'));
209
+ }
210
+ }else{
211
+ //Something's wrong
212
+ $return['result'] = false;
213
+ $return['error'] = $errors->get_error_message();
214
  }
215
+ $return['action'] = 'register';
216
+ }else{
217
+ $return['result'] = false;
218
+ $return['error'] = __('Registration has been disabled.','login-with-ajax');
219
+ }
 
220
  return $return;
221
  }
222
 
318
 
319
  public static function loginRedirect( $redirect, $redirect_notsurewhatthisis, $user ){
320
  $data = self::$data;
321
+ if( is_object($user) ){
322
  $lwa_redirect = self::getLoginRedirect($user);
323
  if( $lwa_redirect != '' ){
324
+ $redirect = $lwa_redirect;
 
325
  }
326
  }
327
  return $redirect;
353
  $redirect = $data["role_login"][$user_role."_".$code];
354
  }
355
  }
356
+ //Do user string replacements
357
+ $redirect = str_replace('%USERNAME%', $user->user_login, $redirect);
358
  }
359
  //Do string replacements
360
+ $redirect = str_replace("%LASTURL%", wp_get_referer(), $redirect);
 
361
  if( !empty($_REQUEST['icl_language_code']) ){
362
  $redirect = str_replace("%LANG%", $code.'/', $redirect);
363
  }
438
  * @return string
439
  */
440
  public static function locate_template_url($template_path){
441
+ if( file_exists(get_stylesheet_directory().'/plugins/login-with-ajax/'.$template_path) ){ //Child Theme (or just theme)
442
  return trailingslashit(get_stylesheet_directory_uri())."plugins/login-with-ajax/$template_path";
443
+ }else if( file_exists(get_template_directory().'/plugins/login-with-ajax/'.$template_path) ){ //Parent Theme (if parent exists)
444
  return trailingslashit(get_template_directory_uri())."plugins/login-with-ajax/$template_path";
445
  }
446
  //Default file in plugin folder
readme.txt CHANGED
@@ -1,9 +1,10 @@
1
- === Login With Ajax ===
2
  Contributors: netweblogic
3
  Tags: login, ajax, ajax login, registration, redirect redirect, buddypress, multi site, sidebar, admin, widget
4
  Requires at least: 3.1
5
- Tested up to: 3.5.1
6
- Stable tag: 3.1.2
 
7
 
8
  Add smooth ajax login/registration effects and choose where users get redirected upon log in/out. Supports SSL, MultiSite, and BuddyPress.
9
 
@@ -50,10 +51,11 @@ Here's a list of currently translated languages. Translations that have been sub
50
  * Albanian - [Besnik Bleta](http://blogu.programeshqip.org/)
51
  * Spanish - Myself and [Danilo Casati](http://e-rgonomy.com)
52
  * Hungarian - Lorinc Borda
53
- * Japanese - [Ryuei Sasaki](http://riuiski.com)
54
  * Arabic (SA) - Adel Madshel
55
  * Persian - [Mohammad Hosein Ameri](http://khandoon.ir/)
56
  * Afrikaans - [Johnny Dunhin](http://helpendehand.co.za)
 
57
 
58
  == Installation ==
59
 
@@ -85,7 +87,7 @@ We've tried to minimize potential conflicts arising from this, but you should co
85
 
86
  = Shortcodes & Template Tags =
87
 
88
- You can use the shortcode [login-with-ajax] or [lwa] and template tag login_with_ajax() with these options :
89
 
90
  * profile_link - (1 or 0)
91
  * If value is 1 (default), a profile link to wp-admin appears.
@@ -101,24 +103,31 @@ You can use the shortcode [login-with-ajax] or [lwa] and template tag login_with
101
  To force SSL, see [http://codex.wordpress.org/Administration_Over_SSL]("this page"). The plugin will automatically detect the wordpress settings.
102
 
103
  = Customizing the Widget =
104
- You can customize the html widgets in an upgrade-safe manner. Firstly, you need to understand how Login With Ajax loads templates:
105
 
106
- * When looking for files/templates there is an order of precedence - active child theme (if applicable), active parent themes, and finally the plugin folder
107
- * Login With Ajax loads only one CSS and JS file. The plugin checks the locations above and loads the one it finds first. This was done to minimize the number of resources loaded, but means that if you have more than one template, you should add any extra CSS and JS to those single files.
108
- * login-with-ajax.js and login-with-ajax.css must be located in either:
109
- * wp-content/themes/yourtheme/plugins/login-with-ajax/
110
- * wp-content/plugins/login-with-ajax/widget/
111
- * Login With Ajax then checks for template folders, if two folders match names (e.g. you move default template to your theme) the order of precedence explained above applies.
112
- * These theme folders are located within :
113
- * wp-content/themes/your-theme-or-child-theme/plugins/login-with-ajax/
114
- * wp-content/plugins/login-with-ajax/widget/
115
- * When a user is logged out, the widget_out.php will be shown, otherwise widget_in.php. These are located in the template folder.
116
 
117
- For example, if you wanted to change some text on the default theme, you could simply copy wp-content/plugins/login-with-ajax/widget/default to wp-content/themes/yourtheme/plugins/login-with-ajax/default and then just edit the files as needed.
 
 
 
 
 
 
 
 
 
 
 
118
 
119
- If you need to change the JS or CSS, copy the javascript file over to wp-content/themes/yourtheme/plugins/login-with-ajax/ (not within the template file) and edit accordingly.
120
 
121
- The Javascript ajax magic relies on the class names within the template files, if you want to modify the templates, make sure you keep these class names.
 
 
122
 
123
  == Screenshots ==
124
 
@@ -154,6 +163,19 @@ For further questions and answers (or to submit one yourself) go to our [http://
154
 
155
  == Changelog ==
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  = 3.1.2 =
158
  * updated Russian, Swedish and POT language files
159
  * added Afrikaans translation
1
+ === Login With Ajax ===
2
  Contributors: netweblogic
3
  Tags: login, ajax, ajax login, registration, redirect redirect, buddypress, multi site, sidebar, admin, widget
4
  Requires at least: 3.1
5
+ Tested up to: 4.0
6
+ Stable tag: 3.1.3
7
+ License: GPLv2 or later
8
 
9
  Add smooth ajax login/registration effects and choose where users get redirected upon log in/out. Supports SSL, MultiSite, and BuddyPress.
10
 
51
  * Albanian - [Besnik Bleta](http://blogu.programeshqip.org/)
52
  * Spanish - Myself and [Danilo Casati](http://e-rgonomy.com)
53
  * Hungarian - Lorinc Borda
54
+ * Japanese - [Ryuei Sasaki](http://ryueisasaki.com/)
55
  * Arabic (SA) - Adel Madshel
56
  * Persian - [Mohammad Hosein Ameri](http://khandoon.ir/)
57
  * Afrikaans - [Johnny Dunhin](http://helpendehand.co.za)
58
+ * Hebrew = Menachem Shapiro
59
 
60
  == Installation ==
61
 
87
 
88
  = Shortcodes & Template Tags =
89
 
90
+ You can use the [shortcode](http://codex.wordpress.org/Shortcode) [login-with-ajax] or [lwa] and [template tag](http://codex.wordpress.org/Template_Tags) `login_with_ajax()` with these options :
91
 
92
  * profile_link - (1 or 0)
93
  * If value is 1 (default), a profile link to wp-admin appears.
103
  To force SSL, see [http://codex.wordpress.org/Administration_Over_SSL]("this page"). The plugin will automatically detect the wordpress settings.
104
 
105
  = Customizing the Widget =
106
+ You can customize the html widgets in an upgrade-safe manner by copying files and editing them within your theme. Firstly, you need to understand how Login With Ajax loads templates:
107
 
108
+ * When looking for files/templates there is an order of precedence - active child theme (if applicable), active parent themes, and finally the plugin folder:
109
+ * `wp-content/themes/your-theme/plugins/login-with-ajax/`
110
+ * `wp-content/themes/parent-theme/plugins/login-with-ajax/`
111
+ * `wp-content/plugins/login-with-ajax/widget/`
 
 
 
 
 
 
112
 
113
+ * Login With Ajax loads only one CSS and JS file which contains code for all templates. The plugin checks the locations above and loads the one it finds first. The default files are:
114
+ * `wp-content/plugins/login-with-ajax/widget/login-with-ajax.js`
115
+ * `wp-content/plugins/login-with-ajax/widget/widget.css`
116
+
117
+ * One caveat for JavaScript files, if you've enabled WP_DEBUG, then LWA will look for a file called `login-with-ajax.source.js`, a non-minified version of the normal JS file.
118
+
119
+ * Login With Ajax then checks for template folders which are loaded according to the preference highlighted above.
120
+ * When a user is logged out, the `widget_out.php` will be used.
121
+ * If logged out, then `widget_in.php` will be used
122
+ * If either of these files don't exist in your template, the one located in the default folder will be used (which you can also override in your theme).
123
+
124
+ **Examples**
125
 
126
+ If you wanted to change some text on the default theme, you could simply copy `wp-content/plugins/login-with-ajax/widget/default` to `wp-content/themes/yourtheme/plugins/login-with-ajax/default` and edit the files as needed.
127
 
128
+ If you need to change the CSS file, copy the file `wp-content/plugins/login-with-ajax/widget/widget.css` over to `wp-content/themes/yourtheme/plugins/login-with-ajax/widget.css` and edit accordingly.
129
+
130
+ The JavaScript ajax magic relies on the class names and hierarchical structure within the template files, if you want to modify the templates without adding your own JS, make sure you keep these class names and structure intact.
131
 
132
  == Screenshots ==
133
 
163
 
164
  == Changelog ==
165
 
166
+ = 3.1.3 =
167
+ * fixed JS/CSS file overriding problems
168
+ * fixed class html error in widget/default/widget_in.php
169
+ * fixed redirection issues when not using JS
170
+ * fixed MultiSite registrations not adding user to blog with default role only 'subscriber' (props to Renato Baccaro)
171
+ * fixed vulnerability where registration is still possible even if registration is disabled in settings (props to Kevin Niehage @weizenspreu)
172
+ * fixed problems when trying to log in from an http page when admin ssl is enforced
173
+ * fixed CSS to hide table borders of default widget for the twenty fourteen theme
174
+ * added Hebrew, thanks to Menachem Shapiro
175
+ * fixed HTML validation issues in widgets
176
+ * added error fallback during ajax request
177
+ * added new icons and headers for wordpress.org plugin pages
178
+
179
  = 3.1.2 =
180
  * updated Russian, Swedish and POT language files
181
  * added Afrikaans translation
widget/default/widget_in.php CHANGED
@@ -13,7 +13,7 @@
13
  <span class="lwa-title-sub" style="display:none"><?php echo __( 'Hi', 'login-with-ajax' ) . " " . $current_user->display_name ?></span>
14
  <table>
15
  <tr>
16
- <td class="avatar" class="lwa-avatar">
17
  <?php echo get_avatar( $current_user->ID, $size = '50' ); ?>
18
  </td>
19
  <td class="lwa-info">
13
  <span class="lwa-title-sub" style="display:none"><?php echo __( 'Hi', 'login-with-ajax' ) . " " . $current_user->display_name ?></span>
14
  <table>
15
  <tr>
16
+ <td class="avatar lwa-avatar">
17
  <?php echo get_avatar( $current_user->ID, $size = '50' ); ?>
18
  </td>
19
  <td class="lwa-info">
widget/default/widget_out.php CHANGED
@@ -7,6 +7,7 @@
7
  ?>
8
  <div class="lwa lwa-default"><?php //class must be here, and if this is a template, class name should be that of template directory ?>
9
  <form class="lwa-form" action="<?php echo esc_attr(LoginWithAjax::$url_login); ?>" method="post">
 
10
  <span class="lwa-status"></span>
11
  <table>
12
  <tr class="lwa-username">
@@ -45,9 +46,11 @@
45
  </td>
46
  </tr>
47
  </table>
 
48
  </form>
49
  <?php if( !empty($lwa_data['remember']) ): ?>
50
  <form class="lwa-remember" action="<?php echo esc_attr(LoginWithAjax::$url_remember) ?>" method="post" style="display:none;">
 
51
  <span class="lwa-status"></span>
52
  <table>
53
  <tr>
@@ -70,6 +73,7 @@
70
  </td>
71
  </tr>
72
  </table>
 
73
  </form>
74
  <?php endif; ?>
75
  <?php if( get_option('users_can_register') && !empty($lwa_data['registration']) ): ?>
@@ -77,6 +81,7 @@
77
  <h4><?php esc_html_e('Register For This Site','login-with-ajax') ?></h4>
78
  <p><em class="lwa-register-tip"><?php esc_html_e('A password will be e-mailed to you.','login-with-ajax') ?></em></p>
79
  <form class="lwa-register-form" action="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" method="post">
 
80
  <span class="lwa-status"></span>
81
  <p class="lwa-username">
82
  <label><?php esc_html_e('Username','login-with-ajax') ?><br />
@@ -92,6 +97,7 @@
92
  <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register', 'login-with-ajax'); ?>" tabindex="100" />
93
  </p>
94
  <input type="hidden" name="login-with-ajax" value="register" />
 
95
  </form>
96
  </div>
97
  <?php endif; ?>
7
  ?>
8
  <div class="lwa lwa-default"><?php //class must be here, and if this is a template, class name should be that of template directory ?>
9
  <form class="lwa-form" action="<?php echo esc_attr(LoginWithAjax::$url_login); ?>" method="post">
10
+ <div>
11
  <span class="lwa-status"></span>
12
  <table>
13
  <tr class="lwa-username">
46
  </td>
47
  </tr>
48
  </table>
49
+ </div>
50
  </form>
51
  <?php if( !empty($lwa_data['remember']) ): ?>
52
  <form class="lwa-remember" action="<?php echo esc_attr(LoginWithAjax::$url_remember) ?>" method="post" style="display:none;">
53
+ <div>
54
  <span class="lwa-status"></span>
55
  <table>
56
  <tr>
73
  </td>
74
  </tr>
75
  </table>
76
+ </div>
77
  </form>
78
  <?php endif; ?>
79
  <?php if( get_option('users_can_register') && !empty($lwa_data['registration']) ): ?>
81
  <h4><?php esc_html_e('Register For This Site','login-with-ajax') ?></h4>
82
  <p><em class="lwa-register-tip"><?php esc_html_e('A password will be e-mailed to you.','login-with-ajax') ?></em></p>
83
  <form class="lwa-register-form" action="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" method="post">
84
+ <div>
85
  <span class="lwa-status"></span>
86
  <p class="lwa-username">
87
  <label><?php esc_html_e('Username','login-with-ajax') ?><br />
97
  <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register', 'login-with-ajax'); ?>" tabindex="100" />
98
  </p>
99
  <input type="hidden" name="login-with-ajax" value="register" />
100
+ </div>
101
  </form>
102
  </div>
103
  <?php endif; ?>
widget/divs-only/widget_out.php CHANGED
@@ -7,7 +7,7 @@
7
  ?>
8
  <div class="lwa lwa-divs-only">
9
  <span class="lwa-status"></span>
10
- <form name="lwa-form" class="lwa-form" action="<?php echo esc_attr(LoginWithAjax::$url_login); ?>" method="post">
11
  <div class="lwa-username">
12
  <label><?php esc_html_e( 'Username','login-with-ajax' ) ?></label>
13
  <input type="text" name="log" id="lwa_user_login" class="input" />
@@ -41,7 +41,7 @@
41
  </div>
42
  </form>
43
  <?php if( !empty($lwa_data['remember']) ): ?>
44
- <form name="lwa-remember" class="lwa-remember" action="<?php echo esc_attr(LoginWithAjax::$url_remember); ?>" method="post" style="display:none;">
45
  <p><strong><?php esc_html_e("Forgotten Password",'login-with-ajax'); ?></strong></p>
46
  <div class="lwa-remember-email">
47
  <?php $msg = __("Enter username or email",'login-with-ajax'); ?>
@@ -57,7 +57,7 @@
57
  <?php endif; ?>
58
  <?php if ( $lwa_data['registration'] == true ) : ?>
59
  <div class="lwa-register" style="display:none;" >
60
- <form name="registerform" id="registerform" action="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" method="post">
61
  <p><strong><?php esc_html_e('Register For This Site','login-with-ajax'); ?></strong></p>
62
  <div class="lwa-username">
63
  <?php $msg = __('Username','login-with-ajax'); ?>
7
  ?>
8
  <div class="lwa lwa-divs-only">
9
  <span class="lwa-status"></span>
10
+ <form class="lwa-form" action="<?php echo esc_attr(LoginWithAjax::$url_login); ?>" method="post">
11
  <div class="lwa-username">
12
  <label><?php esc_html_e( 'Username','login-with-ajax' ) ?></label>
13
  <input type="text" name="log" id="lwa_user_login" class="input" />
41
  </div>
42
  </form>
43
  <?php if( !empty($lwa_data['remember']) ): ?>
44
+ <form class="lwa-remember" action="<?php echo esc_attr(LoginWithAjax::$url_remember); ?>" method="post" style="display:none;">
45
  <p><strong><?php esc_html_e("Forgotten Password",'login-with-ajax'); ?></strong></p>
46
  <div class="lwa-remember-email">
47
  <?php $msg = __("Enter username or email",'login-with-ajax'); ?>
57
  <?php endif; ?>
58
  <?php if ( $lwa_data['registration'] == true ) : ?>
59
  <div class="lwa-register" style="display:none;" >
60
+ <form class="registerform" action="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" method="post">
61
  <p><strong><?php esc_html_e('Register For This Site','login-with-ajax'); ?></strong></p>
62
  <div class="lwa-username">
63
  <?php $msg = __('Username','login-with-ajax'); ?>
widget/login-with-ajax.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){function t(t,n){e(".lwa-loading").remove();n=e(n);if(t.result===true){n.attr("class","lwa-status lwa-status-confirm").html(t.message)}else if(t.result===false){n.attr("class","lwa-status lwa-status-invalid").html(t.error);n.find("a").click(function(t){t.preventDefault();e(this).parents(".lwa").find("form.lwa-remember").show("slow")})}else{n.attr("class","lwa-status lwa-status-invalid").html("An error has occured. Please try again.")}}if(e("#LoginWithAjax").length>0){e("#LoginWithAjax").addClass("lwa");e("#LoginWithAjax_Status").addClass("lwa-status");e("#LoginWithAjax_Register").addClass("lwa-register");e("#LoginWithAjax_Remember").addClass("lwa-remember");e("#LoginWithAjax_Links_Remember").addClass("lwa-links-remember");e("#LoginWithAjax_Links_Remember_Cancel").addClass("lwa-links-remember-cancel");e("#LoginWithAjax_Form").addClass("lwa-form")}e("form.lwa-form, form.lwa-remember, div.lwa-register form").submit(function(n){n.preventDefault();var r=e(this);var i=r.find(".lwa-status");if(i.length==0){i=e('<span class="lwa-status"></span>');r.prepend(i)}var s=r.find(".lwa-ajax");if(s.length==0){s=e('<input class="lwa-ajax" name="lwa" type="hidden" value="1" />');r.prepend(s)}e('<div class="lwa-loading"></div>').prependTo(r);e.post(r.attr("action"),r.serialize(),function(n){t(n,i);e(document).trigger("lwa_"+n.action,[n,r])},"jsonp")});e(document).on("lwa_login",function(t,n,r){if(n.result===true){if(n.widget!=null){e.get(n.widget,function(t){var n=e(t);r.parent(".lwa").replaceWith(n);var i=n.find(".").show();var s=n.parent().find(".lwa-title");s.replaceWith(i)})}else{if(n.redirect==null){window.location.reload()}else{window.location=n.redirect}}}});e(".lwa-modal").each(function(t,n){var r=e(n);r.parents(".lwa").data("modal",r);e("body").append(e('<div class="lwa"></div>').append(r))});e(document).on("click",".lwa-links-modal",function(t){t.preventDefault();target=e(this).parents(".lwa").data("modal");target.reveal({modalbgclass:"lwa-modal-bg",dismissmodalclass:"lwa-modal-close"})});e(".lwa-links-register-inline").click(function(t){t.preventDefault();e(this).parents(".lwa").find(".lwa-register").show("slow")});e(".lwa-links-register-inline-cancel").click(function(t){t.preventDefault();e(this).parents(".lwa-register").hide("slow")});e(document).on("click",".lwa-links-remember",function(t){t.preventDefault();e(this).parents(".lwa").find(".lwa-remember").show("slow")});e(document).on("click",".lwa-links-remember-cancel",function(t){t.preventDefault();e(this).parents(".lwa-remember").hide("slow")})});(function(e){e("a[data-reveal-id]").on("click",function(t){t.preventDefault();var n=e(this).attr("data-reveal-id");e("#"+n).reveal(e(this).data())});e.fn.reveal=function(t){var n={animation:"fadeAndPop",animationspeed:300,closeonbackgroundclick:true,dismissmodalclass:"close-reveal-modal",modalbgclass:"reveal-modal-bg"};var t=e.extend({},n,t);return this.each(function(){function a(){s=false}function f(){s=true}var n=e(this),r=parseInt(n.css("top")),i=n.height()+r,s=false,o=e("."+t.modalbgclass);if(o.length==0){o=e('<div class="'+t.modalbgclass+'" />').insertAfter(n)}if(n.find("."+t.dismissmodalclass).length==0){n.append('<a class="'+t.dismissmodalclass+'">&#215;</a>')}n.bind("reveal:open",function(){o.unbind("click.modalEvent");e("."+t.dismissmodalclass).unbind("click.modalEvent");if(!s){f();if(t.animation=="fadeAndPop"){n.css({top:e(document).scrollTop()-i,opacity:0,visibility:"visible",display:"block"});o.fadeIn(t.animationspeed/2);n.delay(t.animationspeed/2).animate({top:e(document).scrollTop()+r+"px",opacity:1},t.animationspeed,a())}if(t.animation=="fade"){n.css({opacity:0,visibility:"visible",top:e(document).scrollTop()+r,display:"block"});o.fadeIn(t.animationspeed/2);n.delay(t.animationspeed/2).animate({opacity:1},t.animationspeed,a())}if(t.animation=="none"){n.css({visibility:"visible",top:e(document).scrollTop()+r,display:"block"});o.css({display:"block"});a()}}n.unbind("reveal:open")});n.bind("reveal:close",function(){if(!s){f();if(t.animation=="fadeAndPop"){o.delay(t.animationspeed).fadeOut(t.animationspeed);n.animate({top:e(document).scrollTop()-i+"px",opacity:0},t.animationspeed/2,function(){n.css({top:r,opacity:1,visibility:"hidden"});a()})}if(t.animation=="fade"){o.delay(t.animationspeed).fadeOut(t.animationspeed);n.animate({opacity:0},t.animationspeed,function(){n.css({opacity:1,visibility:"hidden",top:r});a()})}if(t.animation=="none"){n.css({visibility:"hidden",top:r});o.css({display:"none"})}}n.unbind("reveal:close")});n.trigger("reveal:open");var u=e("."+t.dismissmodalclass).bind("click.modalEvent",function(){n.trigger("reveal:close")});if(t.closeonbackgroundclick){o.css({cursor:"pointer"});o.bind("click.modalEvent",function(){n.trigger("reveal:close")})}e("body").keyup(function(e){if(e.which===27){n.trigger("reveal:close")}})})}})(jQuery)
1
+ jQuery(document).ready(function(e){function t(t,n){e(".lwa-loading").remove();n=e(n);if(t.result===true){n.attr("class","lwa-status lwa-status-confirm").html(t.message)}else if(t.result===false){n.attr("class","lwa-status lwa-status-invalid").html(t.error);n.find("a").click(function(t){t.preventDefault();e(this).parents(".lwa").find("form.lwa-remember").show("slow")})}else{n.attr("class","lwa-status lwa-status-invalid").html("An error has occured. Please try again.")}}if(e("#LoginWithAjax").length>0){e("#LoginWithAjax").addClass("lwa");e("#LoginWithAjax_Status").addClass("lwa-status");e("#LoginWithAjax_Register").addClass("lwa-register");e("#LoginWithAjax_Remember").addClass("lwa-remember");e("#LoginWithAjax_Links_Remember").addClass("lwa-links-remember");e("#LoginWithAjax_Links_Remember_Cancel").addClass("lwa-links-remember-cancel");e("#LoginWithAjax_Form").addClass("lwa-form")}e("form.lwa-form, form.lwa-remember, div.lwa-register form").submit(function(n){n.preventDefault();var r=e(this);var i=r.find(".lwa-status");if(i.length==0){i=e('<span class="lwa-status"></span>');r.prepend(i)}var s=r.find(".lwa-ajax");if(s.length==0){s=e('<input class="lwa-ajax" name="lwa" type="hidden" value="1" />');r.prepend(s)}e('<div class="lwa-loading"></div>').prependTo(r);e.ajax({type:"POST",url:r.attr("action"),data:r.serialize(),success:function(n){t(n,i);e(document).trigger("lwa_"+n.action,[n,r])},error:function(){t({},i)},dataType:"jsonp"})});e(document).on("lwa_login",function(t,n,r){if(n.result===true){if(n.widget!=null){e.get(n.widget,function(t){var n=e(t);r.parent(".lwa").replaceWith(n);var i=n.find(".").show();var s=n.parent().find(".lwa-title");s.replaceWith(i)})}else{if(n.redirect==null){window.location.reload()}else{window.location=n.redirect}}}});e(".lwa-modal").each(function(t,n){var r=e(n);r.parents(".lwa").data("modal",r);e("body").append(e('<div class="lwa"></div>').append(r))});e(document).on("click",".lwa-links-modal",function(t){t.preventDefault();target=e(this).parents(".lwa").data("modal");target.reveal({modalbgclass:"lwa-modal-bg",dismissmodalclass:"lwa-modal-close"})});e(".lwa-links-register-inline").click(function(t){t.preventDefault();e(this).parents(".lwa").find(".lwa-register").show("slow")});e(".lwa-links-register-inline-cancel").click(function(t){t.preventDefault();e(this).parents(".lwa-register").hide("slow")});e(document).on("click",".lwa-links-remember",function(t){t.preventDefault();e(this).parents(".lwa").find(".lwa-remember").show("slow")});e(document).on("click",".lwa-links-remember-cancel",function(t){t.preventDefault();e(this).parents(".lwa-remember").hide("slow")})});(function(e){e("a[data-reveal-id]").on("click",function(t){t.preventDefault();var n=e(this).attr("data-reveal-id");e("#"+n).reveal(e(this).data())});e.fn.reveal=function(t){var n={animation:"fadeAndPop",animationspeed:300,closeonbackgroundclick:true,dismissmodalclass:"close-reveal-modal",modalbgclass:"reveal-modal-bg"};var t=e.extend({},n,t);return this.each(function(){function a(){s=false}function f(){s=true}var n=e(this),r=parseInt(n.css("top")),i=n.height()+r,s=false,o=e("."+t.modalbgclass);if(o.length==0){o=e('<div class="'+t.modalbgclass+'" />').insertAfter(n)}if(n.find("."+t.dismissmodalclass).length==0){n.append('<a class="'+t.dismissmodalclass+'">&#215;</a>')}n.bind("reveal:open",function(){o.unbind("click.modalEvent");e("."+t.dismissmodalclass).unbind("click.modalEvent");if(!s){f();if(t.animation=="fadeAndPop"){n.css({top:e(document).scrollTop()-i,opacity:0,visibility:"visible",display:"block"});o.fadeIn(t.animationspeed/2);n.delay(t.animationspeed/2).animate({top:e(document).scrollTop()+r+"px",opacity:1},t.animationspeed,a())}if(t.animation=="fade"){n.css({opacity:0,visibility:"visible",top:e(document).scrollTop()+r,display:"block"});o.fadeIn(t.animationspeed/2);n.delay(t.animationspeed/2).animate({opacity:1},t.animationspeed,a())}if(t.animation=="none"){n.css({visibility:"visible",top:e(document).scrollTop()+r,display:"block"});o.css({display:"block"});a()}}n.unbind("reveal:open")});n.bind("reveal:close",function(){if(!s){f();if(t.animation=="fadeAndPop"){o.delay(t.animationspeed).fadeOut(t.animationspeed);n.animate({top:e(document).scrollTop()-i+"px",opacity:0},t.animationspeed/2,function(){n.css({top:r,opacity:1,visibility:"hidden"});a()})}if(t.animation=="fade"){o.delay(t.animationspeed).fadeOut(t.animationspeed);n.animate({opacity:0},t.animationspeed,function(){n.css({opacity:1,visibility:"hidden",top:r});a()})}if(t.animation=="none"){n.css({visibility:"hidden",top:r});o.css({display:"none"})}}n.unbind("reveal:close")});n.trigger("reveal:open");var u=e("."+t.dismissmodalclass).bind("click.modalEvent",function(){n.trigger("reveal:close")});if(t.closeonbackgroundclick){o.css({cursor:"pointer"});o.bind("click.modalEvent",function(){n.trigger("reveal:close")})}e("body").keyup(function(e){if(e.which===27){n.trigger("reveal:close")}})})}})(jQuery)
widget/login-with-ajax.source.js CHANGED
@@ -31,10 +31,17 @@ jQuery(document).ready( function($) {
31
  }
32
  $('<div class="lwa-loading"></div>').prependTo(form);
33
  //Make Ajax Call
34
- $.post(form.attr('action'), form.serialize(), function(data){
35
- lwaAjax( data, statusElement );
36
- $(document).trigger('lwa_' + data.action, [data, form]);
37
- }, "jsonp");
 
 
 
 
 
 
 
38
  //trigger event
39
  });
40
 
31
  }
32
  $('<div class="lwa-loading"></div>').prependTo(form);
33
  //Make Ajax Call
34
+ $.ajax({
35
+ type : 'POST',
36
+ url : form.attr('action'),
37
+ data : form.serialize(),
38
+ success : function(data){
39
+ lwaAjax( data, statusElement );
40
+ $(document).trigger('lwa_' + data.action, [data, form]);
41
+ },
42
+ error : function(){ lwaAjax({}, statusElement); },
43
+ dataType : 'jsonp'
44
+ });
45
  //trigger event
46
  });
47
 
widget/modal/widget_out.php CHANGED
@@ -61,16 +61,18 @@
61
  </td>
62
  </tr>
63
  <tr class="lwa-remember-email">
64
- <td>
 
65
  <?php $msg = __("Enter username or email", 'login-with-ajax'); ?>
66
  <input type="text" name="user_login" id="lwa_user_remember" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" />
 
67
  <?php do_action('lostpassword_form'); ?>
68
  </td>
69
  </tr>
70
  <tr>
71
  <td>
72
  <input type="submit" value="<?php esc_attr_e("Get New Password", 'login-with-ajax'); ?>" />
73
- <a href="#" class="lwa-links-remember-cancel"><?php esc_html_e("Cancel",'login-with-ajax'); ?></a>
74
  <input type="hidden" name="login-with-ajax" value="remember" />
75
  </td>
76
  </tr>
@@ -89,14 +91,18 @@
89
  </tr>
90
  <tr class="lwa-username">
91
  <td>
 
92
  <?php $msg = __('Username','login-with-ajax') ?>
93
- <input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" /></label>
 
94
  </td>
95
  </tr>
96
  <tr class="lwa-email">
97
- <td>
 
98
  <?php $msg = __('E-mail','login-with-ajax') ?>
99
- <input type="text" name="user_email" id="user_email" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}"/></label>
 
100
  </td>
101
  </tr>
102
  <tr>
61
  </td>
62
  </tr>
63
  <tr class="lwa-remember-email">
64
+ <td>
65
+ <label>
66
  <?php $msg = __("Enter username or email", 'login-with-ajax'); ?>
67
  <input type="text" name="user_login" id="lwa_user_remember" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" />
68
+ </label>
69
  <?php do_action('lostpassword_form'); ?>
70
  </td>
71
  </tr>
72
  <tr>
73
  <td>
74
  <input type="submit" value="<?php esc_attr_e("Get New Password", 'login-with-ajax'); ?>" />
75
+ <a href="#" class="lwa-links-remember-cancel"><?php esc_html_e("Cancel",'login-with-ajax'); ?></a>
76
  <input type="hidden" name="login-with-ajax" value="remember" />
77
  </td>
78
  </tr>
91
  </tr>
92
  <tr class="lwa-username">
93
  <td>
94
+ <label>
95
  <?php $msg = __('Username','login-with-ajax') ?>
96
+ <input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" />
97
+ </label>
98
  </td>
99
  </tr>
100
  <tr class="lwa-email">
101
+ <td>
102
+ <label>
103
  <?php $msg = __('E-mail','login-with-ajax') ?>
104
+ <input type="text" name="user_email" id="user_email" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}"/>
105
+ </label>
106
  </td>
107
  </tr>
108
  <tr>
widget/widget.css CHANGED
@@ -2,8 +2,8 @@
2
  #branding { z-index:9996; } /* a little naughty, twentyeleven fix */
3
  .lwa { margin-bottom:10px; }
4
  form.lwa-form, form.lwa-remember, div.lwa-register form { position:relative; }
5
- .lwa table { width:100% !important; margin:0px !important; border-spacing:0; border-collapse:collapse; }
6
- .lwa td,.lwa th { padding:0; border-spacing:0; }
7
  .lwa td { padding-top:7px; vertical-align:top; background-color:none; }
8
 
9
  /*Logged out CSS*/
2
  #branding { z-index:9996; } /* a little naughty, twentyeleven fix */
3
  .lwa { margin-bottom:10px; }
4
  form.lwa-form, form.lwa-remember, div.lwa-register form { position:relative; }
5
+ .lwa table { width:100% !important; margin:0px !important; border:none !important; border-spacing:0; border-collapse:collapse; }
6
+ .lwa td,.lwa th { padding:0; border-spacing:0; border:none !important; }
7
  .lwa td { padding-top:7px; vertical-align:top; background-color:none; }
8
 
9
  /*Logged out CSS*/