WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to put a Login Box in Header (11 posts)

  1. Family Guy
    Member
    Posted 4 years ago #

    Hello,

    I wanna add a login box in my Header to make it look like vbulltin forum http://i38.tinypic.com/b5r24z.jpg

    What is the code that i should put it in header.php to make it look like that, i know where i gonna put it but i don`t know the code.

    Help please,
    Thanks.

  2. Samuel B
    moderator
    Posted 4 years ago #

    <?php wp_register(); ?>
    <?php wp_loginout(); ?>
  3. Family Guy
    Member
    Posted 4 years ago #

    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.

  4. Family Guy
    Member
    Posted 4 years ago #

    Yayyy, awesome. i figured it out, how to push the panel to the right :D
    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.

  5. Family Guy
    Member
    Posted 4 years ago #

    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 :D

    Please help <33
    Thanks.

  6. Family Guy
    Member
    Posted 4 years ago #

    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 :D

    <?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

  7. sounds
    Member
    Posted 3 years ago #

    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>
  8. sounds
    Member
    Posted 3 years ago #

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

  9. sounds
    Member
    Posted 3 years ago #

    Ah it's working

  10. Braniel
    Member
    Posted 3 years ago #

    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

  11. Tara
    Member
    Posted 3 years ago #

    Hello guys,

    review this WP Snippet:

    http://wp-snippets.com/login-logout-link/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags