Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get all extended fields & values given user id


  • Hudson Atwell
    Participant

    @adbox

    I’m looking to build a 3rd party integration extension and I’m able to get the user meta but am stumped on how to get all extended fields keys and values with one function.

    Isn’t there a way to build a data object of this information easily?

Viewing 2 replies - 1 through 2 (of 2 total)

  • Hudson Atwell
    Participant

    @adbox

    So far this is as close as I have gotten:

    
    public static function get_extended_fields( $user_id ) {
    		
    		$fields = array();
    		
    		/* Get User Extended Data */
    		$r = bp_parse_args( $args['args'], array(
    			'profile_group_id' => 0,
    			'user_id'          =>  $user_id
    		), 'bp_xprofile_user_admin_profile_loop_args' );
    
    		$i = 0;
    		
    		if ( bp_has_profile( $r ) ) {
    			
    			while ( bp_profile_groups() ) {
    				
    				bp_the_profile_group(); 
    				
    				while ( bp_profile_fields() ) {
    					
    					bp_the_profile_field();
    					$field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
    
    					$fields[ $i ]['name'] = bp_get_the_profile_field_name();
    					$fields[ $i ]['id'] = bp_get_the_profile_field_input_name();
    					$fields[ $i ]['value'] = bp_get_the_profile_field_edit_value();
    	
    					$i++;
    				}
    			}		
    		}
    		return $fields;
    		
    	}
    

    shanebp
    Moderator

    @shanebp

    Sometimes it’s much easier to just write a custom query.
    See: wpdb

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get all extended fields & values given user id’ is closed to new replies.
Skip to toolbar