'; _e('

Changes saved

',"sblogin"); echo ''; } // Get options $sidebarlogin_login_redirect = get_option('sidebarlogin_login_redirect'); $sidebarlogin_logout_redirect = get_option('sidebarlogin_logout_redirect'); $sidebarlogin_register_link = get_option('sidebarlogin_register_link'); $sidebarlogin_forgotton_link = get_option('sidebarlogin_forgotton_link'); $sidebarlogin_logged_in_links = get_option('sidebarlogin_logged_in_links'); ?>


:
:
:
:
:
|true after a link to only show it to admin users. If you add a further |USER LEVEL the link will only be shown to users with levels equal to or greater than those defined. See http://codex.wordpress.org/Roles_and_Capabilities for more info on roles and Capabilities.
You can also type %USERNAME% which will be replaced by the user's username. Default:",'sblogin'); echo '
<a href="'.get_bloginfo('wpurl').'/wp-admin/">Dashboard</a>
<a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php">Profile</a>'; ?>

" />

&after_title=''); suggested by dev.xiligroup.com */ function sidebarlogin($myargs = '') { if (is_array($myargs)) $args = &$myargs; else parse_str($myargs, $args); $defaults = array('before_widget'=>'','after_widget'=>'', 'before_title'=>'

','after_title'=>'

' ); $args = array_merge($defaults, $args); widget_wp_sidebarlogin($args); } function widget_wp_sidebarlogin($args) { global $user_ID, $current_user; /* To add more extend i.e when terms came from themes - suggested by dev.xiligroup.com */ $defaults = array( 'thelogin'=>__('Login','sblogin'), 'thewelcome'=>__("Welcome",'sblogin'), 'theusername'=>__('Username:','sblogin'), 'thepassword'=>__('Password:','sblogin'), 'theremember'=>__('Remember me','sblogin'), 'theregister'=>__('Register','sblogin'), 'thepasslostandfound'=>__('Password Lost and Found','sblogin'), 'thelostpass'=> __('Lost your password?','sblogin'), 'thelogout'=> __('Logout','sblogin') ); $args = array_merge($defaults, $args); extract($args); get_currentuserinfo(); if ($user_ID != '') { // User is logged in global $current_user; get_currentuserinfo(); echo $before_widget . $before_title .$thewelcome.' '.ucwords($current_user->display_name). $after_title; echo '
'.get_avatar($user_ID, $size = '38').'
'; echo ''; } else { // User is NOT logged in!!! echo $before_widget . $before_title .''. $thelogin .'' . $after_title; // Show any errors global $myerrors; $wp_error = new WP_Error(); if ( !empty($myerrors) && is_wp_error($myerrors) ) { $wp_error = $myerrors; } /* Cookies not supported error handling */ if ( isset($_GET['_login']) && empty($_COOKIE[TEST_COOKIE]) ) $wp_error->add('test_cookie', __("ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.")); if ( $wp_error->get_error_code() ) { $errors = ''; $messages = ''; foreach ( $wp_error->get_error_codes() as $code ) { $severity = $wp_error->get_error_data($code); foreach ( $wp_error->get_error_messages($code) as $error ) { if ( 'message' == $severity ) $messages .= ' ' . $error . "
\n"; else $errors .= ' ' . $error . "
\n"; } } if ( !empty($errors) ) echo '
' . apply_filters('login_errors', $errors) . "
\n"; if ( !empty($messages) ) echo '

' . apply_filters('login_messages', $messages) . "

\n"; } // login form echo '
'; ?>



'; //openid_wp_login_form(); echo '
'; echo '

'; } ?>

'; $isul = true; ?>
  • '; $isul = true; ?>
  • '; $isul = true; } ?>
  • '; } // echo widget closing tag echo $after_widget; } if (class_exists('WP_Widget')) { function widget_wp_sidebarlogin_init() { // New Style widgets class SidebarLoginMultiWidget extends WP_Widget { function SidebarLoginMultiWidget() { $widget_ops = array('description' => __( 'Sidebar Login.','sblogin') ); $this->WP_Widget('wp_sidebarlogin', __('Sidebar Login','sblogin'), $widget_ops); } function widget($args, $instance) { widget_wp_sidebarlogin($args); } } register_widget('SidebarLoginMultiWidget'); } add_action('init', 'widget_wp_sidebarlogin_init', 1); } else { // Legacy Widgets function widget_wp_sidebarlogin_init() { if ( !function_exists('register_sidebar_widget') ) return; // Register widget for use register_sidebar_widget(array('Sidebar Login', 'widgets'), 'widget_wp_sidebarlogin'); } add_action('widgets_init', 'widget_wp_sidebarlogin_init'); } function widget_wp_sidebarlogin_check() { // Add options - they may not exist add_option('sidebarlogin_login_redirect','','no'); add_option('sidebarlogin_logout_redirect','','no'); add_option('sidebarlogin_register_link','yes','no'); add_option('sidebarlogin_forgotton_link','yes','no'); add_option('sidebarlogin_logged_in_links', "".__('Dashboard','sblogin')."\n".__('Profile','sblogin')."",'no'); // Set a cookie now to see if they are supported by the browser. setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); if ( SITECOOKIEPATH != COOKIEPATH ) setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN); if (isset($_POST['sidebarlogin_posted'])) { global $myerrors; $myerrors = new WP_Error(); nocache_headers(); $secure_cookie = ''; $redir = trim(stripslashes(get_option('sidebarlogin_login_redirect'))); if ($redir && !empty($redir)) $redirect_to = $redir; else $redirect_to = wp_sidebarlogin_current_url('nologout'); // If the user wants ssl but the session is not ssl, force a secure cookie. if ( !empty($_POST['log']) && !force_ssl_admin() ) { $user_name = sanitize_user(stripslashes($_POST['log'])); if ( $user = get_userdatabylogin($user_name) ) { if ( get_user_option('use_ssl', $user->ID) ) { $secure_cookie = true; force_ssl_admin(true); } } } if ( $redirect_to ) { // Redirect to https if user wants ssl if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); } if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) ) $secure_cookie = false; $user = wp_signon('', $secure_cookie); $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $redirect_to ) ? $redirect_to : '', $user); if ( $user && !is_wp_error($user) ) { wp_safe_redirect($redirect_to); exit; //} } elseif ($user) { $myerrors = $user; if ( empty($_POST['log']) && empty($_POST['pwd']) ) { $myerrors->add('empty_username', __('ERROR: Please enter a username & password.', 'sblogin')); } } } } if ( !function_exists('wp_sidebarlogin_current_url') ) : function wp_sidebarlogin_current_url($url = '') { global $wpdb, $post, $cat, $tag, $author, $year, $monthnum, $day, $wp_query; $pageURL = ""; if ( is_home() && $wp_query->is_posts_page==1) { $pageURL = get_permalink(get_option('page_for_posts')); } elseif (is_home() || is_front_page()) { $pageURL = get_bloginfo('url'); } elseif (is_single() || is_page()) { $pageURL = get_permalink($wp_query->post->ID); } elseif (is_category()) { $pageURL = get_category_link($cat); } elseif (is_tag()) { $tag_id = $wpdb->get_var("SELECT ".$wpdb->terms.".term_id FROM $wpdb->term_taxonomy LEFT JOIN $wpdb->terms ON (".$wpdb->term_taxonomy.".term_id = ".$wpdb->terms.".term_id) WHERE ".$wpdb->terms.".slug = '$tag' AND ".$wpdb->term_taxonomy.".taxonomy = 'post_tag' LIMIT 1"); $pageURL = get_tag_link($tag_id); } elseif (is_author()) { $pageURL = get_author_posts_url($author); } elseif (is_date()) { if ($day) { $pageURL = get_day_link( $year, $month, $day); } elseif ($monthnum) { $pageURL = get_month_link( $year, $monthnum, $day); } elseif ($year) { $pageURL = get_year_link( $year, $monthnum, $day); } } elseif (is_search()) { $pageURL = get_bloginfo('wpurl'); if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/"; $pageURL .= '?s='.stripslashes(strip_tags($_REQUEST['s'])).''; } if (!$pageURL || $pageURL=="" || !is_string($pageURL)) { $pageURL = ""; $pageURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } //————–added by mick if (!strstr(get_bloginfo('url'),'www.')) $pageURL = str_replace('www.','', $pageURL ); //——————– } if ($pageURL && !is_search()) if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/"; if ($url != "nologout") { if (!strpos($pageURL,'_login=')) { $rand_string = md5(uniqid(rand(), true)); $rand_string = substr($rand_string, 0, 10); if (strpos($pageURL,'?')) if (substr($pageURL,-1)=='/') $pageURL = substr($pageURL,0,-1); $rand = (!strpos($pageURL,'?')) ? '?_login='.$rand_string : '&_login='.$rand_string; $pageURL .= $rand; } } if ( force_ssl_login() || force_ssl_admin() ) { $pageURL = str_replace( 'http://', 'https://', $pageURL ); } return $pageURL; } endif; function wp_sidebarlogin_css() { $myStyleFile = WP_PLUGIN_URL . '/sidebar-login/style.css'; wp_register_style('wp_sidebarlogin_css_styles', $myStyleFile); wp_enqueue_style( 'wp_sidebarlogin_css_styles'); } // Run code and init add_action('wp_print_styles', 'wp_sidebarlogin_css'); add_action('init', 'widget_wp_sidebarlogin_check',0); add_action('admin_menu', 'wp_sidebarlogin_menu'); ?>