From 9b90b4b0cd464424f3f9a4214d265db69b3691dc Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 10 Jan 2009 06:18:35 +0000 Subject: Use the theme's avatar as the default if Gravatar doesn't have one. --- modules/comment/views/admin_block_recent_comments.html.php | 9 ++++++--- modules/comment/views/admin_comments.html.php | 3 ++- modules/comment/views/comment.html.php | 3 ++- modules/comment/views/comments.html.php | 3 ++- modules/user/models/user.php | 6 +++--- 5 files changed, 15 insertions(+), 9 deletions(-) (limited to 'modules') diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php index 2d753bd7..ef48423c 100644 --- a/modules/comment/views/admin_block_recent_comments.html.php +++ b/modules/comment/views/admin_block_recent_comments.html.php @@ -2,10 +2,13 @@ diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php index 5b2d2ca4..1cbdcd70 100644 --- a/modules/comment/views/admin_comments.html.php +++ b/modules/comment/views/admin_comments.html.php @@ -91,7 +91,8 @@ - " class="gAvatar" alt="author_name() ?>" />

- " class="gAvatar" alt="author_name() ?>" /> created) ?> diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index b3757a5c..9b5f7056 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -5,7 +5,8 @@

  • - " class="gAvatar" alt="author_name() ?>" /> {{name}} said", diff --git a/modules/user/models/user.php b/modules/user/models/user.php index 991e02f0..85fa75bb 100644 --- a/modules/user/models/user.php +++ b/modules/user/models/user.php @@ -48,8 +48,8 @@ class User_Model extends ORM { * @param integer $size the target size of the image (default 80px) * @return string a url */ - public function avatar_url($size=80) { - return sprintf("http://www.gravatar.com/avatar/%s.jpg?s=%d&r=pg", - md5($this->email), $size); + public function avatar_url($size=80, $default=null) { + return sprintf("http://www.gravatar.com/avatar/%s.jpg?s=%d&r=pg%s", + md5($this->email), $size, $default ? "&d=" . urlencode($default) : ""); } } \ No newline at end of file -- cgit v1.2.3