• RL86

    (@rlijkendijk86)


    Hi!

    First of all great work on this plugin :-).

    I was wondering if it is possible to add an “Upload profile image” field to the registration form. A lot of users don’t seem to upload an profile image after creating an account, and I find the default “no profile image icons” kinda boring ;-).
    I hope more users will upload an image when it is part of the registration process.

    I know you can add an upload image field to the registration form, but what data should I enter so the system knows the upload image should be the profile image?

    Thanks for helping me out!

Viewing 15 replies - 1 through 15 (of 28 total)
  • I’m looking to implement this!

    Any help much appreciated!

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @rlijkendijk86,

    Unfortunately, this is not possible in the current version of the plugin, however, this is something we want to add in the future updates.

    Alternatively, you can use our Profile completeness extension and force users to upload a profile pictures.

    Regards.

    /**
    * Ultimate Member – Customization
    * Description: Allow everyone to upload profile and cover photos on front-end pages.
    */
    add_filter(“um_user_pre_updating_files_array”,”um_custom_user_pre_updating_files_array”, 10, 1);
    function um_custom_user_pre_updating_files_array( $arr_files ){

    if( is_array( $arr_files ) ){
    foreach( $arr_files as $key => $details ){
    if( $key == “userphoto” ){
    unset( $arr_files[ $key ] );
    $arr_files[ “profile_photo” ] = $details;
    }
    }
    }

    return $arr_files;
    }

    add_filter(“um_allow_frontend_image_uploads”,”um_custom_allow_frontend_image_uploads”,10, 3);
    function um_custom_allow_frontend_image_uploads( $allowed, $user_id, $key ){

    if( $key == “profile_photo” ){
    return true;
    }

    return $allowed; // false
    }

    —————————————————————–

    1) Copy the above code in your theme’s function.php file. Should be in public_html/wp-content/themes/your-themes-name/function.php
    2) In ultimate member add ‘upload image’ field in registration form.
    3) Enter meta key as ‘userphoto’ (i.e same as in the code above)
    4) Profit.

    credits @champsupertramp on github for the code.

    I just tested this but it doesnt work. The photo is stored but is not shown as the profile image.

    Got it, the code should go in the main functions file in public_html/wp-includes/functions.php

    artur82, did you get his code to work. I have tried in mydomain/wp-includes/funcions.php and mydomain/wp-contents/themes/mythemeused/function.php and i does not update the profile picture, but the picture is stored in the database.

    Thanks

    I’ve added the supplied code to my function.php file, however the user profile photo isnt being updated. Anyone have any other ideas?

    romankac

    (@romankacerek)

    UPDATED PHP CODE: corrected quotes from “” to ”

    • This reply was modified 7 years ago by romankac.
    romankac

    (@romankacerek)

    [SOLVED]

    Add this code to public_html/wp-content/themes/your-theme-name/function.php

    /**
    * Ultimate Member – Customization
    * Description: Allow everyone to upload profile and cover photos on front-end pages.
    */
    add_filter('um_user_pre_updating_files_array','um_custom_user_pre_updating_files_array', 10, 1);
    function um_custom_user_pre_updating_files_array( $arr_files ){
    
    if( is_array( $arr_files ) ){
    foreach( $arr_files as $key => $details ){
    if( $key == 'userphoto' ){
    unset( $arr_files[ $key ] );
    $arr_files[ 'profile_photo' ] = $details;
    }
    }
    }
    
    return $arr_files;
    }
    
    add_filter('um_allow_frontend_image_uploads','um_custom_allow_frontend_image_uploads',10, 3);
    function um_custom_allow_frontend_image_uploads( $allowed, $user_id, $key ){
    
    if( $key == 'profile_photo' ){
    return true;
    }
    
    return $allowed; // false
    }
    • This reply was modified 7 years ago by romankac.
    Internet

    (@httpscard)

    @romankacerek @deadlinkd

    Not work ?? the user profile photo isn’t being updated.The photo is not shown as the profile image. ??

    • This reply was modified 7 years ago by Internet.
    romankac

    (@romankacerek)

    @httpscard are you added the code to function.php in THEME folder? wp-content/themes/your-theme-name/function.php

    It’s working for me on https://www.darujkouseksebe.cz

    Internet

    (@httpscard)

    @romankac I have tried in mydomain/wp-includes/funcions.php and in THEME folder? wp-content/themes/your-theme-name/function.php and it does not update the profile picture:(

    romankac

    (@romankacerek)

    @httpscard add the code to wp-content/themes/your-theme-name/function.php

    And set the meta key name of upload input to: “userphoto” (without quotes)

    This worked for me. I changed the function.php file in my current theme folder, then I created a field with meta name userphoto, and it updated the profile picture upon registration.

    Thanks Romankac, Thanks jlsouthwick, This worked fine for me

    • This reply was modified 6 years, 9 months ago by queeneve.
Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Registration form customization: Upload profile image’ is closed to new replies.