BP_Core_User::populate()
Populate the instantiated class with data based on the User ID provided.
Description
Source
File: bp-core/classes/class-bp-core-user.php
public function populate() { if ( bp_is_active( 'xprofile' ) ) $this->profile_data = $this->get_profile_data(); if ( !empty( $this->profile_data ) ) { $full_name_field_name = bp_xprofile_fullname_field_name(); $this->user_url = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] ); $this->fullname = esc_attr( $this->profile_data[$full_name_field_name]['field_data'] ); $this->user_link = "<a href='{$this->user_url}'>{$this->fullname}</a>"; $this->email = esc_attr( $this->profile_data['user_email'] ); } else { $this->user_url = bp_core_get_user_domain( $this->id ); $this->user_link = bp_core_get_userlink( $this->id ); $this->fullname = esc_attr( bp_core_get_user_displayname( $this->id ) ); $this->email = esc_attr( bp_core_get_user_email( $this->id ) ); } $this->avatar = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'full', 'alt' => sprintf( __( 'Profile photo of %s', 'buddyboss' ), $this->fullname ) ) ); $this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf( __( 'Profile photo of %s', 'buddyboss' ), $this->fullname ) ) ); $this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf( __( 'Profile photo of %s', 'buddyboss' ), $this->fullname ), 'width' => 30, 'height' => 30 ) ); $this->last_active = bp_core_get_last_activity( bp_get_user_last_activity( $this->id ), __( 'active %s', 'buddyboss' ) ); }
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.