Custom fields in registration page

Home Forums Feature Requests Custom fields in registration page

Tagged: 

This topic contains 10 replies, has 6 voices, and was last updated by  Vincent Mimoun-Prat 1 month, 1 week ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #13542

    Emiliano Pennino
    Participant

    I need add extra field in account Detalis page for example phone number, addresses, etc.
    Is it possible?
    How can I do this?

    #13543

    Hi,

    You can use the ACF Integration add-on (see also related documentation)

    Have a nice day!

    Please, write a review on wordpress.org ๐Ÿ˜‰

    #13552

    Emiliano Pennino
    Participant

    Tnx for our help I use this add-on.
    But I need also that this fields is also in registration form.. i buyed also ACF Authentication forms add-on but fileds are not visible in Registration Form.

    #13578

    Correct, currently ACF does not allow us to print those fields in the registration page unfortunatly. We’ll log this as a feature request but I can’t tell when this will be available though as the next release is already packed with lots of requests and bug fixes.

    You can follow: https://github.com/marvinlabs/customer-area/issues/149

    Have a nice day!

    Please, write a review on wordpress.org ๐Ÿ˜‰

    #13588

    Emiliano Pennino
    Participant

    OK, there are any workaround for do this.
    I need to see details of account (ACF do this) but i need insert details in registration forms.
    It’s possible that a field in edits page are not editable as username?
    I use other 3rd plug-ins but is not integrated with details of Customer Area.
    Do you know any other plug-ins or how to workaround my problem?

    #13687

    Hi,

    currently I don’t know any workaround, but most plugins which allow to add input fields on the registration form and save them as user meta should be working.

    Have a nice day!

    Please, write a review on wordpress.org ๐Ÿ˜‰

    #14361

    Thomas Lartaud
    Keymaster

    Hi,

    According to our code, we have some hook and filters that allow you to customize your forms with a bit of extra codes. If you have some coding knowledge, it could be a great start to help you customize your forms. Try to add this to the bottom of your functions.php theme file.

    <?php
    
    /* ------------------------------------------------------------------------------ */
    
    /**
     * New Class to create a select input type field for CUAR
     *
     */
    
    if( class_exists('CUAR_AbstractFieldRenderer')):
    
        class CustomDisplayNameFieldRenderer extends CUAR_AbstractFieldRenderer implements CUAR_FieldRenderer {
    
            public function __construct( $label, $readonly = false, $inline_help='' ) {
            $this->readonly = $readonly;
            $this->initialize($label, $inline_help);
            }
    
            public function get_type() {
            return 'custom_select-text';
            }
    
            protected function get_readonly_field_value( $id, $value ) {
            return $value;
            }
    
            protected function get_form_field_input( $id, $value ) {
            if (!$this->readonly ) {
            global $current_user;
            get_currentuserinfo();
    
            wp_enqueue_script('user-profile');
            wp_enqueue_script('password-strength-meter');
    
            $out = '';
            $out .= '<select name="' . $id .'" id="' . $id .'" class="form-control">'."\n";
                $public_display = array();
                $public_display['display_nickname']  = $current_user->nickname;
                $public_display['display_username']  = $current_user->user_login;
    
                if ( ! empty( $current_user->first_name ) )
                $public_display['display_firstname'] = $current_user->first_name;
    
                if ( ! empty( $current_user->last_name ) )
                $public_display['display_lastname'] = $current_user->last_name;
    
                if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ) {
                $public_display['display_firstlast'] = $current_user->first_name . ' ' . $current_user->last_name;
                $public_display['display_lastfirst'] = $current_user->last_name . ' ' . $current_user->first_name;
                }
    
                if ( ! in_array( $current_user->display_name, $public_display ) )// Only add this if it isn't duplicated elsewhere
                $public_display = array( 'display_displayname' => $current_user->display_name ) + $public_display;
    
                $public_display = array_map( 'trim', $public_display );
                $public_display = array_unique( $public_display );
    
                foreach ( $public_display as $id => $item ) {
                $out .= '<option ' . selected( $current_user->display_name, $item, false ) . '>' . $item . '</option>'."\n";
                }
                $out .= '</select>'."\n";
            return $out;
            } else {
            return sprintf( '<input type="%5$s" id="%1$s" name="%2$s" value="%3$s" class="%4$s" %6$s/>',
            $id,
            $id,
            esc_attr( $value ),
            'form-control',
            esc_attr( $this->input_type ),
            ($this->readonly ? 'disabled' : '')
            );
            }
            }
    
            protected $readonly = false;
        }
    
    endif;
    
    /* ------------------------------------------------------------------------------ */
    
    /**
     * New CUAR Add-On to create 'display name' select field
     *
     */
    
    if( class_exists('CUAR_SimpleField')):
    
        class CustomDisplayNameField extends CUAR_SimpleField {
    
            public function __construct( $id, $storage, $args ) {
                parent::__construct( $id, $storage, $args );
    
                $this->set_renderer( new CustomDisplayNameFieldRenderer(
                $this->get_arg( 'label' ),
                $this->get_arg( 'readonly' ),
                $this->get_arg( 'inline_help' )
                ) );
    
            }
    
            // See CUAR_Field
            public function get_type( $is_for_display ) {
                return $is_for_display ? __( 'Text', 'cuar' ) : 'text';
            }
    
            protected function get_default_args() {
                return array_merge( parent::get_default_args(), array(
                    'inline_help' 		=> '',
                    'readonly' 			=> false,
                    'type'	 			=> 'custom_select-text',
                    'required' 			=> false
                ) );
            }
        }
    
    endif;
    
    /* ------------------------------------------------------------------------------ */
    
    /**
     * New CUAR Customisation to output a new profile
     *
     */
    
    if( class_exists( 'CUAR_Plugin' )):
    
        class CustomCustomerAreaProfile {
    
            public function __construct(){}
    
            public function init()
            {
    
                // Customize User Profile
                add_filter('cuar/core/user-profile/get_profile_fields', array( &$this, 'new_defaults_profile_fields' ) );
    
            }
    
            /**
             * New defaults users fields
             *
             * @param		$default_fields | array | the default fields set by customerarea plugin
             * @return		array
             *
             */
            public function new_defaults_profile_fields($default_fields){
                $new_default_fields = array(
                    'account_details'	=> new CUAR_HeaderField( 'account_details', array(
                        'label'			=> __( 'Account details', 'ThemeTranslations' ),
                        'wrapper'		=> 'legend'
                    ) ),
                    'user_login' 		=> new CUAR_TextField( 'user_login', new CUAR_UserStorage(), array(
                        'label'			=> __( 'Username', 'ThemeTranslations' ),
                        'readonly'		=> true,
                        'inline_help'	=> __( 'Your username cannot be changed.', 'ThemeTranslations' ),
                        'required'		=> true,
                    ) ),
                    'user_email' 		=> new CUAR_EmailField( 'user_email', new CUAR_UserStorage(), array(
                        'label'			=> __( 'Primary email', 'ThemeTranslations' ),
                        'required'		=> true,
                    ) ),
                    'user_pass' 		=> new CUAR_UserPasswordField( 'user_pass', array(
                        'label'					=> __( 'Password', 'ThemeTranslations' ),
                        'confirm_label'			=> __( 'Password (confirm)', 'ThemeTranslations' ),
                        'confirm_inline_help'	=> __( '<div class="example-label r"><div id="pass-strength-result">'.'Strength indicator'.'</div></div>The password must at least be composed of 5 characters. You will be requested to login again after '
                            . 'your password gets changed. Leave these fields empty if you want to keep your current password', 'ThemeTranslations' ),
                        'min_length'			=> 5,
                    ) ),
                    'about_you'	=> new CUAR_HeaderField( 'about_you', array(
                        'label'			=> __( 'About you', 'ThemeTranslations' ),
                        'wrapper'		=> 'legend'
                    ) ),
                    'first_name' 		=> new CUAR_TextField( 'first_name', new CUAR_UserStorage(), array(
                        'label'			=> __( 'First name', 'ThemeTranslations' )
                    ) ),
                    'last_name' 		=> new CUAR_TextField( 'last_name', new CUAR_UserStorage(), array(
                        'label'			=> __( 'Last name', 'ThemeTranslations' )
                    ) ),
                    'nickname' 		=> new CUAR_TextField( 'nickname', new CUAR_UserStorage(), array(
                        'label'			=> __( 'Nickname', 'ThemeTranslations' )
                    ) ),
                    'display_name' 		=> new CustomDisplayNameField( 'display_name', new CUAR_UserStorage(), array(
                        'label'			=> __( 'Display name', 'ThemeTranslations' )
                    ) ),
                    'url' 		=> new CUAR_TextField( 'url', new CUAR_UserStorage(), array(
                        'label'			=> __( 'Personal Website', 'ThemeTranslations' )
                    ) ),
                    'description' 		=> new CUAR_TextField( 'description', new CUAR_UserStorage(), array(
                        'label'			=> __( 'Biography', 'ThemeTranslations' ),
                        'inline_help'	=> __( 'Your can write a short description about you.', 'ThemeTranslations' ),
                        'type'			=> 'long-text'
                    ) )
                );
                return $new_default_fields;
            }
    
        }
    
        $CustomCustomerAreaProfile = new CustomCustomerAreaProfile;
        $CustomCustomerAreaProfile->init();
    
    endif; // End of if( !class_exists( 'CUAR_Plugin' ))

    Of course, this is an example and this should be adapted to fit your needs.
    Hope that helps,
    Regards.

    #60875

    debdstripe
    Participant

    Hello! I added a new post to this forum on this topic. Thomas, really hoping for your feedback on the new topic.

    #261112

    joseagrc
    Participant

    Hi,

    You can use the Cimy User Extra Fields works perfectly without other plugin or add-on

    regards!.

    #562270

    Markus Ernst
    Participant

    Hi,
    so is it with the ACT Integration Add-On now possible to add additional field to the registration form?

    Thanks!

    #562850

    Hi

    Yes, it is possible since we are compatible with ACF 5

    Have a nice day!

    Please, write a review on wordpress.org ๐Ÿ˜‰

    1 user thanked author for this post.
Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.