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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

small tweak for the forum module


Go to End


1023 Views

Avatar
lekoala

Community Member, 31 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.