Skip to content
Browse files

BUG Fixing incorrect use of UploadField in ForumRole

  • Loading branch information...
1 parent d0e358d commit e689b1060c242fee8828dd9ca1e14f7f1018bd2e @halkyon halkyon committed Oct 11, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 code/ForumRole.php
View
9 code/ForumRole.php
@@ -154,8 +154,8 @@ function Link() {
function getForumFields($showIdentityURL = false, $addmode = false) {
$gravatarText = (DataObject::get_one("ForumHolder", "\"AllowGravatars\" = 1")) ? '<small>'. _t('ForumRole.CANGRAVATAR', 'If you use Gravatars then leave this blank') .'</small>' : "";
- $avatarField = new UploadField("Avatar", _t('ForumRole.AVATAR','Avatar Image') .' '. $gravatarText);
- $avatarField->allowedExtensions = array('jpg', 'gif', 'png');
+ $avatarField = new UploadField('Avatar', _t('ForumRole.AVATAR','Avatar Image') .' '. $gravatarText);
+ $avatarField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
$personalDetailsFields = new CompositeField(
new HeaderField("PersonalDetails", _t('ForumRole.PERSONAL','Personal Details')),
@@ -240,7 +240,10 @@ function updateCMSFields(FieldList $fields) {
$suspend = $fields->dataFieldByName('SuspendedUntil');
$suspend->setConfig('showcalendar', true);
if(Permission::checkMember($this->owner->ID, "ACCESS_FORUM")) {
- $fields->addFieldToTab('Root.Forum',new ImageField("Avatar", _t('ForumRole.UPLOADAVATAR', "Upload avatar")));
+ $avatarField = new UploadField('Avatar', _t('ForumRole.UPLOADAVATAR', 'Upload avatar'));
+ $avatarField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
+
+ $fields->addFieldToTab('Root.Forum', $avatarField);
$fields->addFieldToTab('Root.Forum',new DropdownField("ForumRank", _t('ForumRole.FORUMRANK', "User rating"), array(
"Community Member" => _t('ForumRole.COMMEMBER'),
"Administrator" => _t('ForumRole.ADMIN','Administrator'),

0 comments on commit e689b10

Please sign in to comment.
Something went wrong with that request. Please try again.