Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • Mr3k
    Participant

    @mr3k

    Thanks @shanebp for the guidance. I read some about add_action and manage to get the function to work as desired.

    For people interested, this is what I did. I created a custom function that follows:

    add_action( 'bp_ready', 'custom_function' );
    
    // The ID of the field, or the $name of the field. 
    function custom_function($user_id){
    	$field = 'fieldname'; 
    	  
    	// How should array data be returned? 'comma' if you want a 
    	// comma-separated string; 'array' if you want an array. 
    	$multi_format = 'comma'; 
    	  
    	// NOTICE! Understand what this does before running. 
    	$result = xprofile_get_field_data($field, $user_id, $multi_format); 
    	return $result;
    }

    The main function that I wanted to get the profile data was then called.

    Have a great day!


    Mr3k
    Participant

    @mr3k

    Thanks @shanebp for the answer!

    I can understand this. But if I change to this code:

    add_action( 'bp_ready', 'hisgen_check' );
    function hisgen_check() {	
       return xprofile_get_field_data( 'Yrkesroll', 1, 'comma' );
    }
    echo hisgen_check();

    Would that work then? I’ve tried several combination of this without success..

Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar