Gravatar provides an image hosting service which means that Drupal admins shouldn't have to (which limits the attack surface and avoids liability from inappropriate images, copyright violations, etc.)

Please provide an option whereby users can enable pictures (in order to have gravatars) but disable picture uploads. That is, if a user has a gravatar then it will be displayed and if not they'll get a default image — if they want an image they have to visit gravatar.com and upload one.

I was able to achieve this by adding the following directive in gravatar.module:gravatar_form_user_profile_form_alter

unset($form['picture']['picture_upload']);

I also removed the (now unhelpful) advice about uploading a picture by commenting both of these lines out:

// '#description' => t('Your Gravatar will not be shown if you upload a user picture.'),

However it's a bit of a hack and it is not configurable via the user interface (either globally via gravatar config or, better yet, via user permissions — e.g. "upload own picture"). See the screenshot attached for how it looks.

CommentFileSizeAuthor
gravatar-only.png33.63 KBsamj

Comments

BenK’s picture

Subscribing

nocean’s picture

+1 for this feature.

An easier way to handle this (until it is committed) is to avoid hacking the module, and rather simply adding the following to your theme's template.php file:

function YOURTHEMENAME_form_user_profile_form_alter(&$form, $form_state) {
	unset($form['picture']['picture_upload']);
	$form['picture']['gravatar']['#description'] = '';
}

This removes the upload form element, and the 'Your Gravatar will not be shown if you upload a user picture.' text.

NOTE: You won't actually need to copy and paste the <?php and ?> part. And remember to change YOURTHEMENAME to (gasp!) your theme's name. :)