We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

User photo sign-up? | Forum

Topic location: Forum home » Support » General Questions
Marcus
Marcus Nov 29 '14
How to make "User photo" optional not required?
ross Team
ross Dec 1 '14
In the default software, you can do that in the admin panel here: www.yoursite.com/admin/settings/user in the Registration section: Avatar upload: set to Display. 


Users reported a bug two years ago that this functional does not work, we have fixed it and now it appears again. 


We have passed it to our developer again, I'll provide you with fix or workaround asap. 

ross Team
ross Dec 1 '14

Marcus, here's the fix. 


in /ow_system_plugins/base/controllers/join.php

on line 880


replace this: 

$displayPhotoUpload = OW::getConfig()->getValue('base', 'join_display_photo_upload');

        $avatarValidator = OW::getClassInstance("BASE_CLASS_AvatarFieldValidator", true);


        switch ( $displayPhotoUpload )

        {


with this: $displayPhotoUpload = OW::getConfig()->getValue('base', 'join_display_photo_upload');

        $avatarValidator = OW::getClassInstance("BASE_CLASS_AvatarFieldValidator", false);


        switch ( $displayPhotoUpload )

        {

Marcus
Marcus Dec 9 '14
I found a setting for that in ACP should I still use this patch?
ross Team
ross Dec 9 '14
What is ACP?
Marcus
Marcus Dec 11 '14
"Admin Control Panel" I mean there is a setting that says hide show and make required! Do I need to still this path?
ross Team
ross Dec 11 '14
Marcus if you want avatar to be not required, just set it to "display"
Carlos
Carlos Feb 25 '15
It's not correct, add the breaks on switch:

    protected function addLastStepQuestions($controller) {
       
        $displayPhoto = false;
        $displayPhotoUpload = OW::getConfig()->getValue('base', 'join_display_photo_upload');
        $avatarValidator = OW::getClassInstance("BASE_CLASS_AvatarFieldValidator", false);
       
        switch ($displayPhotoUpload) {
           
            case BOL_UserService::CONFIG_JOIN_DISPLAY_AND_SET_REQUIRED_PHOTO_UPLOAD:
                    $avatarValidator = OW::getClassInstance("BASE_CLASS_AvatarFieldValidator", true);
                    $userPhoto = OW::getClassInstance("BASE_CLASS_JoinUploadPhotoField", 'userPhoto');
                    $userPhoto->setLabel(OW::getLanguage()->text('base', 'questions_question_user_photo_label'));
                    $userPhoto->addValidator($avatarValidator);
                   
                    $this->addElement($userPhoto);
                    $displayPhoto = true;
                    break;
           
            case BOL_UserService::CONFIG_JOIN_DISPLAY_PHOTO_UPLOAD:
                    $userPhoto = OW::getClassInstance("BASE_CLASS_JoinUploadPhotoField", 'userPhoto');
                    $userPhoto->setLabel(OW::getLanguage()->text('base', 'questions_question_user_photo_label'));
                    $userPhoto->addValidator($avatarValidator);
                   
                    $this->addElement($userPhoto);
                    $displayPhoto = true;
                    break;
        }

        .......

this is the way to make work fine the 3 options on admin panel.

Cheers,
Musi.
The Forum post is edited by Carlos Feb 25 '15