/** * Diese Funktion baut die Autorenkurzprofile auf der Redaktionsübersicht. * Parameter: BenutzerID, String für die Beschreibung, String für den Zeitraum */ function printAuthorProfile($id, $role, $date) { //Datenbankabfragen zusammenbauen $parameters = array(); //erstmal nur normale Artikel $parameters['post_type'] = array('post'); //eines Autors $parameters['author'] = $id; //alle "auf einer Seite" (werden hier nicht angezeigt, nur gezählt) $parameters['nopaging'] = true; $myquery = new WP_Query($parameters); $posts = $myquery->posts; //das gleiche noch mal für Comics $parameters['post_type'] = array('comic'); $myquery = new WP_Query($parameters); $comics = $myquery->posts; echo '<div class="gallery_element">'; echo '<h2 class="smalltitle">'; //voller Name echo get_the_author_meta('display_name', $id); //Email, wenn es eine StudentenPACK Adresse ist $email = get_the_author_meta('user_email', $id); if (preg_match_packmail($email)) { echo ' <a href="mailto:' . $email . '"><img src="' . get_bloginfo('template_directory') . '/images/email16px.png" alt="email" /></a>'; } else { //hier ist ein unsichtbares Dummy-Icon, damit sich die Textausrichtung nicht verschiebt, nur weil jemand keine Emailadresse hat... echo '<img src="' . get_bloginfo('template_directory') . '/images/dummy16px.png" width="16px" height="16px" alt="" />'; } echo '</h2>'; echo '<p class="smalltext">' . $role . '</p>'; echo '<p class="smalltext">' . $date . '</p>'; if (count($posts) == 0 && count($comics) == 0) { //Wer keinen Artikel hat, hat keinen Artikel echo '<p class="smalltext">' . get_the_author_meta('first_name', $id) . ' hat noch keinen Artikel geschrieben</p>'; } else { //Anzahl Artikel und Comics ausgeben echo '<p class="smalltext">'; echo '<a href="' . get_author_posts_url($id) . '">'; if (count($posts) > 0) { echo count($posts) . ' Artikel'; } if (count($posts) > 0 && count($comics) > 0) { echo ' und '; } if (count($comics) > 0) { echo count($comics) . ' Comics'; } echo ' von ' . get_the_author_meta('first_name', $id) . '</a></p>'; } echo '</div>'; }
echo '</div>'; } } if (is_author()) { //Autoren zeigen einen Beschreibungstext an (falls vorhanden) if (get_the_author_meta('description', get_query_var('author')) != "") { echo '<div class="sidebar-section">'; echo '<h2 class="smalltitle">' . '<img src="' . get_bloginfo('template_directory') . '/images/author16px.png" alt="autor"/> ' . ' Bio</h2>'; //echo '<div class="sidebar_avatar">'.get_avatar(get_query_var('author'),150).'</div>'; echo '<p class="smalltext">'; echo get_the_author_meta('description', get_query_var('author')); echo '</p>'; } //Autoren, die eine StudentenPACK-Emailadresse haben, zeigen diese an $email = get_the_author_meta('user_email', get_query_var('author')); if (preg_match_packmail($email)) { echo '<div class="sidebar-section">'; echo '<h2 class="smalltitle">' . '<img src="' . get_bloginfo('template_directory') . '/images/email16px.png" alt="email"/> ' . ' Kontakt</h2>'; echo '<p class="smalltext">'; echo '<a href="mailto:' . get_the_author_meta('user_email', get_query_var('author')) . '">' . get_the_author_meta('user_email', get_query_var('author')) . '</a>'; echo '</p>'; echo '</div>'; } //Autoren, die eine eigene Homepage angegeben haben, zeigen diese an if (get_the_author_meta('user_url', get_query_var('author')) != "") { echo '<div class="sidebar-section">'; echo '<h2 class="smalltitle">' . '<img src="' . get_bloginfo('template_directory') . '/images/www16px.png" alt="homepage"/> ' . ' Homepage</h2>'; echo '<p class="smalltext">'; echo '<a href="' . get_the_author_meta('user_url', get_query_var('author')) . '">' . get_the_author_meta('user_url', get_query_var('author')) . '</a>'; echo '</p>'; echo '</div>';