Jump to:

1035 Posts in 810 Topics by 315 members

Forum Module

SilverStripe Forums » Forum Module » addMembershipFields error

Discuss the Forum Module.

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

Page: 1
Go to End
Author Topic: 1479 Views
  • iadawn
    Avatar
    Community Member
    13 Posts

    addMembershipFields error Link to this post

    hi there,

    I am using the nestedurls branch and Forum 0.2 rc 2 and have the following issue:

    Notice: MemberTableField::addMembershipFields() is deprecated. Please implement updateSummaryFields() on a Member decorator instead. in .../cms/code/MemberTableField.php on line 70

    Any thoughts on how to address this?

    Thanks

    Kevin

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: addMembershipFields error Link to this post

    You've got two options. Either;

    1.) Remove the call to addMembershipFields() in your code completely. This will stop the notice from appearing again.

    2.) Remove the call to addMembershipFields() AND create a new file called MyMemberDecorator.php (or something that makes more sense) in the mysite/code directory. Create a function called updateSummaryFields($fields) where $fields (an array of field names) is passed in by reference and you can add more/remove existing fields which directly affects the table columns in the Security section of the CMS.

    More information on this can be found here: http://doc.silverstripe.com/doku.php?id=dataobjectdecorator

    Sean

  • iadawn
    Avatar
    Community Member
    13 Posts

    Re: addMembershipFields error Link to this post

    Thanks for the response Sean.

    This issue is actually within the Forum module. Do you know if this is likely to be associated with nestedurls branch or is this something that needs to be generally addressed?

    Kevin

  • iadawn
    Avatar
    Community Member
    13 Posts

    Re: addMembershipFields error Link to this post

    Hi Sean,

    Actually, I have had a look in Trac and found this ticket: http://open.silverstripe.com/ticket/3543

    I would like to get this working as I could really do with both nestedurls and forums. I tried adding an updateSummaryFields into ForumRole but this didn't seem to be doing anything. Trouble is I can't seem to find out where and when updateSummaryFields is being called when I do a /dev/build.

    Any thoughts or pointers would be useful,

    Thanks

    Kevin

  • iadawn
    Avatar
    Community Member
    13 Posts

    Re: addMembershipFields error Link to this post

    Ok, I have Forum installed and with the benefit of not having not had to do much coding.

    What I did:

    1. I removed the lines in forum/_config.php that called addMembershipFields

    2. I added the following into forum/ForumRole.php, into the $fields array in the extraDBFields function:

       'summary_fields' => array(
    "Nickname" => "Nickname",
    "Occupation" => "Occupation",
    "Country" => "Country",
    "ForumRank" => "ForumRank"
       ),

    That covers the code changes, however, this did not get forum installed for me.

    On removing the call to addMembershipFields the /dev/build progressed a little bit further but still bombed out. It was throwing and undefined index error on ForumRank at line 378 of Database.php. On looking at this I found my problem.

    I had added forum into an already existing instance of SilverStripe so the Member table existed. I have not gone into this in detail but I am guessing that $this->fieldList provides a list of the current state of the table in the database. But ForumRank is not in the *current* Member table so the index was not found.

    So the final steps to get this installed for me was:

    3. Backup the content of the Member table

    4. Drop the Member table

    5. Call /dev/buil?flush=1

    6. Restore the content from the backed up Member table

    I am not sure if this is a bug or is working as intended. I am sure that is is irritating and I would love someone to point me in the direction of some instructions as to how to overcome this problem without the headache.

    Cheers

    Kevin

  • iadawn
    Avatar
    Community Member
    13 Posts

    Re: addMembershipFields error Link to this post

    Not sure if this is related, but when I checked if I could edit the entries I received this message:

    Fatal error: Call to a member function scaffoldFormField() on a non-object in /Users/kevin/Sites/MAPP/sapphire/forms/FormScaffolder.php on line 84

    A quick check in the code lead me to buildCastingHelperCache in sapphire/core/ViewableData.php. In there a builder is created for all the fields within a class. The problem was the line:

    220: $fields = eval("return {$componentClass}::\$db;");

    If the data object has been extended then this will not return the full list of fields associated with the class. I changed this to:

    $fields = Object::get_static( $componentClass, 'db' );

    And all was well. Not sure but I think the latter is a bit cleaner?

    Again, not sure how this all relates to just getting the forum working or if I have gone in completely the wrong direction. Bottom line for me is... it works.

    Would love some feedback on this.

    Thanks

    Kevin

    1479 Views
Page: 1
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.