Jump to:

1036 Posts in 810 Topics by 315 members

Forum Module

SilverStripe Forums » Forum Module » Adding and Removing Forum Profile Fields

Discuss the Forum Module.

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

Page: 1
Go to End
Author Topic: 1546 Views
  • gracie101
    Community Member
    2 Posts

    Adding and Removing Forum Profile Fields Link to this post

    New to SS and testing out the Forum module. What is the best way to hide/remove fields from the default forum registration profile page?

    For example, I don't need a field for "occupation" or "website", but I do need a field for "product name". Thanks in advance.

  • craigm
    Community Member
    9 Posts

    Re: Adding and Removing Forum Profile Fields Link to this post

    old thread i know, but i just figured this out myself. so hopefully if anyone still hasn't figured this out yet, here's how to do it:

    Theres 2 parts to adding a new field, adding the actual form field itself and then passing the fields input through to the database to be stored.

    open the file: webroot/forum/code/ForumRole.php

    In this file, go to the function 'getForumFields'. This is the one that creates the forum fields for the registration form. Firstly, comment out the ones that you dont want to be there. Then find the type of form field you want from the default ones and copy and paste it to a new line eg:

    new TextField("database_column", _t('ForumRole.CUSTOMFIELD','form_label_name')),

    replace 'database_column' and 'form_label_name' appropriately.

    Then the next thing that you need to do is catch the data from the form and add it to the database.

    In the same file, go back up to the 'extraStatics' function and add in a new array item to the nested 'db' array in the $fields array eg:

    'database_column' => 'Varchar',

    make sure that the database_column name is the same as you used in the getForumFields function and that you've specified the right data type.

    Once you've saved this file, make sure that you run the database build string and the new field will get automatically added into the database:


    and bobs your uncle.

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.