Commits

Dominik Ruf  committed 12c38e9

add readme text

  • Participants
  • Parent commits 79188bd

Comments (0)

Files changed (3)

 Introduction
 ============
 
+You can use this product to show avatar pictures of your users from external sites, i.e. from gravatar.
 
+To do this you set a list of URLs where the avatars can be found. The default uses gravatar.
 
-This product may contain traces of nuts.
+http://www.gravatar.com/avatar/%(emailmd5hash)s?s=200&d=mm
+
+The %(emailmd5hash)s part can be replaced with %(fullname)s, %(home_page)s, %(username)s
+or any variable that is available from the MembershipTool.getMemberInfo() dictionary on your site.
+So another example would be
+
+http://my.site.com/%(username)/picture
+
+The product also tries to set the facebookid variable for the MembershipTool.getMemberInfo() dictionary.
+So, if plonesocial.auth.rpx is installed and the user uses facebook to login, you can also use
+
+https://graph.facebook.com/%(facebookid)s/picture

File collective/externalportrait/membership.py

 from controlpanel import IExternalPortraitSettings
 from md5 import md5
 from urllib2 import urlopen
+from Products.PlonePAS.tools.membership import MembershipTool
 
 class DummyImage():
     def __init__(self, absurl):
     Return 'harmless' Memberinfo of any member, such as Full name,
     Location, etc
     """
+    memberinfo = MembershipTool._orig_getMemberInfo(self, memberId)
+
+    if memberinfo is None:
+        return None
+    
     if not memberId:
         member = self.getAuthenticatedMember()
     else:
         member = self.getMemberById(memberId)
-
-    if member is None:
-        return None
-
-    memberinfo = { 'fullname'       : member.getProperty('fullname', ''),
-                   'description'    : member.getProperty('description', ''),
-                   'location'       : member.getProperty('location', ''),
-                   'language'       : member.getProperty('language', ''),
-                   'home_page'      : member.getProperty('home_page', ''),
-                   'username'       : member.getUserName(),
-                   'has_email'      : bool(member.getProperty('email', None)),
-                   'emailmd5hash'   : md5(str(member.getProperty('email', ''))).hexdigest(),
-                   'facebookid'     : member.getProperty('facebookid', ''),
-                 }
+    
+    memberinfo['emailmd5hash'] = md5(str(member.getProperty('email', ''))).hexdigest()
+    memberinfo['facebookid'] = member.getProperty('facebookid', '')
     
     rpx_identifier = member.getProperty('rpx_identifier', '')
     for rpx_id in rpx_identifier:
+python setup.py register sdist upload -r plone.org