BP_Xprofile_Profile_Completion_Widget::widget( $args, $instance )
Displays the widget.
Description
Source
File: bp-xprofile/classes/class-bp-xprofile-profile-completion-widget.php
function widget( $args, $instance ) { // do not do anything if user isn't logged in OR IF user is viewing other members profile. if ( ! is_user_logged_in() || ( bp_is_user() && ! bp_is_my_profile() ) ) { return; } /* Widget VARS */ $profile_groups_selected = $instance['profile_groups_enabled']; $this->widget_id = $args['widget_id']; $profile_phototype_selected = ! empty( $instance['profile_photos_enabled'] ) ? $instance['profile_photos_enabled'] : array(); $profile_hide_widget_selected = ! empty( $instance['profile_hide_widget'] ) ? $instance['profile_hide_widget'] : array(); $user_progress = $this->get_progress_data( $profile_groups_selected, $profile_phototype_selected ); // IF nothing selected then return and nothing to display. if ( empty( $profile_groups_selected ) && empty( $profile_phototype_selected ) ) { return; } // Hide the widget if "Hide widget once progress hits 100%" selected and progress is 100% if ( 100 === (int) $user_progress['completion_percentage'] && ! empty( $instance['profile_hide_widget'] ) ) { return; } /* Widget Template */ echo $args['before_widget']; // Widget Title echo $args['before_title']; echo $instance['title']; echo $args['after_title']; // Widget Content // Globalize the Profile Completion widget arguments. Used in the template called below. $bp_nouveau = bp_nouveau(); $bp_nouveau->xprofile->profile_completion_widget_para = $user_progress; bp_get_template_part( 'members/single/profile/widget' ); $bp_nouveau->xprofile->profile_completion_widget_para = array(); /** * Fires after showing widget content. * * @since BuddyBoss 1.2.5 */ do_action( 'xprofile_profile_completion_widget' ); echo $args['after_widget']; }
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.