938 Posts in 271 Topics by 291 members
Forum Module
SilverStripe Forums » Forum Module » Approval of new members in forum – is this best-Silverstripe-practise?
Discuss the Forum Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 958 Views |
-
Approval of new members in forum – is this best-Silverstripe-practise?

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
-
Re: Approval of new members in forum – is this best-Silverstripe-practise?

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
| 958 Views | ||
|
Page:
1
|
Go to Top |


