<?php 
function widget_login() { ?>
        <?php global $user_ID, $user_identity, $user_level ?>
        <?php if ( $user_ID ) : ?>
        <h3><?php _e('Control panel', "moderno"); ?></h3>
        <ul>
            <li><?php _e('Logged in as: ', "moderno"); ?><strong><?php echo $user_identity; ?></strong></li>
            <li><a href="<?php echo site_url() ?>/wp-admin/"><?php _e('Dashboard', "moderno"); ?></a></li>

            <?php if ( $user_level >= 1 ) : ?>
            <li><a href="<?php echo site_url() ?>/wp-admin/post-new.php"><?php _e('Write', "moderno"); ?></a></li>
            <?php endif // $user_level >= 1 ?>

            <li><a href="<?php echo site_url() ?>/wp-admin/profile.php"><?php _e('Profile', "moderno"); ?></a></li>
            <li><a href="<?php echo wp_logout_url() ?>&amp;redirect_to=<?php echo urlencode(curPageURL()); ?>"><?php _e('Log Out', "moderno"); ?></a></li>
        </ul>

        <?php else : ?>

        <h3><?php _e('User Login', "moderno"); ?></h3>
            <form action="<?php echo site_url() ?>/wp-login.php" method="post">
                <p>
                <label for="log"><?php _e('User', "moderno"); ?></label><br /><input type="text" name="log" id="log" value="<?php echo esc_html(stripslashes($user_login), 1) ?>" size="20" style="margin-bottom: 5px;" /><br />
                <label for="pwd"><?php _e('Password', "moderno"); ?></label><br /><input type="password" name="pwd" id="pwd" size="20" style="margin-bottom: 5px;" /><br />
                <input type="submit" name="submit" value="<?php _e('Send', "moderno"); ?>" class="button" />
                <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /><?php _e(' Remember me', "moderno"); ?></label><br />
                </p>
                <input type="hidden" name="redirect_to" value="<?php echo curPageURL(); ?>"/>
            </form>
        <ul>
            <?php if ( get_option('users_can_register') ) { ?><li><a href="<?php echo site_url() ?>/wp-register.php"><?php _e('Register', "moderno"); ?></a></li><?php } ?>
            <li><a href="<?php echo site_url() ?>/wp-login.php?action=lostpassword"><?php _e('Lost your password', "moderno"); ?></a></li>
        </ul>
        <?php endif // get_option('users_can_register') ?>
<?php
}

function widget_myLogin($args) {
	extract($args); 
	echo $before_widget;
	widget_login();
	echo $after_widget; 
}

wp_register_sidebar_widget( 'user_login', __('Mod - User Login', "moderno"), 'widget_myLogin', array('description' => __('User login and control panel', "moderno")) );

?>