Hallo!
Welchen PHP-Code muss ich in meinem Template einbauen um das Benutzerbild (was man in Buddypress hat) des jeweiligen Besuchers bei den Kommentaren anzuzeigen?
Zur Zeit werden Gravatar-Bilder verwendet, aber da ich ja nun BP habe ist dies nicht mehr nötig.
http://sommergemuese.klee.in/2010/09/nfs-sh…4-superleggera/
Hier ist der Source-Code von comments.php und ja ich weiß, es ist teilweise ein wenig komisch :D
PHP
<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<p class="nocomments">Dieser Beitrag ist Passwortgeschützt. Gib das Passwort ein, um die Kommentare zu sehen.</p>
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = 'class="alt" ';
?>
<!-- comments.php -->
<?php if ($comments) : ?>
<div id="comment-list"><?php comments_number('Kein Kommentar', 'Ein Kommentar', '% Kommentare' );?> zu... <span class="bigger"><strong>“<?php the_title(); ?>”</strong></span></div>
<?php foreach ($comments as $comment) : ?>
<div class="comment-left" <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
<div class="comment-meta">
<img src="<?php gravatar("R", 90); ?>" alt="Avatar" /><br />
<cite><?php comment_author_link() ?></cite>
<span class="comment-metadata"><?php if ($comment->comment_approved == '0') : ?>
<em>Dein Kommentar muss moderiert werden.</em></span>
<?php endif; ?>
<br />
<span class="comment-metadata"><?php comment_date('d.m.Y') ?> <br /><?php edit_comment_link('Editieren',' ',''); ?></span>
</div>
<div class="comment-txt"><?php comment_text() ?></div>
<br clear="all" />
</div>
<?php
/* Changes every other comment to a different class */
$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
?>
<?php endforeach; /* end for each comment */ ?>
</ol>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ('open' == $post->comment_status) : ?>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>Du musst <a href="http://sommergemuese.klee.in/wp-login.php?redirect_to=<?php the_permalink(); ?>">Eingeloggt</a> sein, um Kommentare schreiben zu können.</p>
<p><strong><a href="http://sommergemuese.klee.in/wp-login.php?action=register">Registrieren</a></strong> dauert nur 5 Sekunden</p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p>Angemeldet als <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(); ?>" title="Ausloggen">Ausloggen »</a></p>
<?php else : ?>
<div class="comments-PII">
<p><label for="author">Name:</label><br />
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1" /><br />
<span class="note"><?php if ($req) echo "(erforderlich)"; ?></span></p>
<p><label for="email">Email Addresse:</label><br />
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" /><br />
<span class="note"><?php if ($req) echo "(erforderlich)"; ?> (Wird nicht angezeigt)</span></p>
<p><label for="url">Webseite:</label><br />
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" /></p>
</div>
<?php endif; ?>
<div class="comments-PII-2">
<p>Dein Kommentar:<br />
<textarea name="comment" id="comment" tabindex="4"></textarea></p>
<p><input name="submit" type="submit" id="submit" tabindex="5" class="submit-btn" value="Add Comment »" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
</div>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
Alles anzeigen