WordPress.org

Support

Support » How-To and Troubleshooting » Login-forms in sidebar?

Login-forms in sidebar?

  • Hi there,

    So – I want to put two login-forms (input fields) in my sidebar instead of just have a “Login”-link at the frontpage. A “Username” and a “Password”-field.

    I just can’t get this thing to work.

    Does anyone know if there is some kind of plugin to fix my situation? Or just a code-snippet to insert in sidebar.php ?

    Thank you so much in advance.

    Best regards,

    Testrup

Viewing 3 replies - 1 through 3 (of 3 total)
  • This post may answer your question. A widgetized version is also available now.

    This chunk of code should also work. Put it in your sidebar somewhere:

    <?php if (isset($user_level) && $user_level > 0): ?>
    <div>
    <ul>
    <li><a href="<?php bloginfo('wpurl'); ?>/admin/" title="admin">Site Admin</a></li>
    <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=logout&amp;redirect_to=<?php echo $_SERVER['REQUEST_URI']; ?>" title="logout">Logout (<?php echo $user_nickname; ?>)</a></li>
    </ul>
    </div>
    <?php else: ?>
    <form name="loginform" id="loginform" action="<?php echo get_settings('siteurl'); ?>/wp-login.php" method="post">
    <label><?php _e('Login') ?>:<input type="text" name="log" id="log" value="" size="20" tabindex="7" /></label>
    <label><?php _e('Password') ?>: <input type="password" name="pwd" id="pwd" value="" size="20" tabindex="8" /></label>
    <input type="submit" name="submit" value="<?php _e('Login'); ?> &raquo;" tabindex="9" style="margin-top: 0.5em" />
    <?php wp_register(); ?>
    <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
    </form>
    <?php endif; ?>

    Why do you start your post with “So”? It isn’t necessary. We weren’t in the middle of a conversation where you were explaining something that came before.

    Dude.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Login-forms in sidebar?’ is closed to new replies.
Skip to toolbar