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.

Archive /

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

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

small tweak for the forum module


Reply


783 Views

Avatar
lekoala

Community Member, 30 Posts

18 April 2008 at 8:08pm

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.