You are here

function _mailchimp_bio_get_bio_fields in Mailchimp 5

Same name and namespace in other branches
  1. 5.2 mailchimp_bio.module \_mailchimp_bio_get_bio_fields()

Get the bio.module fields for the given user

File

./mailchimp_bio.module, line 56

Code

function _mailchimp_bio_get_bio_fields($user) {
  $out = array();
  if (function_exists('bio_for_user') && ($nid = bio_for_user($user->uid))) {

    // Load the bio node. Reload from the database because this us called during update.
    if ($node = node_load($nid, NULL, true)) {
      $bio_fields = _bio_get_fields();
      $node = node_build_content($node, false, true);
      foreach ($bio_fields as $key => $field) {
        $out['bio_' . $key] = $node->{$key}[0]['view'];
      }
    }
  }
  return $out;
}