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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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


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