Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » small tweak for the forum module

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 727 Views
  • lekoala
    Avatar
    Community Member
    30 Posts

    small tweak for the forum module Link to this post

    Hi,

    When trying to understand how to make custom members, I've discovered this in the code of the forum module...

    --- line 72 > 87 of ForumRole.php ---
       function FirstNamePublic() {
          return $this->owner->FirstNamePublic || Permission::check('ADMIN');
       }
       function SurnamePublic() {
          return $this->owner->SurnamePublic || Permission::check('ADMIN');
       }
       function OccupationPublic() {
          return $this->owner->OccupationPublic || Permission::check('ADMIN');
       }
    ...
    ---

    Well, it seems to me that it would be much simpler if we simply had :

       function isPublic($field) {
          $prop = $field.'Public' ;
          return $this->owner->$prop || Permission::check('ADMIN') ;
       }

    and changing in the template "ForumMemberProfile_Show" any <% if Control 'Tag'Public %> occurrence by <% if Control isPublic(Tag) %>

    by doing this, it gets easier to extend if it needs to have more custom fields.

    727 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.