Project

General

Profile

Feature #4507

Add gravatar support

Added by Julio Montoya over 7 years ago. Updated over 4 years ago.

Status:
Feature implemented
Priority:
Normal
Assignee:
Category:
Users/Groups
Target version:
Start date:
22/03/2012
Due date:
% Done:

100%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

Seems to be easy to implement ...

Not a priority for 1.9

https://en.gravatar.com/site/implement/images/php/

Associated revisions

Revision 59c34310 (diff)
Added by Imanol Losada over 4 years ago

Add Gravatar support - refs #4507

Revision 3896a7f0 (diff)
Added by Imanol Losada over 4 years ago

Add missing configuration parameters - refs #4507

Revision bb60b9d8 (diff)
Added by Imanol Losada over 4 years ago

Revert "Add missing configuration parameters - refs #4507"

This reverts commit 3896a7f05d27c569df20329ef5827d012055a0ff.

Signed-off-by: Imanol Losada <>

Revision 39579c38 (diff)
Added by Imanol Losada over 4 years ago

Add missing configuration parameters - refs #4507

Revision 6ebcbdf4 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in get_user_picture_path_by_id and _api_format_user functions - refs #4507

Revision 289cafb8 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in main/admin/user_edit.php - refs #4507

Revision 25281a24 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in main/admin/user_list.php - refs #4507

Revision 65feb9cb (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar photo link in main/admin/user_edit.php - refs #4507

Revision d1950538 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in main/auth/profile.php - refs #4507

Revision 32938941 (diff)
Added by Imanol Losada over 4 years ago

Remove redundant function calls - refs #4507

Revision 01c93c60 (diff)
Added by Imanol Losada over 4 years ago

Undo changes in main/inc/lib/group_portal_manager.lib.php - refs #4507

Revision 27ffdcfc (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in course chat - refs #4507

Revision b2a70d90 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in main/gradebook/user_info.php - refs #4507

Revision 421080fb (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in main/gradebook/user_stats.php - refs #4507

Revision a0d6fdc6 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in whoisonline.php - refs #4507

Revision e03283ec (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in social wall - refs #4507

Revision 01759564 (diff)
Added by Imanol Losada over 4 years ago

Solve database issue in social wall - refs #4507

Revision 2211bc63 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in main/mySpace/myStudents.php - refs #4507

Revision f45f9ff8 (diff)
Added by Imanol Losada over 4 years ago

Fix big url gravatar in main/mySpace/myStudents.php - refs #4507

Revision cdbcfb1b (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in main/user/userInfo.php - refs #4507

Revision 0e30f6c2 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar in main/wiki/wiki.inc.php - refs #4507

Revision 10f7ae8b (diff)
Added by Imanol Losada over 4 years ago

Another gravatar fix in main/wiki/wiki.inc.php - refs #4507

Revision 2020fef9 (diff)
Added by Imanol Losada over 4 years ago

Fix wiki discuss query - refs #4507

Revision 8637521b (diff)
Added by Imanol Losada over 4 years ago

Add 'getUserPathById' function - refs #4507

Revision 1cecc9ab (diff)
Added by Imanol Losada over 4 years ago

Replace 'get_user_picture_path_by_id' with 'getUserPathById' calls when only directory is needed - refs #4507

Revision 7886ba95 (diff)
Added by Imanol Losada over 4 years ago

Fix gravatar big image url - refs #4507

Revision e6cbdcca (diff)
Added by Imanol Losada over 4 years ago

Fix productions web path - refs #4507

Revision 8a863c6f
Added by Imanol Losada over 4 years ago

Solve merge conflict - refs #4507

Revision 263a68cb (diff)
Added by Yannick Warnier over 4 years ago

Minor - improve phpdoc - refs #4507

History

#1

Updated by Yannick Warnier over 7 years ago

  • Target version set to 1.9.2
#2

Updated by Yannick Warnier over 7 years ago

  • Target version changed from 1.9.2 to 2.0
#3

Updated by Yannick Warnier almost 5 years ago

  • Category set to Users/Groups
  • Target version changed from 2.0 to 1.10.0

Correction: this is dead-easy to implement: just hash (MD5) the e-mail and request: http://www.gravatar.com/avatar/HASH (or https://...) and you receive the image in return. You can thus directly use that URL inside an "src" attribute for an image, for example only if a local image is not available.

The example in the link provided by Julio could be added "as is" in usermanager.lib.php, with default value maybe slightly different ("g" rating is good, but the type of image (mm, monster, etc) should be possible to change through config.

To include this in 1.9.12, define a new configuration param in main/install/configuration.dist.php called

// Enable Gravatar profile image if no local image has been given
$_configuration['gravatar_enabled'] = true;
// If Gravatar is enabled, tells which type of picture we want (default is "mm"). Options: mm | identicon | monsterid | wavatar
$_configuration['gravatar_type'] = 'mm';

I think we should not (in a first opportunity) load the image locally (given there is no way in the example to detect if a true image is returned or just a symbolic one), but only generate the link.

We should then hack the get_user_picture_path() (or another function if better) in a way that allows us to give a full web path in "src" for the image returned.

#4

Updated by Yannick Warnier almost 5 years ago

  • % Done changed from 0 to 10

Mmmm... the problem seem to be generated by Chamilo, though.

There are several places where the user image is generated:
  • usermanager::get_user_picture_path_by_id()
  • usermanager::get_picture_user()
  • main_api.lib.php::api_format_user()
  • probably others

So this is not as easy as expected. The replacing by a Gravatar call like ```return array('dir' => 'http://www.gravatar.com/avatar/', 'file' => md5(trim($user['email'])).'?s=96');``` works efficiently enough, though.

#5

Updated by Yannick Warnier almost 5 years ago

  • Status changed from New to Assigned
  • Assignee set to Imanol Losada
#6

Updated by Imanol Losada over 4 years ago

  • Assignee changed from Imanol Losada to Yannick Warnier
  • % Done changed from 10 to 70
#7

Updated by Imanol Losada over 4 years ago

Missing configuration parameters
PR: https://github.com/chamilo/chamilo-lms/pull/590

#8

Updated by Imanol Losada over 4 years ago

Reverted last commit and done it correctly
PR: https://github.com/chamilo/chamilo-lms/pull/592

#9

Updated by Imanol Losada over 4 years ago

Add Gravatar everywhere needed.
Add new 'getUserPathById' function.
PR: https://github.com/chamilo/chamilo-lms/pull/640

#10

Updated by Yannick Warnier over 4 years ago

  • Status changed from Assigned to Feature implemented
  • Assignee changed from Yannick Warnier to Imanol Losada
  • % Done changed from 70 to 100

Tested and approved. Good job!

#11

Updated by Julio Montoya over 4 years ago

Estos cambios de api_get_configuration_value('gravatar_enabled') deberian de existir solo en una función.
Dentro de UserManager::getUserPicture() o algo asi.

Actualmente están esparcidos por toda la plataforma.

Also available in: Atom PDF