BREBPLogin

The Bootstrap Responsive eCommerce BREBPLogin class.

Defined (1)

The class is defined in the following location(s).

/admin/BPLoginWidget.class.php  
  1. class BREBPLogin extends TCPParentWidget { 
  2.  
  3. function BREBPLogin() { 
  4. parent::__construct( 'bre_bp_login', __( 'Allow to create a buddyPress login', 'bre' ), 'TCP BP Login' ); 
  5.  
  6. function widget( $args, $instance ) { 
  7. if ( ! parent::widget( $args, $instance ) ) return; 
  8. extract( $args ); 
  9. echo $before_widget; 
  10. $title = apply_filters( 'widget_title', isset( $instance['title'] ) ? $instance['title'] : false ); 
  11. if ( $title ) echo $before_title, $title, $after_title; 
  12. ?> 
  13.  
  14. <?php if ( is_user_logged_in() ) : ?> 
  15.  
  16. <?php do_action( 'bp_before_sidebar_me' ); ?> 
  17.  
  18. <div id="sidebar-me" class="widget clearfix"> 
  19. <h3 class="widget-title">Welcome <?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></h3> 
  20. <a href="<?php echo bp_loggedin_user_domain(); ?>"> 
  21. <?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ); ?> 
  22. </a> 
  23.  
  24. <a class="button logout" href="<?php echo wp_logout_url( wp_guess_url() ); ?>"><?php _e( 'Log Out', 'buddypress' ); ?></a> 
  25.  
  26. <?php do_action( 'bp_sidebar_me' ); ?> 
  27. </div> 
  28.  
  29. <?php do_action( 'bp_after_sidebar_me' ); ?> 
  30.  
  31. <?php if ( bp_is_active( 'messages' ) ) : ?> 
  32. <?php bp_message_get_notices(); /** Site wide notices to all users */ ?> 
  33. <?php endif; ?> 
  34.  
  35. <?php else : ?> 
  36.  
  37. <?php do_action( 'bp_before_sidebar_login_form' ); ?> 
  38.  
  39. <?php if ( bp_get_signup_allowed() ) : ?> 
  40.  
  41. <p id="login-text"> 
  42.  
  43. <?php printf( __( '<a href="%s" title="Create account" class="btn btn-primary btn-large">Create account to join community</a>', 'buddypress' ), bp_get_signup_page() ); ?> 
  44.  
  45. </p> 
  46.  
  47. <?php endif; ?> 
  48.  
  49. <form name="login-form" id="sidebar-login-form" class="standard-form widget" action="<?php echo site_url( 'wp-login.php', 'login_post' ); ?>" method="post"> 
  50. <h3 class="widget-title"><?php _e( 'Login', 'bre-bootstrap-ecommerce' ); ?></h3> 
  51. <label><?php _e( 'Username', 'buddypress' ); ?><br /> 
  52. <input type="text" name="log" id="sidebar-user-login" class="input" value="<?php if ( isset( $user_login) ) echo esc_attr(stripslashes($user_login)); ?>" tabindex="97" /></label> 
  53.  
  54. <label><?php _e( 'Password', 'buddypress' ); ?><br /> 
  55. <input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" tabindex="98" /></label> 
  56.  
  57. <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" tabindex="99" /> <?php _e( 'Remember Me', 'buddypress' ); ?></label></p> 
  58.  
  59. <?php do_action( 'bp_sidebar_login_form' ); ?> 
  60. <input type="submit" name="wp-submit" id="sidebar-wp-submit" value="<?php _e( 'Log In', 'buddypress' ); ?>" tabindex="100" /> 
  61. <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI'];?>" /> 
  62. <input type="hidden" name="testcookie" value="1" /> 
  63. </form> 
  64.  
  65. <?php do_action( 'bp_after_sidebar_login_form' ); ?> 
  66.  
  67. <?php endif; ?> 
  68.  
  69. <?php 
  70. echo $after_widget; 
  71.  
  72.  
  73. function update( $new_instance, $old_instance ) { 
  74. $instance = parent::update( $new_instance, $old_instance ); 
  75. return $instance; 
  76.  
  77. function form( $instance ) { 
  78. parent::form( $instance, __( 'Login', 'tcp' ) );