Skip to content

Commit

Permalink
get profile view
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Stippel committed Jan 31, 2019
1 parent 05987c8 commit 1b2dbcf
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/collective/sidebar/browser/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def get_static_links(self):
def get_user_data(self):
# Set Defaults
user = get_user()
portal = api.portal.get()
portal_url = self.get_portal_url()
mtool = api.portal.get_tool('portal_membership')
dxtool = api.portal.get_tool('portal_types')
Expand All @@ -78,21 +79,22 @@ def get_user_data(self):
if custom_schema:
user_dx_iface = resolve(custom_schema)
avatar_fields = user_dx_iface.queryTaggedValue(AVATAR_KEY)
avatar_field = None
if avatar_fields:
for iface, field, active in avatar_fields:
if active:
images_view = api.content.get_view(
'images',
self.context,
self.request,
)
scale = images_view.scale(
user_dx_iface.get(field),
width=256,
height=256,
direction='down',
)
user_avatar = scale.url
avatar_field = avatar_fields[0][1]
if avatar_field:
user = api.content.find(
portal_type=mtool.memberarea_type,
context=portal.get(mtool.membersfolder_id),
id=user_info.get('username', ''),
)[0]
images_view = api.content.get_view(
'images', user, self.request
)
scale = images_view.scale(
avatar_field, width=256, height=256, direction='down'
)
user_avatar = scale.url
# Set User-Profile URL
user_url = '{0}/{1}/{2}'.format(
portal_url,
Expand Down

0 comments on commit 1b2dbcf

Please sign in to comment.