Hi
I have a Silverstripe forum at www.finnlevinsen.com, but we needed the forum to be a bit more secure. Basically we needed to aprove new members before giving them access to post and read in the forum. The solution was to ad an "approved" boolean value in the function extraDBFields() in ForumRole.php like this:
$fields = array(
'db' => array(
'ForumRank' => 'Varchar',
'Occupation' => 'Varchar',
'Company' => 'Varchar',
'City' => 'Varchar',
'Country' => 'Varchar',
'Nickname' => 'Varchar',
'FirstNamePublic' => 'Boolean',
'SurnamePublic' => 'Boolean',
'OccupationPublic' => 'Boolean',
'CompanyPublic' => 'Boolean',
'CityPublic' => 'Boolean',
'CountryPublic' => 'Boolean',
'EmailPublic' => 'Boolean',
'Aproved' => 'Boolean',
'LastViewed' => 'SSDatetime',
'Signature' => 'Text'
),
'has_one' => array(
'Avatar' => 'Image'
),
'belongs_many_many' => array(
'ModeratedForums' => 'Forum'
),
'defaults' => array(
'ForumRank' => _t('ForumRole.COMMEMBER','Community Member')
),
'searchable_fields' => array(
'Nickname' => true
),
'indexes' => array(
'Nickname' => true,
),
);
And then in SinglePost.ss do a <% if CurrentMember.Aproved %> around everything that needed to be "hidden" from none-approved users.
However, I'm not sure if this is best practise? Any opinions?
Joel