} $location_output = array(); while (count($location_list)) { $location = array_pop($location_list); $location_output[] = '<a href="' . get_term_link($location, $taxonomy) . '">' . $location->name . '</a>'; } if (count($location_output)) { $meta['up-to-date']->items[] = '<p>Location: ' . implode(' / ', $location_output) . '</p>'; } $organizers = get_the_terms(get_the_ID(), 'organizer'); $organizer_output = array(); if (!empty($organizers)) { $simple = ' simple'; foreach ($organizers as $organizer) { @$index++; $user = get_organizer_user($organizer); $link = get_term_link($organizer, 'organizer'); if ($user) { $user_meta = array('<a href="' . $link . '" class="url fn">' . $user->display_name . ' ' . get_avatar($user->ID, 120) . '</a>'); if ($twitter = get_the_author_meta('twitter', $user->ID)) { $user_meta[] = '<a href="https://twitter.com/' . $twitter . '">@' . $twitter . '</a>'; } if ($website = get_the_author_meta('user_url', $user->ID)) { $website_display = parse_url($website, PHP_URL_HOST); $user_meta[] = '<a href="' . $website . '">' . $website_display . '</a>'; } if (count($organizers) > 1 && count($user_meta) > 1) { $simple = ''; } $organizer_output[] = '<li class="vcard organizer-' . $index . '">' . implode(' | ', $user_meta) . '</li>'; } else {
function mf2012_map_organizers_to_users($term_id, $taxonomy_id = null, $taxonomy = 'organizer') { if ($taxonomy == 'organizer') { $user = get_organizer_user($term_id); $term = get_term($term_id, $taxonomy); $username = $term->slug; $name = preg_split('/\\s+/', $term->name, 2); if (is_null($user)) { $user_id = username_exists($username); if (!$user_id) { $user_id = wp_create_user($username, wp_generate_password(20)); wp_insert_user(array('ID' => $user_id, 'user_login' => $username, 'role' => 'organizer')); } } else { $user_id = $user->ID; } wp_insert_user(array('ID' => $user_id, 'user_login' => $username, 'first_name' => @$name[0], 'last_name' => @$name[1], 'nickname' => @$name[0], 'display_name' => $term->name, 'description' => $term->description)); update_user_meta($user_id, 'organizer_id', $term_id); } }