bp_nouveau_has_wp_profile_fields()
Does the displayed user has WP profile fields?
Description
Return
(bool) True if user has profile fields. False otherwise.
Source
File: bp-templates/bp-nouveau/includes/members/template-tags.php
function bp_nouveau_has_wp_profile_fields() { $user_id = bp_displayed_user_id(); if ( ! $user_id ) { return false; } $user = get_userdata( $user_id ); if ( ! $user ) { return false; } $fields = bp_nouveau_get_wp_profile_fields( $user ); $user_profile_fields = array(); foreach ( $fields as $key => $field ) { if ( empty( $user->{$key} ) ) { continue; } $user_profile_fields[] = (object) array( 'id' => 'wp_' . $key, 'label' => $field, 'data' => $user->{$key}, ); } if ( ! $user_profile_fields ) { return false; } // Keep it for a later use. $bp_nouveau = bp_nouveau(); $bp_nouveau->members->wp_profile = $user_profile_fields; $bp_nouveau->members->wp_profile_index = 0; return true; }
Changelog
Version | Description |
---|---|
BuddyPress 3.0.0 | 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.