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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Saving images in members profil


3 Posts   361 Views


5 June 2013 at 9:43pm Community Member, 94 Posts

Hey guys,

I want to deposit images for members in the backend of SS3. Therefore I´ve tried to extend the member settings in "security".


class CustomMember extends DataExtension{
private static $many_many = array(
   'Images' => 'Image'

public function getCMSFields() {
      $this->extend('updateCMSFields', $fields);
      return $fields;

public function updateCMSFields(FieldList $fields) {
      $fields->push(new UploadField('Images', 'Profile Image'));

This part of the code works fine. I can save images and documents under a name of the member.
But know I´ve tried to list the images in frontend and get the error:
[Error] Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'HasManyList'


class MembersPage extends Page{
   public static $has_many = array(
      "CustomMembers" => "CustomMember"
   function getMembers(){
      $MemberSet = DataObject::get('Member');
      return $MemberSet;

<% control getMembers %>
<% end_control %>

How can I display the images in the frontend?
Thanks for help!


5 June 2013 at 10:53pm Community Member, 146 Posts


You need to loop through the list of images in the same way you loop through members. In your template try:

<% control getMembers %>
<% control $Images %>
<% end_control %>
<% end_control %>


6 June 2013 at 5:59pm Community Member, 94 Posts

This is it! Thanks!