Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 55 total)
  • Author
    Posts
  • MauroMauro
    Participant

    OK, that works, but I can't decide the order of the fields. Can live with it but would be nice to be able to put i.e. first name and last name above the email and password fields.

    One more thing, can I hide the password field and have WP generate one and send it in email with the welcome message?

    MauroMauro
    Participant

    Thanks for this Anh!
    The email as username flag works fine as far as I can tell.
    Unfortunately I still see duplicated fields in the form generated in the shortcode for the registration form.

    This is my shortcode:
    [mb_user_profile_register form_id="profile-form" id="registration-fields" id_username="email" id_password="password1" id_password2="password2" label_submit="Register" confirmation="Your account has been created successfully." email_as_username="true"]

    Am I doing something wrong?

    Here is my meta box setup for this:

    
    $meta_boxes[] = [
                'title'  => '',
                'id'     => 'registration-fields',
                'type'   => 'user', // NOTICE THIS
                'fields' => [
                    [
                        'id'   => 'first_name', // THIS
                        'name' => 'First Name',
                        'type' => 'text',
                    ],
                    [
                        'id'   => 'last_name', // THIS
                        'name' => 'Last Name',
                        'type' => 'text',
                    ],
                    [
                        'id'   => 'email', // THIS
                        'name' => 'E-Mail',
                        'type' => 'email',
                    ],
                    [
                        'id'   => 'password1', // THIS
                        'name' => 'Password',
                        'type' => 'password',
                    ],
                    [
                        'id'   => 'password2', // THIS
                        'name' => 'Confirm Password',
                        'type' => 'password',
                    ],
                    [
                        'id'   => 'gender', // THIS
                        'name' => 'Gender',
                        'type' => 'radio',
                        'options' => array('m'=>'M','f'=>'F'),
                    ],
                    [
                        'id'   => 'birthday', // THIS
                        'name' => 'Date of Birth',
                        'type' => 'date',
                        //'readonly' => true,
                        'js_options' => array(
                            'dateFormat'      => 'dd-M-yy',
                            'changeYear'      => true,
                            'yearRange'       => "1930:2010"
                        ),
                        'save_format' => 'Y-m-d',
                    ],
                    [
                        'id'   => 'country', // THIS
                        'name' => 'Country',
                        'type' => 'select_advanced',
                        'options' => $this->countries,
                    ],
                    [
                        'id'   => 'privacy', // THIS
                        'name' => 'Privacy Policy',
                        'type' => 'checkbox',
                        'desc' => 'I have read and agree to the <a href="/privacy" target="_blank" rel="noopener noreferrer">Privacy Policy</a>',
                        'required' => 'This field is required to complete registration',
                    ],
                ],
            ];
    
    MauroMauro
    Participant

    This is good news, but it still means you need to call it and hit the DB for each post rather then doing one DB query to get the posts and the meta you need together in one object.

    MauroMauro
    Participant

    Hi Anh, can you give me the js function to trigger the map update?
    It's probably a one liner?

    in reply to: Date fields allow to enter random numbers #17004
    MauroMauro
    Participant

    I had to disable this recently and reset readonly => false because it didn't show the calendar anymore. Not sure what broke this.

    MauroMauro
    Participant

    Hi Anh, did you have a chance to address these things?
    If so, how do I setup the form to hide the username?

    in reply to: [BUG] No Feedback Given if Address not Found! #14618
    MauroMauro
    Participant

    Oh I see... so the coordinates are updated based on the pin location!
    That was unclear, especially with the "find address" button in the mix.
    Perhaps read-only fields with latitude and longitude would make it more clear to the user that he can drag the pin to fine-tune the location.

    Thanks Anh! I'm loving developing with MetaBox.

    in reply to: [BUG] No Feedback Given if Address not Found! #14616
    MauroMauro
    Participant

    That's better!
    I'm still confused on one thing... why can I drag the pin around in the map?
    Won't the coordinates be taken from the autocomplete address field anyway?

    in reply to: [BUG] No Feedback Given if Address not Found! #14614
    MauroMauro
    Participant

    OK will try today!
    BTW, I'm working on a front-end implementation using Leaflet and I found it useful to include this JS library to avoid scrolling the map while scrolling the page: https://github.com/elmarquis/Leaflet.GestureHandling

    in reply to: [BUG] No Feedback Given if Address not Found! #14612
    MauroMauro
    Participant

    Thanks Anh!
    I'm currently using the MetaBox AIO plug-in on this project.
    I followed the link but it looks like it's the main MetaBox plug-in, not the Geolocation extension?
    Should I replace the main MetaBox plug-in with the one from the commit?

    in reply to: Open Street Maps in User Profile Front-End #14431
    MauroMauro
    Participant

    Oh forget it, my bad. I had an array enclosing location fields.

    in reply to: Open Street Maps in User Profile Front-End #14430
    MauroMauro
    Participant

    At a glance, it feels like MetaBox is not loading the necessary resources for the Geolocation fields within the user profile and in the front-end.

    MauroMauro
    Participant

    Hi Anh, will do.

    in reply to: Set meta value of custom user field programmatically #11290
    MauroMauro
    Participant

    I'm trying with update_user_meta, seams the logic option 🙂

    in reply to: add and use local avatar with user meta extension #11288
    MauroMauro
    Participant

    This is actually quite easy and will add the profile picture in your wp-admin profile screen.

    
    // Add User Profile Support
    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_user_meta_boxes' ));
    function your_prefix_register_user_meta_boxes( $meta_boxes ) {
            $meta_boxes[] = array (
                'title' => 'Profile Picture',
                'id' => 'profile_picture',
                'fields' => array(
                    
                    array (
                        'id' => 'custom_avatar',
                        'type' => 'single_image',
                        'name' => 'Upload Avatar',
                    ),
                ),
                'type' => 'user',
            );
            return $meta_boxes;
        }
    

    To get the avatar URL use:

    
    
    // Check if MetaBox is available
    if (function_exists('rwmb_meta')) {
      // Get the attachment object
      $avatar = rwmb_meta( 'custom_avatar', array( 'object_type' => 'user' ), $user_id );
    
    // Check if the user has a custom avatar, get the URL
      if ($avatar) $avatar_url = $avatar['url']; // this will get the 150x150 sized avatar
    
    // If no avatar is set, use your own custom one
      else $avatar_url = site_url().'path/to/your/default/avatar.jpg';
    }
    
Viewing 15 posts - 16 through 30 (of 55 total)