BBP_Login_Widget::widget( mixed $args = array(), array $instance = array() )
Displays the output, the login form
Description
Parameters
- $args
-
(Optional) Arguments
Default value: array()
- $instance
-
(Optional) Instance
Default value: array()
Source
File: bp-forums/common/widgets.php
public function widget( $args = array(), $instance = array() ) { // Get widget settings $settings = $this->parse_settings( $instance ); // Typical WordPress filter $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); // Forums filters $settings['title'] = apply_filters( 'bbp_login_widget_title', $settings['title'], $instance, $this->id_base ); $settings['register'] = apply_filters( 'bbp_login_widget_register', $settings['register'], $instance, $this->id_base ); $settings['lostpass'] = apply_filters( 'bbp_login_widget_lostpass', $settings['lostpass'], $instance, $this->id_base ); echo $args['before_widget']; if ( !empty( $settings['title'] ) ) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } if ( !is_user_logged_in() ) : ?> <form method="post" action="<?php bbp_wp_login_action( array( 'context' => 'login_post' ) ); ?>" class="bbp-login-form"> <fieldset> <legend><?php _e( 'Log In', 'buddyboss' ); ?></legend> <div class="bbp-username"> <label for="user_login"><?php _e( 'Username', 'buddyboss' ); ?>: </label> <input type="text" name="log" value="<?php bbp_sanitize_val( 'user_login', 'text' ); ?>" size="20" id="user_login" tabindex="<?php bbp_tab_index(); ?>" /> </div> <div class="bbp-password"> <label for="user_pass"><?php _e( 'Password', 'buddyboss' ); ?>: </label> <input type="password" name="pwd" value="<?php bbp_sanitize_val( 'user_pass', 'password' ); ?>" size="20" id="user_pass" tabindex="<?php bbp_tab_index(); ?>" /> </div> <div class="bbp-remember-me"> <input type="checkbox" name="rememberme" value="forever" <?php checked( bbp_get_sanitize_val( 'rememberme', 'checkbox' ), true, true ); ?> id="rememberme" tabindex="<?php bbp_tab_index(); ?>" /> <label for="rememberme"><?php _e( 'Remember Me', 'buddyboss' ); ?></label> </div> <div class="bbp-submit-wrapper"> <?php do_action( 'login_form' ); ?> <button type="submit" name="user-submit" id="user-submit" tabindex="<?php bbp_tab_index(); ?>" class="button submit user-submit"><?php _e( 'Log In', 'buddyboss' ); ?></button> <?php bbp_user_login_fields(); ?> </div> <?php if ( !empty( $settings['register'] ) || !empty( $settings['lostpass'] ) ) : ?> <div class="bbp-login-links"> <?php if ( !empty( $settings['register'] ) ) : ?> <a href="<?php echo esc_url( $settings['register'] ); ?>" title="<?php esc_attr_e( 'Register', 'buddyboss' ); ?>" class="bbp-register-link"><?php _e( 'Register', 'buddyboss' ); ?></a> <?php endif; ?> <?php if ( !empty( $settings['lostpass'] ) ) : ?> <a href="<?php echo esc_url( $settings['lostpass'] ); ?>" title="<?php esc_attr_e( 'Lost Password', 'buddyboss' ); ?>" class="bbp-lostpass-link"><?php _e( 'Lost Password', 'buddyboss' ); ?></a> <?php endif; ?> </div> <?php endif; ?> </fieldset> </form> <?php else : ?> <div class="bbp-logged-in"> <a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>" class="submit user-submit"><?php echo get_avatar( bbp_get_current_user_id(), '40' ); ?></a> <h4><?php bbp_user_profile_link( bbp_get_current_user_id() ); ?></h4> <?php bbp_logout_link(); ?> </div> <?php endif; echo $args['after_widget']; }
Changelog
Version | Description |
---|---|
bbPress (r2827) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.