• Resolved votony12

    (@votony12)


    Is it possible to have the profile picture load when the user clicks on the profile picture? Right now the page simply refreshes to same profile link. Clicking on any image that is uploaded will load the image in a lightbox and I’m looking for the same functionality when click on a profile picture. Any help is much appreciated. Thanks!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • @votony12

    You can try this code snippet.

    add_action( 'um_before_profile_main_meta', 'um_before_profile_main_meta_lightbox', 10, 1 );
    function um_before_profile_main_meta_lightbox( $args ) {
    
        if ( true === UM()->fields()->editing ) {
            return;
        }
    
        $html = ob_get_clean();
    
        $profile_photo = esc_url( UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/" . um_profile( 'profile_photo' ));
    
        $source      = 'href="' . esc_url( um_user_profile_url() ) . '" class="um-profile-photo-img"';
        $replacement = 'href="#" class="um-photo-modal um-profile-photo-img" data-src="' . $profile_photo . '"';
    
        $html = str_replace( $source, $replacement, $html );
    
        ob_start();
        echo  $html;
    }

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

    https://wordpress.org/plugins/code-snippets/

    • This reply was modified 1 year, 2 months ago by missveronica.
    • This reply was modified 1 year, 2 months ago by missveronica.
    Thread Starter votony12

    (@votony12)

    This worked beautifully. Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Profile Picture Link’ is closed to new replies.