Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problem using an xProfile function


  • Andrew
    Participant

    @snd26

    I recently got an error on the latest update because of my function:

    function mn_member_short_description() {
    	$args = array(
    		'field'   => 'Short Description', // Field name or ID.
    	);
    		
    	if ($short_description = xprofile_get_field_data($args, bp_get_member_user_id())) {	
    		echo esc_html($short_description);		
    	} 
    }

    I got a notice:
    Notice: Array to string conversion in /home/###/public_html/wp-content/plugins/buddypress/bp-core/bp-core-cache.php on line 320

    The first parameter of the xprofile_get_field_data() in the BuddyPress file still says the first paramater can be a mixed parameter.

    Nevertheless, I fixed my function by changing the args array to a sting:

    xprofile_get_field_data('Short Description', bp_get_member_user_id());.

Viewing 1 replies (of 1 total)

  • shanebp
    Moderator

    @shanebp

    It does not say that an array is supported…
    * @param mixed $field The ID of the field, or the $name of the field.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar