Jump to:

1016 Posts in 567 Topics by 309 members

Forum Module

SilverStripe Forums » Forum Module » Approval of new members in forum – is this best-Silverstripe-practise?

Discuss the Forum Module.

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

Page: 1
Go to End
Author Topic: 1056 Views
  • joelg
    Avatar
    Community Member
    129 Posts

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

    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

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Approval of new members in forum – is this best-Silverstripe-practise? Link to this post

    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

    1056 Views
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.