Studio Theme - Log-In in Sidebar

Hello, I want to make it easier for users to log-in. Hence I want to put a log-in form in the sidebar and on the home-page in one of the three feature panels for the studio theme. How would I do that? I got the following code from the panel php file from the library section

Thanks

<!-- start buddypress login section -->
<?php if ( is_user_logged_in() ) : ?>
<?php do_action( 'bp_before_sidebar_me' ) ?>
<div id="sidebar-me">
<?php bp_loggedin_user_avatar( 'type=thumb&width=100&height=100' ) ?>

<div class="spacer"></div>
<h4> <?php _e( 'Hi', TEMPLATE_DOMAIN ) ?>"> <?php bp_loggedinuser_link() ?></h4>
<div class="spacer"></div>

"><?php _e( 'Log Out', 'buddypress' ) ?>
<div class="clear"></div>
<?php do_action( 'bp_sidebar_me' ) ?>
</div>

<?php do_action( 'bp_after_sidebar_me' ) ?>
<?php else : ?>
<?php do_action( 'bp_before_sidebar_login_form' ) ?>

<div class="label-box"> <h3><?php _e( 'user Login', TEMPLATE_DOMAIN ) ?></h3>
<p id="login-text">
<?php _e( 'To start connecting please log in first.', 'buddypress' ) ?>
<?php if ( bp_get_signup_allowed() ) : ?>
<?php printf( __( ' You can also create an account.', 'buddypress' ), site_url( BP_REGISTER_SLUG . '/' ) ) ?>
<?php endif; ?>
</p>
</div>
<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login_post' ) ?>" method="post">
<label><?php _e( 'Username', 'buddypress' ) ?>
<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" /></label>

<label><?php _e( 'Password', 'buddypress' ) ?>
<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>

<?php do_action( 'bp_sidebar_login_form' ) ?>
<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 do_action( 'bp_after_sidebar_login_form' ) ?>
<?php endif; ?>
<div class="spacer"></div>
<?php if ( bp_search_form_enabled() ) : ?>

<form action="<?php echo bp_search_form_action() ?>" method="post" id="search-form">
<input type="text" id="search-terms" name="search-terms" value=""/>
<?php echo bp_search_form_type_select() ?>
<div class="spacer"></div>
<input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
<?php wp_nonce_field( 'bp_search_form' ) ?>
</form><!-- #search-form -->

<?php endif; ?>

<?php do_action( 'bp_search_login_bar' ) ?>

<!-- end buddypress login section -->

  • Tammie

    @amahesh: As said in previous thread if you want to have a login you just take the form part of that code.

    <?php do_action( 'bp_before_sidebar_login_form' ) ?>
    
    						<div class="label-box">	<h3><?php _e( 'user Login', TEMPLATE_DOMAIN ) ?></h3>
    								<p id="login-text">
    									<?php _e( 'To start connecting please log in first.', 'buddypress' ) ?>
    									<?php if ( bp_get_signup_allowed() ) : ?>
    										<?php printf( __( ' You can also <a href="%s" title="Create an account">create an account</a>.', 'buddypress' ), site_url( BP_REGISTER_SLUG . '/' ) ) ?>
    									<?php endif; ?>
    								</p>
    						</div>
    							<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login_post' ) ?>" method="post">
    								<label><?php _e( 'Username', 'buddypress' ) ?><br />
    											<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" tabindex="97" /></label>
    
    								<label><?php _e( 'Password', 'buddypress' ) ?><br />
    								<input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" tabindex="98" /></label>
    
    								<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" tabindex="99" /> <?php _e( 'Remember Me', 'buddypress' ) ?></label></p>
    
    								<?php do_action( 'bp_sidebar_login_form' ) ?>
    								<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 do_action( 'bp_after_sidebar_login_form' ) ?>
    		<?php endif; ?>

    However not tested effect of 2 forms with same values. That's up to you to see and you should change any id to a class in CSS to pass validation.

  • Tammie

    If possible it's a lot easier to deal with a user per thread so @kapildhingra I would advise you start a new thread. What may seem a similar issue may not be.

    That said the sign up on studio requires turning 'on' theme options for that. Please look under the theme options and make sure you have sign up on and filled out. No need to paste in other code just turn on the feature in Studio.

    You also need to make sure you have 'on' register users so that people can register on your site.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.