Sidebar login: How do I get the username to show after “Welcome”?

Yo,
Sidebar login used to say “Welcome %username%” without a problem until I applied __() to the “Welcome” string. Since then the welcome message just says “Welcome” (in all languages) but i can’t bring that username back in there to save my life.
What am I doing wrong? Here’s how it looks:

function widget_wp_sidebarlogin($args) {
global $user_ID, $current_user;

Read More
    /* To add more extend i.e when terms came from themes - suggested by dev.xiligroup.com */
    $defaults = array(
        'thelogin'=>__('Login'),
        'thewelcome'=>__('Welcome'),
        '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();

        if (empty($thewelcome)) $thewelcome = str_replace('%username%',ucwords($current_user->display_name),get_option('sidebarlogin_welcome_heading'));

        echo $before_widget . $before_title . __("Welcome") . $user_info->user_login . $after_title;

        if (get_option('sidebar_login_avatar')=='yes') echo '<div class="avatar_container">'.get_avatar($user_ID, $size = '38').'</div>';

        echo '<ul class="pagenav">';

        if(isset($current_user->user_level) && $current_user->user_level) $level = $current_user->user_level;

        $links = do_shortcode(trim(get_option('sidebarlogin_logged_in_links')));

        $links = explode("n", $links);
        if (sizeof($links)>0)
        foreach ($links as $l) {
            $l = trim($l);
            if (!empty($l)) {
                $link = explode('|',$l);
                if (isset($link[1])) {
                    $cap = strtolower(trim($link[1]));
                    if ($cap=='true') {
                        if (!current_user_can( 'manage_options' )) continue;
                    } else {
                        if (!current_user_can( $cap )) continue;
                    }
                }
                // Parse %USERNAME%
                $link[0] = str_replace('%USERNAME%',$current_user->user_login,$link[0]);
                $link[0] = str_replace('%username%',$current_user->user_login,$link[0]);
                // Parse %USERID%
                $link[0] = str_replace('%USERID%',$current_user->ID,$link[0]);
                $link[0] = str_replace('%userid%',$current_user->ID,$link[0]);
                echo '<li class="page_item">'.$link[0].'</li>';
            }

    }

Gracias…

Related posts

Leave a Reply

2 comments