Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Member Profiles - Adding an avatar field

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 2374 Views
  • SamTheJarvis
    Avatar
    Community Member
    24 Posts

    Member Profiles - Adding an avatar field Link to this post

    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.

  • gvelasquez85
    Avatar
    Community Member
    11 Posts

    Re: Member Profiles - Adding an avatar field Link to this post

    +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?

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: Member Profiles - Adding an avatar field Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Member Profiles - Adding an avatar field Link to this post

    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

  • SamTheJarvis
    Avatar
    Community Member
    24 Posts

    Re: Member Profiles - Adding an avatar field Link to this post

    You are a bit of a boss UC.

    Thanks!

  • Mauro74
    Avatar
    Community Member
    30 Posts

    Re: Member Profiles - Adding an avatar field Link to this post

    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>

  • Mauro74
    Avatar
    Community Member
    30 Posts

    Re: Member Profiles - Adding an avatar field Link to this post

    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

  • merrick_sd
    Avatar
    Community Member
    94 Posts

    Re: Member Profiles - Adding an avatar field Link to this post

    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.

    2374 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.