Re: Login moved from sidebar to admin bar
If you’re using a child theme of the default BP theme, use this tidbit to remove the login widget from the sidebar:
https://buddypress.org/forums/topic/how-to-remove-login-sidebar-from-bp-12-default-theme#post-46264
To add the login form to the BuddyBar, you’ll need to create a function that outputs the login form and then you’ll need to hook it to the BuddyBar.
Here’s some sample code that you can add to your theme’s functions.php:
function my_login_bar() {
// basically a copy of the login form from the BP sidebar
?>
<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login' ) ?>" method="post">
<label><?php _e( 'Username', 'buddypress' ) ?><br />
<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" /></label>
<label><?php _e( 'Password', 'buddypress' ) ?><br />
<input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" /></label>
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" /> <?php _e( 'Remember Me', 'buddypress' ) ?></label></p>
<input type="submit" name="wp-submit" id="sidebar-wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
<input type="hidden" name="testcookie" value="1" />
</form>
<?php
}
// the magic that hooks your my_login_bar() function to the BuddyBar
add_action( 'bp_adminbar_menus', 'my_login_bar', 2);
Keep in mind, you’ll need to style the form to make it look nice in the admin bar, but that should get you started.
More info in modifying the BuddyBar can be found here:
https://codex.buddypress.org/how-to-guides/modifying-the-buddypress-admin-bar/