cdli / CdliUserProfile

THIS MODULE IS DEPRICATED - USE LdcUserProfile INSTEAD
16 stars 11 forks source link

Additional Fields not showing #10

Open aaronweatherall opened 11 years ago

aaronweatherall commented 11 years ago

Hi, plugin works great, however I've used the methods stated in the zfcUser wiki to add additional fields to the validation and registration form. I've added these fields into the userProfile config file in the autoloader, but they're not pulling them? Any ideas?

adamlundrigan commented 11 years ago

Could you provide snippets showing how you're adding these new fields to both ZfcUser and CdliUserProfile?

Danny-P commented 11 years ago

Hi,

I have the same Problem. What will I have to do, to show custom fields, which I have added to ZfcUser. Unfortunantelle I can't find any documentation about what to do in this module. I added them to ZfcUser in Module Bootstrap by the following code.

protected function extendUserRegisterForm (\Zend\EventManager\EventManager $eventManager) {
    // custom fields of registration form (ZfcUser)
    $sharedEvents = $eventManager->getSharedManager();
    $sharedEvents->attach('ZfcUser\Form\Register',
            'init',
            function($e)
            {
                /* @var $form \ZfcUser\Form\Register */
                $form = $e->getTarget();

                $form->add(
                        array(
                                'name' => 'firstname',
                                'type' => 'text',
                                'options' => array(
                                        'label' => 'First name',
                                ),
                        )
                );

                $form->add(
                        array(
                                'name' => 'lastname',
                                'type' => 'text',
                                'options' => array(
                                        'label' => 'Last name',
                                ),
                        )
                );
            }
    );

    // Validators for custom fields
    $sharedEvents->attach('ZfcUser\Form\RegisterFilter',
            'init',
            function($e)
            {
                /* @var $form \ZfcUser\Form\RegisterFilter */
                $filter = $e->getTarget();

                // Custom field firstname
                $filter->add(array(
                                    'name'       => 'firstname',
                                    'required'   => true,
                                    'filters'  => array(
                                            array('name' => 'StripTags'),
                                            array('name' => 'StringTrim'),
                                    ),
                                    'validators' => array(
                                            array(
                                                    'name'    => 'StringLength',
                                                    'options' => array(
                                                            'min' => 3,
                                                            'max' => 255,
                                                    ),
                                            ),
                                    ),
                                )
                );

                // Custom field lastname                    
                $filter->add(array(
                                    'name'      => 'lastname',
                                    'required'  => true,
                                    'filters'  => array(
                                            array('name' => 'StripTags'),
                                            array('name' => 'StringTrim'),
                                    ),
                                    'validators' => array(
                                            array(
                                                    'name'    => 'StringLength',
                                                    'options' => array(
                                                            'min' => 3,
                                                            'max' => 255,
                                                    ),
                                            ),
                                    ),
                        )
                );
            }
    );
lukeocodes commented 10 years ago

It would be interesting to know if this will ever be fixed.