Sidebar Login - Version 2.2.2

Version Description

Download this release

Release Info

Developer jolley_small
Plugin Icon 128x128 Sidebar Login
Version 2.2.2
Comparing to
See all releases

Code changes from version 2.2.1 to 2.2.2

Files changed (2) hide show
  1. readme.txt +5 -1
  2. sidebar-login.php +83 -18
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://blue-anvil.com/archives/wordpress-sidebar-login-2-optimised-
4
  Tags: login, sidebar, widget, sidebar login, meta, form, register
5
  Requires at least: 2.5
6
  Tested up to: 2.7
7
- Stable tag: 2.2.1
8
 
9
  Adds a sidebar widget to let users login.
10
 
@@ -14,6 +14,10 @@ Sidebar-Login has both a widget and a template tag to allow you to have a login
14
 
15
  It lets users login, and then redirects them back to the page they logged in from rather than the backend, it also shows error messages.
16
 
 
 
 
 
17
  == Installation ==
18
 
19
  = First time installation instructions =
4
  Tags: login, sidebar, widget, sidebar login, meta, form, register
5
  Requires at least: 2.5
6
  Tested up to: 2.7
7
+ Stable tag: 2.2.2
8
 
9
  Adds a sidebar widget to let users login.
10
 
14
 
15
  It lets users login, and then redirects them back to the page they logged in from rather than the backend, it also shows error messages.
16
 
17
+ = Localization Files =
18
+
19
+ Czech Translation - http://wordpress.blog.mantlik.cz/plugins/sblogin-cs/
20
+
21
  == Installation ==
22
 
23
  = First time installation instructions =
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.2.1
7
  Author: Mike Jolley
8
  Author URI: http://blue-anvil.com
9
  */
@@ -11,7 +11,7 @@ Author URI: http://blue-anvil.com
11
  load_plugin_textdomain('sblogin','wp-content/plugins/sidebar-login/');
12
 
13
  function wp_sidebarlogin_menu() {
14
- add_management_page(__('Sidebar Login','sblogin'), __('Sidebar Login','sblogin'), 6,'Sidebar Login', 'wp_sidebarlogin_admin');
15
  }
16
 
17
  if (!function_exists('wp_sidebarlogin_magic')) {
@@ -27,7 +27,7 @@ function wp_sidebarlogin_magic() {
27
  }
28
  }
29
 
30
- if (!function_exists(is_ssl)) :
31
  function is_ssl() {
32
  return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
33
  }
@@ -82,7 +82,7 @@ function wp_sidebarlogin_admin(){
82
  </tr>
83
  <tr>
84
  <th scope="col"><?php _e('Logged in links',"sblogin"); ?>:</th>
85
- <td><textarea name="sidebarlogin_logged_in_links" rows="3" cols="80" /><?php echo $sidebarlogin_logged_in_links; ?></textarea><br/><span class="setting-description"><?php _e('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. Default: <br/>&lt;a href="http://localhost:8888/wordpress27/wp-admin/"&gt;Dashboard&lt;/a&gt;<br/>&lt;a href="http://localhost:8888/wordpress27/wp-admin/profile.php"&gt;Profile&lt;/a&gt;','sblogin'); ?></span></td>
86
  </tr>
87
  </table>
88
  <p class="submit"><input type="submit" value="<?php _e('Save Changes',"sblogin"); ?>" /></p>
@@ -149,14 +149,14 @@ function widget_wp_sidebarlogin($args) {
149
  if (sizeof($links)>0)
150
  foreach ($links as $l) {
151
  $link = explode('|',$l);
152
- if (strtolower(trim($link[1]))=='true' && $level!=10) continue;
153
  echo '<li class="page_item">'.$link[0].'</li>';
154
  }
155
 
156
  $redir = get_option('sidebarlogin_logout_redirect');
157
  if (empty($redir)) $redir = wp_sidebarlogin_current_url('nologout');
158
 
159
- echo '<li class="page_item"><a href="'.wp_logout_url($redirect).'&redirect_to='.$redir.'">'.$thelogout.'</a></li></ul>';
160
 
161
  } else {
162
  // User is NOT logged in!!!
@@ -202,20 +202,23 @@ function widget_wp_sidebarlogin($args) {
202
  global $wpmu_version;
203
  if (empty($wpmu_version)) {
204
  echo '<ul class="sidebarlogin_otherlinks">';
205
- $isul= true;
206
  ?>
207
  <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register" rel="nofollow"><?php echo $theregister; ?></a></li>
208
  <?php
209
  } else {
210
  echo '<ul class="sidebarlogin_otherlinks">';
211
- $isul= true;
212
  ?>
213
  <li><a href="<?php bloginfo('wpurl'); ?>/wp-signup.php" rel="nofollow"><?php echo $theregister; ?></a></li>
214
  <?php
215
  }
216
  }
217
  if (get_option('sidebarlogin_forgotton_link')=='yes') :
218
- if ($isul== false) echo '<ul class="sidebarlogin_otherlinks">';
 
 
 
219
  ?>
220
  <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php echo $thepasslostfound; ?>" rel="nofollow"><?php echo $thelostpass; ?></a></li>
221
  <?php
@@ -246,7 +249,7 @@ function widget_wp_sidebarlogin_check() {
246
  if ( SITECOOKIEPATH != COOKIEPATH )
247
  setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
248
 
249
- if ($_POST['sidebarlogin_posted']) {
250
 
251
  global $myerrors;
252
  $myerrors = new WP_Error();
@@ -301,20 +304,82 @@ function widget_wp_sidebarlogin_check() {
301
 
302
  if ( !function_exists('wp_sidebarlogin_current_url') ) :
303
  function wp_sidebarlogin_current_url($url = '') {
304
- $pageURL = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
305
 
306
- if ($_SERVER["SERVER_PORT"] != "80") {
307
- $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
308
- } else {
309
- $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  }
 
311
 
312
  if ($url != "nologout") {
313
  $pageURL .='#login';
314
  }
315
- //————–added by mick
316
- if (!strstr(get_bloginfo('url'),'www.')) $pageURL = str_replace('www.','', $pageURL );
317
- //——————–
318
  return $pageURL;
319
  }
320
  endif;
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.2.2
7
  Author: Mike Jolley
8
  Author URI: http://blue-anvil.com
9
  */
11
  load_plugin_textdomain('sblogin','wp-content/plugins/sidebar-login/');
12
 
13
  function wp_sidebarlogin_menu() {
14
+ add_management_page(__('Sidebar Login','sblogin'), __('Sidebar Login','sblogin'), 9,'Sidebar Login', 'wp_sidebarlogin_admin');
15
  }
16
 
17
  if (!function_exists('wp_sidebarlogin_magic')) {
27
  }
28
  }
29
 
30
+ if (!function_exists('is_ssl')) :
31
  function is_ssl() {
32
  return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
33
  }
82
  </tr>
83
  <tr>
84
  <th scope="col"><?php _e('Logged in links',"sblogin"); ?>:</th>
85
+ <td><textarea name="sidebarlogin_logged_in_links" rows="3" cols="80" /><?php echo $sidebarlogin_logged_in_links; ?></textarea><br/><span class="setting-description"><?php _e('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. Default: <br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/"&gt;Dashboard&lt;/a&gt;<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php"&gt;Profile&lt;/a&gt;','sblogin'); ?></span></td>
86
  </tr>
87
  </table>
88
  <p class="submit"><input type="submit" value="<?php _e('Save Changes',"sblogin"); ?>" /></p>
149
  if (sizeof($links)>0)
150
  foreach ($links as $l) {
151
  $link = explode('|',$l);
152
+ if (isset($link[1]) && strtolower(trim($link[1]))=='true' && $level!=10) continue;
153
  echo '<li class="page_item">'.$link[0].'</li>';
154
  }
155
 
156
  $redir = get_option('sidebarlogin_logout_redirect');
157
  if (empty($redir)) $redir = wp_sidebarlogin_current_url('nologout');
158
 
159
+ echo '<li class="page_item"><a href="'.wp_logout_url($redir).'">'.$thelogout.'</a></li></ul>';
160
 
161
  } else {
162
  // User is NOT logged in!!!
202
  global $wpmu_version;
203
  if (empty($wpmu_version)) {
204
  echo '<ul class="sidebarlogin_otherlinks">';
205
+ $isul = true;
206
  ?>
207
  <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register" rel="nofollow"><?php echo $theregister; ?></a></li>
208
  <?php
209
  } else {
210
  echo '<ul class="sidebarlogin_otherlinks">';
211
+ $isul = true;
212
  ?>
213
  <li><a href="<?php bloginfo('wpurl'); ?>/wp-signup.php" rel="nofollow"><?php echo $theregister; ?></a></li>
214
  <?php
215
  }
216
  }
217
  if (get_option('sidebarlogin_forgotton_link')=='yes') :
218
+ if ($isul == false) {
219
+ echo '<ul class="sidebarlogin_otherlinks">';
220
+ $isul = true;
221
+ }
222
  ?>
223
  <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php echo $thepasslostfound; ?>" rel="nofollow"><?php echo $thelostpass; ?></a></li>
224
  <?php
249
  if ( SITECOOKIEPATH != COOKIEPATH )
250
  setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
251
 
252
+ if (isset($_POST['sidebarlogin_posted'])) {
253
 
254
  global $myerrors;
255
  $myerrors = new WP_Error();
304
 
305
  if ( !function_exists('wp_sidebarlogin_current_url') ) :
306
  function wp_sidebarlogin_current_url($url = '') {
 
307
 
308
+ global $wpdb;
309
+ $pageURL = "";
310
+ if (is_home() || is_front_page())
311
+ {
312
+ $pageURL = get_bloginfo('wpurl');
313
+ }
314
+ elseif (is_single() || is_page())
315
+ {
316
+ global $post;
317
+ $pageURL = get_permalink($post->ID);
318
+ }
319
+ elseif (is_category())
320
+ {
321
+ global $cat;
322
+ $pageURL = get_category_link($cat);
323
+ }
324
+ elseif (is_tag())
325
+ {
326
+ global $tag;
327
+ $tag_id = $wpdb->get_var("SELECT ".$wpdb->terms.".term_id FROM $wpdb->term_taxonomy
328
+ LEFT JOIN $wpdb->terms
329
+ ON (".$wpdb->term_taxonomy.".term_id = ".$wpdb->terms.".term_id)
330
+ WHERE ".$wpdb->terms.".slug = '$tag'
331
+ AND ".$wpdb->term_taxonomy.".taxonomy = 'post_tag' LIMIT 1");
332
+ $pageURL = get_tag_link($tag_id);
333
+ }
334
+ elseif (is_author())
335
+ {
336
+ global $author;
337
+ $pageURL = get_author_posts_url($author);
338
+ }
339
+ elseif (is_date())
340
+ {
341
+
342
+ global $year, $monthnum, $day;
343
+
344
+ if ($day)
345
+ {
346
+ $pageURL = get_day_link( $year, $month, $day);
347
+ }
348
+ elseif ($monthnum)
349
+ {
350
+ $pageURL = get_month_link( $year, $monthnum, $day);
351
+ }
352
+ elseif ($year)
353
+ {
354
+ $pageURL = get_year_link( $year, $monthnum, $day);
355
+ }
356
+
357
+ }
358
+ elseif (is_search())
359
+ {
360
+ $pageURL = get_bloginfo('wpurl');
361
+ if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/";
362
+ $pageURL .= '?s='.$_REQUEST['s'].'';
363
+ }
364
+ else {
365
+ $pageURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
366
+
367
+ if ($_SERVER["SERVER_PORT"] != "80") {
368
+ $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
369
+ } else {
370
+ $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
371
+ }
372
+
373
+ //————–added by mick
374
+ if (!strstr(get_bloginfo('url'),'www.')) $pageURL = str_replace('www.','', $pageURL );
375
+ //——————–
376
  }
377
+ if ($pageURL && !is_search()) if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/";
378
 
379
  if ($url != "nologout") {
380
  $pageURL .='#login';
381
  }
382
+
 
 
383
  return $pageURL;
384
  }
385
  endif;