• Resolved chelminski

    (@chelminski)


    Hi ??
    Please add the ability to define a custom user profile photo URL. All my users have photos, but they exist on a different platform. I have configured wordpress to automatically use these images, but it doesn’t work with your plugin.

    Solution 1:
    Let you configure the path to your photos with a variable:
    https://example.com/media/photo/{user_displayname}.png

    Solution 2:
    Let your plugin use WordPress image links. I don’t use Gravatar, just a custom plugin. In the settings, in the user list, and in other plugins, I see correct user profile photos. In the case of your plugin, users have profiles without photos.

    I would like to add that the option to update profile photos is disabled for users because they manage their account on another service. I would like to ask you to positively consider my proposal. It is very important to me.

Viewing 5 replies - 1 through 5 (of 5 total)
  • missveronica

    (@missveronicatv)

    @chelminski

    Solution 1:

    You can try this code snippet and change the $external_url to your domain.

    add_action( 'um_before_profile_main_meta', 'um_custom_user_profile_photo_url', 10, 1 );
    
    function um_custom_user_profile_photo_url( $args ) {
    
        $external_url = 'https://example.com/media/photo/{user_displayname}.png';
    
        $html = str_replace( um_get_default_avatar_uri(),
                                str_replace( '{user_displayname}',
                                              um_user( 'display_name' ),
                                              $external_url ),
                             ob_get_clean() );
        ob_start();
        echo $html;
    }

    Install by adding the code snippet to your active theme’s functions.php file
    or use the “Code Snippets” Plugin

    https://www.ads-software.com/plugins/code-snippets/

    missveronica

    (@missveronicatv)

    @chelminski

    For UM Members Directory you also need this code snippet.

    add_filter( 'um_ajax_get_members_data', 'um_ajax_custom_user_profile_photo_url', 10, 3 );
    
    function um_ajax_custom_user_profile_photo_url( $data_array, $user_id, $directory_data ) {
    
        $external_url = 'https://example.com/media/photo/{user_displayname}.png';
    
        $data_array['avatar'] = str_replace( um_get_default_avatar_uri(),
                                                str_replace( '{user_displayname}',
                                                            um_user( 'display_name' ),
                                                            $external_url ),
                                             $data_array['avatar'] );
        return $data_array;
    }
    Thread Starter chelminski

    (@chelminski)

    Thx. It’s working!

    missveronica

    (@missveronicatv)

    @chelminski

    Add also this code line to the code snippets
    for a profile picture in the User Account page.

    add_action( 'um_before_form', 'um_custom_user_profile_photo_url', 10, 1 );

    Thread Starter chelminski

    (@chelminski)

    Thx u so much <3

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Profile picture’ is closed to new replies.