Support » Themes and Templates » How to put a Login Box in Header

Viewing 10 replies - 1 through 10 (of 10 total)
  • <?php wp_register(); ?>
    <?php wp_loginout(); ?>

    Hey,

    Those are just the links, i want the forum.

    I viewed the Login page Source and found the code and modified it to look like this http://i34.tinypic.com/2m5o0f7.jpg

    The code :

    <form name="loginform" id="loginform" action="http://ripwrz.com/wp-login.php" method="post">
    
    Username <input value="Username" class="input" type="text" size="20" tabindex="10" name="log" id="user_login" onfocus="if (this.value == 'Username') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Username';}" /> <input name="rememberme" id="rememberme" value="forever" tabindex="90" type="checkbox"> Remember Me? <br />
    
    Password <input value="Password" class="input" type="password" size="20" tabindex="20" name="pwd" id="user_pass" onfocus="if (this.value == 'Password') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Password';}" />
    <input name="wp-submit" id="wp-submit" value="Log In" tabindex="100" type="submit">
    <input name="redirect_to" value="http://ripwrz.com/wp-admin/" type="hidden">
    <input name="testcookie" value="1" type="hidden">
    
    </form>

    I can login successfully from this panel, when i login it redirect me to Dashboard.

    Now.., i want to push the panel to the end right and make it hide when the user login. Even better, show the user info when he/she login.

    Thanks.

    Yayyy, awesome. i figured it out, how to push the panel to the right 😀
    Just edited the <div class=”headerright”> width to 305px from the Stylesheet (style.css)
    Now the panel look like that http://i37.tinypic.com/35ajc55.jpg

    I only need to know how to make the panel hide when the user login.

    Help please,
    Thanks.

    Still cant find out how to do that, i think it need some good coding skills to do it. its hard for me, i`m not a coder 😀

    Please help <33
    Thanks.

    I figured it out this one to.. while editing comments.php template. When a user login, this show up “Logged in as Username” Above the comment box.

    While changing some stuff on it i took a deep look into the code and found it 😀

    <?php if ( $user_ID ) : ?>
    The Info panel...
    <?php else : ?>
    The Login Panel
    <?php endif; ?>

    That`s the code that i was looking for. Imagination is more important than knowledge!)

    So.. Here it comes the code:

    <?php if ( $user_ID ) : ?>
    <?php wp_head();
    global $user_identity;
    ?>
    
    <p><b>Howdy</b>, <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>.  [<a href="<?php echo wp_logout_url(); ?>" title="Log out of this account">Log Out</a>]</p>
    
    <?php else : ?>
    
    <form name="loginform" id="loginform" action="<?php echo get_option('siteurl'); ?>/wp-login.php" method="post">
    
    	Username <input value="Username" class="input" type="text" size="20" tabindex="10" name="log" id="user_login" onfocus="if (this.value == 'Username') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Username';}" /> <input name="rememberme" id="rememberme" value="forever" tabindex="90" type="checkbox"> Remember Me? <br />
            Password <input value="Password" class="input" type="password" size="20" tabindex="20" name="pwd" id="user_pass" onfocus="if (this.value == 'Password') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Password';}" />
    		<input name="wp-submit" id="wp-submit" value="Log In" tabindex="100" type="submit">
    		<input name="redirect_to" value="<?php echo get_option('siteurl'); ?>/wp-admin/" type="hidden">
    		<input name="testcookie" value="1" type="hidden">
    
    </form>
    
    <?php endif; ?>

    Hope you like it 🙂

    Credit goes to RIPWRZ.com

    Thanks man i edited your code and i got a good result i think
    Added it to the end of the header.php

    <div align="right">	
    
    <form name="loginform" id="loginform" action="http://xxx.com/wp-login.php" method="post">
    
    Username <input value="Username" class="input" type="text" size="20" tabindex="10" name="log" id="user_login" onfocus="if (this.value == 'Username') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Username';}" /> <input name="rememberme" id="rememberme" value="forever" tabindex="90" type="checkbox"> Remember Me? <br />
    
    Password <input value="Password" class="input" type="password" size="20" tabindex="20" name="pwd" id="user_pass" onfocus="if (this.value == 'Password') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Password';}" />
    <input name="wp-submit" id="wp-submit" value="Log In" tabindex="100" type="submit">
    <input name="redirect_to" value="http://xxx.com/wp-admin/" type="hidden">
    <input name="testcookie" value="1" type="hidden">
    
    </form>
    </div>

    Actually it doesn’t work right for me im gonna look for another solution
    Unfortunately it won’t let me login

    Ah it’s working

    Hey sounds, The code you edited looks great for me, but i can’t login either.
    Did you find a way to fix it?
    Thanks,
    -Braniel

    Moderator t-p

    (@t-p)

    Hello guys,

    review this WP Snippet:

    Login / Logout link

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to put a Login Box in Header’ is closed to new replies.