Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages » Comments, trackbacks & pings »

recent comments and gravatar


  #1  
Old Jul 18, 2010, 08:29 PM
ylsnuha
 
9 posts · Jul 2010
hi,I want to change the Recent Comments code ,make it like the plugin WP-RecentComments.baceuse I think the BFA Recent Comments is not so easy to read and I can`t have the Gravatar. So I find these codes,they woked well on other theme,but I don`t know where to insert in this theme. ok, the codes are here
It`s what they say :copy these code to sidebar.php
Code:
<h3><?php _e('Recent Comments'); ?></h3>
<ul class="recentcomments">
<?php
$my_email = "'" . get_bloginfo ('admin_email') . "'";
$rc_comms = $wpdb->get_results("
  SELECT ID, post_title, comment_ID, comment_author, comment_author_email, comment_content
  FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts
  ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
  WHERE comment_approved = '1'
  AND comment_type = ''
  AND post_password = ''
  AND comment_author_email != $my_email
  ORDER BY comment_date_gmt
  DESC LIMIT 10
");
$rc_comments = '';
foreach ($rc_comms as $rc_comm) {
  $a = 'avatar/'.md5(strtolower($rc_comm->comment_author_email)).'.jpg';
  $rc_comments .= "<li><img src='" . $a . "' alt='' title='" . $rc_comm->comment_author
    . "' class='avatar' /><a href='"
    . get_permalink($rc_comm->ID) . "#comment-" . $rc_comm->comment_ID
  //. htmlspecialchars(get_comment_link( $rc_comm->comment_ID, array('type' => 'comment'))) 
    . "' title='on " . $rc_comm->post_title . "'>" . strip_tags($rc_comm->comment_content)
    . "</a></li>\n";
}
$rc_comments = convert_smilies($rc_comments);
echo $rc_comments;
?>
</ul>
and this code include the Gravatar cache,the codes:
first name a folder "avatar" at the same level as directory wp-content ,set 755.Use a default.jpg as the default gravatar
find function mytheme_comment($comment, $args, $depth) in comments.php or functions.php as this
Code:
<?php echo get_avatar($comment,$size='50',$default='<path_to_url>'  ); ?>
and changed to
Code:
<?php
$f = md5(strtolower($comment->comment_author_email));
$a = get_bloginfo('wpurl'). '/avatar/'. $f. '.jpg';
$e = ABSPATH. 'avatar/'. $f. '.jpg';
$t = 1209600; //  14 days
$d = get_bloginfo('wpurl'). '/avatar/default.jpg';
if ( !is_file($e) || (time() - filemtime($e)) > $t ){ 
  $r = get_option('avatar_rating');
  $g = 'http://www.gravatar.com/avatar/'. $f. '?s=50&d='. $d. '&r='.$r;
  copy($g, $e); $a = esc_attr($g); 
}
if (filesize($e) < 500) copy($d, $e);
?>
<img src='<?php echo $a ?>' alt='' />
ok.codes are here,but I don`t know where I can insert
I don`t want to ues plugin WP-RecentComments and gravatar cache .please help me
I also hope in new version the BFA Recent Comments can be more beautful.
  #2  
Old Jul 19, 2010, 11:57 AM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
Why not style the BFA Recent Comments widget or turn off the avatar function on the WP-RecentComments widget? Adding code to the theme files is something I try to never do unless it's a bug fix as later upgrades are more cumbersome.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.

Bookmarks

Tags
gravatar, recent comments

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change the # of recent comments that show up? macgig Page & Category Menu Bars 4 Jun 16, 2010 08:49 PM
[help]cannot get 'on' translated in bfa-recent-comments jokkiebo Languages & Translations 1 Apr 22, 2010 04:53 AM
Recent Comments widget: possible bug in linking of new comments Jozefs Sidebars & Widgets 3 Jan 6, 2010 10:06 AM
[SOLVED] BFA Recent Comments Tammy Sidebars & Widgets 4 Jul 22, 2009 08:43 AM
[SOLVED] Gravatar not showing on Recent Comments widget jankph Comments, trackbacks & pings 2 Jul 13, 2009 04:59 AM


All times are GMT -6. The time now is 12:19 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.