1010 Posts in 534 Topics by 307 members
|Go to End|
30 June 2009 at 8:42pm
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.
8 March 2010 at 4:33pm Last edited: 8 March 2010 4:45pm
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.
|Go to Top|