/**
 * Fetches a random piece of profile data for the user.
 *
 * @package BuddyPress Core
 * @param int $user_id User ID of the user to get random data for
 * @param bool $exclude_fullname Optional; whether or not to exclude the full name field as random data. Defaults to true.
 * @global BuddyPress $bp The one true BuddyPress instance
 * @global $wpdb WordPress DB access object.
 * @global $current_user WordPress global variable containing current logged in user information
 * @uses xprofile_format_profile_field() Formats profile field data so it is suitable for display.
 * @return string|bool The fetched random data for the user, or false if no data or no match.
 */
function xprofile_get_random_profile_data($user_id, $exclude_fullname = true)
{
    $field_data = BP_XProfile_ProfileData::get_random($user_id, $exclude_fullname);
    if (empty($field_data)) {
        return false;
    }
    $field_data[0]->value = xprofile_format_profile_field($field_data[0]->type, $field_data[0]->value);
    if (empty($field_data[0]->value)) {
        return false;
    }
    /**
     * Filters a random piece of profile data for the user.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param array $field_data Array holding random profile data.
     */
    return apply_filters('xprofile_get_random_profile_data', $field_data);
}
/**
 * Fetches a random piece of profile data for the user.
 *
 * @package BuddyPress Core
 * @param $user_id User ID of the user to get random data for
 * @param $exclude_fullname whether or not to exclude the full name field as random data.
 * @global object $bp Global BuddyPress settings object
 * @global $nxtdb NXTClass DB access object.
 * @global $current_user NXTClass global variable containing current logged in user information
 * @uses xprofile_format_profile_field() Formats profile field data so it is suitable for display.
 * @return $field_data The fetched random data for the user.
 */
function xprofile_get_random_profile_data($user_id, $exclude_fullname = true)
{
    $field_data = BP_XProfile_ProfileData::get_random($user_id, $exclude_fullname);
    if (!$field_data) {
        return false;
    }
    $field_data[0]->value = xprofile_format_profile_field($field_data[0]->type, $field_data[0]->value);
    if (!$field_data[0]->value || empty($field_data[0]->value)) {
        return false;
    }
    return apply_filters('xprofile_get_random_profile_data', $field_data);
}