• Knowledge Base
    • All Articles
    • BuddyBoss Platform
    • BuddyBoss Theme
    • BuddyBoss App
    • Integrations
    • Advanced Setup
    • Troubleshooting
    • Release Notes
      • BuddyBoss Platform
      • BuddyBoss Platform Pro
      • BuddyBoss Theme
      • BuddyBoss App
      • BuddyBoss App Plugin
      • Other Products
  • Developers
    • Developer Tutorials
      • Web Development
      • App Development
    • Code Reference
      • Functions
      • Hooks
      • Classes
      • Methods
      • Commands
      • App Codex
    • REST API
      • BuddyBoss Platform
      • BuddyBoss App
    • Font Cheatsheet
    • Github Project
  • Roadmap
  • Go to BuddyBoss
    Contact Support
    Filter
    • Knowledge Base
      • All Articles
      • BuddyBoss Platform
      • BuddyBoss Theme
      • BuddyBoss App
      • Integrations
      • Advanced Setup
      • Troubleshooting
      • Release Notes
        • BuddyBoss Platform
        • BuddyBoss Platform Pro
        • BuddyBoss Theme
        • BuddyBoss App
        • BuddyBoss App Plugin
        • Other Products
    • Developers
      • Developer Tutorials
        • Web Development
        • App Development
      • Code Reference
        • Functions
        • Hooks
        • Classes
        • Methods
        • Commands
        • App Codex
      • REST API
        • BuddyBoss Platform
        • BuddyBoss App
      • Font Cheatsheet
      • Github Project
    • Roadmap
    • Go to BuddyBoss
    Filter
    Filter

    Contents

    • Description
    • Parameters
    • Source
    • Changelog
    • Related
    Code Reference Classes BP_Core_Login_Widget BP_Core_Login_Widget::widget()

    BP_Core_Login_Widget::widget( array $args, array $instance )

    Display the login widget.

    Description

    See also

    • WP_Widget::widget(): for description of parameters.

    Parameters

    $args

    (array) (Required) Widget arguments.

    $instance

    (array) (Required) Widget settings, as saved by the user.

    Source

    File: bp-core/classes/class-bp-core-login-widget.php

    	public function widget( $args, $instance ) {
    		$title = isset( $instance['title'] ) ? $instance['title'] : '';
    
    		/**
    		 * Filters the title of the Login widget.
    		 *
    		 * @since BuddyPress 1.9.0
    		 * @since BuddyPress 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
    		 *
    		 * @param string $title    The widget title.
    		 * @param array  $instance The settings for the particular instance of the widget.
    		 * @param string $id_base  Root ID for all widgets of this type.
    		 */
    		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    
    		echo $args['before_widget'];
    
    		echo $args['before_title'] . esc_html( $title ) . $args['after_title']; ?>
    
    		<?php if ( is_user_logged_in() ) : ?>
    
    			<?php
    			/**
    			 * Fires before the display of widget content if logged in.
    			 *
    			 * @since BuddyPress 1.9.0
    			 */
    			do_action( 'bp_before_login_widget_loggedin' ); ?>
    
    			<div class="bp-login-widget-user-avatar">
    				<a href="<?php echo bp_loggedin_user_domain(); ?>">
    					<?php bp_loggedin_user_avatar( 'type=thumb&width=50&height=50' ); ?>
    				</a>
    			</div>
    
    			<div class="bp-login-widget-user-links">
    				<div class="bp-login-widget-user-link"><?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></div>
    				<div class="bp-login-widget-user-logout"><a class="logout" href="<?php echo wp_logout_url( bp_get_requested_url() ); ?>"><?php _e( 'Log Out', 'buddyboss' ); ?></a></div>
    			</div>
    
    			<?php
    
    			/**
    			 * Fires after the display of widget content if logged in.
    			 *
    			 * @since BuddyPress 1.9.0
    			 */
    			do_action( 'bp_after_login_widget_loggedin' ); ?>
    
    		<?php else : ?>
    
    			<?php
    
    			/**
    			 * Fires before the display of widget content if logged out.
    			 *
    			 * @since BuddyPress 1.9.0
    			 */
    			do_action( 'bp_before_login_widget_loggedout' ); ?>
    
    			<form name="bp-login-form" id="bp-login-widget-form" class="standard-form" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
    				<label for="bp-login-widget-user-login"><?php _e( 'Username', 'buddyboss' ); ?></label>
    				<input type="text" name="log" id="bp-login-widget-user-login" class="input" value="" />
    
    				<label for="bp-login-widget-user-pass"><?php _e( 'Password', 'buddyboss' ); ?></label>
    				<input type="password" name="pwd" id="bp-login-widget-user-pass" class="input" value="" <?php bp_form_field_attributes( 'password' ) ?> />
    
    				<div class="forgetmenot"><label for="bp-login-widget-rememberme"><input name="rememberme" type="checkbox" id="bp-login-widget-rememberme" value="forever" /> <?php _e( 'Remember Me', 'buddyboss' ); ?></label></div>
    
    				<input type="submit" name="wp-submit" id="bp-login-widget-submit" value="<?php esc_attr_e( 'Log In', 'buddyboss' ); ?>" />
    
    				<?php if ( bp_get_signup_allowed() ) : ?>
    
    					<span class="bp-login-widget-register-link"><a href="<?php echo esc_url( bp_get_signup_page() ); ?>"><?php _e( 'Register', 'buddyboss' ); ?></a></span>
    
    				<?php endif; ?>
    
    				<?php
    
    				/**
    				 * Fires inside the display of the login widget form.
    				 *
    				 * @since BuddyPress 2.4.0
    				 */
    				do_action( 'bp_login_widget_form' ); ?>
    
    			</form>
    
    			<?php
    
    			/**
    			 * Fires after the display of widget content if logged out.
    			 *
    			 * @since BuddyPress 1.9.0
    			 */
    			do_action( 'bp_after_login_widget_loggedout' ); ?>
    
    		<?php endif;
    
    		echo $args['after_widget'];
    	}
    

    Expand full source code Collapse full source code

    Changelog

    Changelog
    Version Description
    BuddyPress 1.9.0 Introduced.

    Related

    Uses

    Uses
    Uses Description
    bp-members/bp-members-functions.php: bp_core_get_userlink()

    Return a HTML formatted link for a user with the user’s full name as the link text.

    bp-members/bp-members-template.php: bp_get_signup_allowed()

    Is user signup allowed?

    bp-members/bp-members-template.php: bp_get_signup_page()

    Get the URL to the signup page.

    bp-members/bp-members-template.php: bp_loggedin_user_domain()

    Generate the link for the logged-in user’s profile.

    bp-members/bp-members-template.php: bp_loggedin_user_avatar()

    Output the logged-in user’s avatar.

    bp-core/bp-core-template.php: bp_loggedin_user_id()

    Get the ID of the currently logged-in user.

    bp-core/bp-core-template.php: bp_form_field_attributes()

    Output the attributes for a form field.

    bp-templates/bp-nouveau/includes/activity/widgets.php: widget_title

    Filters the BP_Latest_Activities widget title.

    bp-core/classes/class-bp-core-login-widget.php: bp_before_login_widget_loggedin

    Fires before the display of widget content if logged in.

    bp-core/classes/class-bp-core-login-widget.php: bp_after_login_widget_loggedin

    Fires after the display of widget content if logged in.

    bp-core/classes/class-bp-core-login-widget.php: bp_before_login_widget_loggedout

    Fires before the display of widget content if logged out.

    bp-core/classes/class-bp-core-login-widget.php: bp_login_widget_form

    Fires inside the display of the login widget form.

    bp-core/classes/class-bp-core-login-widget.php: bp_after_login_widget_loggedout

    Fires after the display of widget content if logged out.

    bp-core/bp-core-catchuri.php: bp_get_requested_url()

    Return the URL as requested on the current page load by the user agent.

    Show 9 more uses Hide more uses

    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.

    © 2023 • BuddyBoss