Sidebar Login - Version 2.2.14

Version Description

  • Further revised the |true / |user_capability code - only need to use one or the other now.
Download this release

Release Info

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

Code changes from version 2.2.13 to 2.2.14

Files changed (2) hide show
  1. readme.txt +4 -1
  2. sidebar-login.php +16 -16
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.8
6
  Tested up to: 3.0
7
- Stable tag: 2.2.13
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
 
@@ -66,6 +66,9 @@ You will find a config page in tools/settings > Sidebar Login. Here you can set
66
 
67
  == Changelog ==
68
 
 
 
 
69
  = 2.2.13 =
70
  * Updated translations
71
  * Support for https and style.css
4
  Tags: login, sidebar, widget, sidebar login, meta, form, register
5
  Requires at least: 2.8
6
  Tested up to: 3.0
7
+ Stable tag: 2.2.14
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
 
66
 
67
  == Changelog ==
68
 
69
+ = 2.2.14 =
70
+ * Further revised the |true / |user_capability code - only need to use one or the other now.
71
+
72
  = 2.2.13 =
73
  * Updated translations
74
  * Support for https and style.css
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.13
7
  Author: Mike Jolley
8
  Author URI: http://blue-anvil.com
9
  */
@@ -94,7 +94,7 @@ function wp_sidebarlogin_admin(){
94
  </tr>
95
  <tr>
96
  <th scope="col"><?php _e('Logged in links',"sblogin"); ?>:</th>
97
- <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. If you add a further <code>|USER CAPABILITY</code> the link will only be shown to users with that capability. See <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_blank'>http://codex.wordpress.org/Roles_and_Capabilities</a> for more info on roles and Capabilities.<br/> You can also type <code>%USERNAME%</code> and <code>%USERID%</code> which will be replaced by the user info. Default:",'sblogin');
98
  echo '<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/"&gt;'. __('Dashboard', 'sblogin') .'&lt;/a&gt;<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php"&gt;'. __('Profile', 'sblogin') .'&lt;/a&gt;'; ?></span></td>
99
  </tr>
100
  <tr>
@@ -177,21 +177,21 @@ function widget_wp_sidebarlogin($args) {
177
  $l = trim($l);
178
  if (!empty($l)) {
179
  $link = explode('|',$l);
180
- if (isset($link[2])) {
181
- $cap = trim($link[2]);
182
- if (!current_user_can( $cap )) continue;
183
- }
184
- // Admin check
185
- if (isset($link[1]) && strtolower(trim($link[1]))=='true' && !current_user_can('manage_options') ) continue;
186
- else {
187
- // Parse %USERNAME%
188
- $link[0] = str_replace('%USERNAME%',$current_user->user_login,$link[0]);
189
- $link[0] = str_replace('%username%',$current_user->user_login,$link[0]);
190
- // Parse %USERID%
191
- $link[0] = str_replace('%USERID%',$current_user->ID,$link[0]);
192
- $link[0] = str_replace('%userid%',$current_user->ID,$link[0]);
193
- echo '<li class="page_item">'.$link[0].'</li>';
194
  }
 
 
 
 
 
 
 
195
  }
196
  }
197
 
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.14
7
  Author: Mike Jolley
8
  Author URI: http://blue-anvil.com
9
  */
94
  </tr>
95
  <tr>
96
  <th scope="col"><?php _e('Logged in links',"sblogin"); ?>:</th>
97
+ <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 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'>http://codex.wordpress.org/Roles_and_Capabilities</a> for more info on roles and Capabilities.<br/> You can also type <code>%USERNAME%</code> and <code>%USERID%</code> which will be replaced by the user info. Default:",'sblogin');
98
  echo '<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/"&gt;'. __('Dashboard', 'sblogin') .'&lt;/a&gt;<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php"&gt;'. __('Profile', 'sblogin') .'&lt;/a&gt;'; ?></span></td>
99
  </tr>
100
  <tr>
177
  $l = trim($l);
178
  if (!empty($l)) {
179
  $link = explode('|',$l);
180
+ if (isset($link[1])) {
181
+ $cap = strtolower(trim($link[1]));
182
+ if ($cap=='true') {
183
+ if (!current_user_can( 'manage_options' )) continue;
184
+ } else {
185
+ if (!current_user_can( $cap )) continue;
186
+ }
 
 
 
 
 
 
 
187
  }
188
+ // Parse %USERNAME%
189
+ $link[0] = str_replace('%USERNAME%',$current_user->user_login,$link[0]);
190
+ $link[0] = str_replace('%username%',$current_user->user_login,$link[0]);
191
+ // Parse %USERID%
192
+ $link[0] = str_replace('%USERID%',$current_user->ID,$link[0]);
193
+ $link[0] = str_replace('%userid%',$current_user->ID,$link[0]);
194
+ echo '<li class="page_item">'.$link[0].'</li>';
195
  }
196
  }
197