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;

    /* To add more extend i.e when terms came from themes - suggested by dev.xiligroup.com */
    $defaults = array(
        'theremember'=>__('Remember me','sblogin'),
        'thepasslostandfound'=>__('Password Lost and Found','sblogin'),
        'thelostpass'=> __('Lost your password?','sblogin'),
        'thelogout'=> __('Logout','sblogin')

    $args = array_merge($defaults, $args);


    if ($user_ID != '') {
        // User is logged in

        global $current_user;

        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>';



2 Answers 2





  • Hey, thanks but it doesn't work...
    – Julia
    Jun 29, 2011 at 15:04

I Don't know about your codings.but i have another one suggestion.just try to install plugin and welcome your website users. Ajax Login/Register . this plugin works fine.i think it'll help's you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.