### Eclipse Workspace Patch 1.0 #P moodlecvs Index: lib/outputrenderers.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/outputrenderers.php,v retrieving revision 1.233 diff -u -r1.233 outputrenderers.php --- lib/outputrenderers.php 10 Aug 2010 08:50:08 -0000 1.233 +++ lib/outputrenderers.php 16 Aug 2010 05:39:25 -0000 @@ -1738,12 +1738,12 @@ $usercontext = get_context_instance(CONTEXT_USER, $user->id); $src = moodle_url::make_pluginfile_url($usercontext->id, 'user', 'icon', NULL, '/', $file); - } else if ($user->picture == 2) { - //TODO: gravatar user icon support - } else { // Print default user pictures (use theme version if available) $class .= ' defaultuserpic'; $src = $this->pix_url('u/' . $file); + if (!empty($CFG->enablegravatar)) { + $src = 'http://www.gravatar.com/avatar.php?gravatar_id='.md5(strtolower($user->email)).'&default='.urlencode($src).'&size='.$size; + } } $attributes = array('src'=>$src, 'alt'=>$alt, 'class'=>$class, 'width'=>$size, 'height'=>$size); Index: admin/settings/users.php =================================================================== RCS file: /cvsroot/moodle/moodle/admin/settings/users.php,v retrieving revision 1.60 diff -u -r1.60 users.php --- admin/settings/users.php 21 Jun 2010 15:30:55 -0000 1.60 +++ admin/settings/users.php 16 Aug 2010 05:39:24 -0000 @@ -131,6 +131,8 @@ $temp->add(new admin_setting_configmulticheckbox('extrauserselectorfields', get_string('extrauserselectorfields', 'admin'), get_string('configextrauserselectorfields', 'admin'), array('email' => '1'), array('email' => get_string('email'), 'idnumber' => get_string('idnumber'), 'username' => get_string('username'), ))); + + $temp->add(new admin_setting_configcheckbox('enablegravatar', get_string('enablegravatar', 'admin'), get_string('configenablegravatar', 'admin'), 0)); } $ADMIN->add('roles', $temp); Index: lang/en/admin.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en/admin.php,v retrieving revision 1.119 diff -u -r1.119 admin.php --- lang/en/admin.php 9 Aug 2010 10:19:26 -0000 1.119 +++ lang/en/admin.php 16 Aug 2010 05:39:24 -0000 @@ -193,6 +193,7 @@ $string['configenablecomments'] = 'Enable comments'; $string['configenablecourserequests'] = 'This will allow any user to request a course be created.'; $string['configenableglobalsearch'] = 'This setting enables global text searching in resources and activities, it is not compatible with PHP 4.'; +$string['configenablegravatar'] = 'If a user has not uploaded a profile picture, Moodle will try to display a Gravatar image for that user. If no Gravatar image is found, the default profile picture is displayed. See http://www.gravatar.com/ for more information.'; $string['configenablegroupmembersonly'] = 'This setting enables group members only feature. Please note it is incresing your server load and it is necessary to use some advanced tricks in the gradebook.'; $string['configenablehtmlpurifier'] = 'Use HTML Purifier instead of KSES for cleaning of untrusted text. HTML Purifier is actively developed and is believed to be more secure, but it is more resource intensive. Expect minor visual differences in the resulting html code. Please note that embed and object tags can not be enabled, MathML tags and old lang tags are not supported.'; $string['configenablerssfeeds'] = 'This switch will enable RSS feeds from across the site. To actually see any change you will need to enable RSS feeds in the individual modules too - go to the Modules settings under Admin Configuration.'; @@ -466,6 +467,7 @@ $string['enablecomments'] = 'Enable comments'; $string['enablecourserequests'] = 'Enable course requests'; $string['enableglobalsearch'] = 'Enable global search'; +$string['enablegravatar'] = 'Enable Gravatar for profile pictures'; $string['enablegroupmembersonly'] = 'Enable group members only'; $string['enablehtmlpurifier'] = 'Enable HTML Purifier'; $string['enablerecordcache'] = 'Enable record cache';