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
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | 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.