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.

Forum Module /

Discuss the Forum Module.

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

Approval of new members in forum – is this best-Silverstripe-practise?


Go to End
Reply


2 Posts   1271 Views

Avatar
joelg

Community Member, 132 Posts

18 April 2009 at 8:08pm

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

Avatar
Willr

Forum Moderator, 5521 Posts

19 April 2009 at 5:42pm

Rather then edit the core files in the forum module - which makes upgrading the module later on more complex you could also try and use dataobjectdecorators to 'decorate' the member object from your own code (rather then adding it to that list) http://doc.silverstripe.com/doku.php?id=dataobjectdecorator