Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Member Profiles - Adding an avatar field


Go to End


10 Posts   5343 Views

Avatar
SamTheJarvis

Community Member, 24 Posts

2 July 2011 at 10:59am

Hi, does anybody here use the member-profiles module by ajshort?

Has anybody tried adding an avatar upload field? I've tried a couple of things like using the Dataobject Decorator, to no avail.

Some light shed on this would be fab, thanks.

Avatar
gvelasquez85

Community Member, 11 Posts

12 July 2011 at 4:00pm

+1 I need something like that... and... has anybody idea on how to list all the users? or maybe the online users? or something like that?

Avatar
ajshort

Community Member, 244 Posts

12 July 2011 at 5:50pm

Have you tried adding a has_one link to an Image object in your extension/decorator? You may also need to use updateMemberFormFields() to replace the default field type with a SimpleImageField.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

13 July 2011 at 1:44am

class MemberDecorator extends DataObject Decorator {

function extraStatics() {
return array (
'has_one' => array('Avatar' => 'Image')
);
}

function updateCMSFields(&$fields) {
$fields->addFieldToTab("Root.Avatar", new ImageField('Avatar'));
}
}

_config

Object::add_extension("Member", "MemberDecorator");

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
SamTheJarvis

Community Member, 24 Posts

13 July 2011 at 2:14am

You are a bit of a boss UC.

Thanks!

Avatar
Mauro74

Community Member, 30 Posts

11 November 2011 at 12:08am

gvelasquez85 to see all the members simply go to: yoursite.com/my-member-profile-page/show

and if you need it a log out link would be <a href="Security/logout">log out</a>

Avatar
Mauro74

Community Member, 30 Posts

11 November 2011 at 3:25am

Edited: 11/11/2011 3:25am

I'm implementing the Members Profile module on my website and like you've had, I'm having some problems with the avatar.

I've seen the solution you suggested Uncle Cheese. I've implemented it no problem, I can upload the avatar when I edit a member in one of the security group in the CMS.

Now though, I have 2 problems:
1) I don't know how to show the avatar on the profile list and the profile of the single user. I've tried this in MemberProfileFieldsSection.ss but didn't work, nothing was returned:

<% if Avatar %>
          <% control Avatar %>$CroppedImage(70,70)<% end_control %>
<% end_if %>

2) when you create a new profile in the front end of the website you are able to upload an avatar from there, is it the same thing of uploading the avatar from the CMS? I'm bit confused!

Thanks a lot

Avatar
merrick_sd

Community Member, 99 Posts

15 December 2011 at 1:54am

yes i'd like to know that too.

Unclecheese code works , but that seems to only be if you want to manage in the CMS. Unless I'm missing something

I'd like to know how to allow registering and registered Members the ability to upload an Avatar.

I have MemberProfiles Module installed and have added MemberDecorator.php to mysite. (good idea keeping things separate)

I think i somehow need to add to the RegisterForm() without editing the actual MemebrProfile php files.

Go to Top