• Resolved tridentmarketing

    (@tridentmarketing)


    Hi guys,

    I’ve got a site, on registration people signup and upload their company logo (in to a custom field called company_logo) they can also upload it as their avatar if they want.

    On the members director, I need to check to see if there is an image set as the avatar and if there isnt then use the company logo field instead.

    The code on the members-grid.php file is

    if ( $profile_photo ) { ?>
    						<div class="um-member-photo radius-<?php echo esc_attr( UM()->options()->get( 'profile_photocorner' ) ); ?>">
    							<a href="<code>user.profile_url</code>" title="<# if ( user.display_name ) { #><code>user.display_name</code><# } #>">
    								<code>user.avatar</code>
    								<?php do_action( 'um_members_in_profile_photo_tmpl', $args ); ?>
    							</a>
    						</div>
    					<?php } ?>

    on the profile page I have managed to get it to work – by specifying this:

    	$company_logo = get_the_author_meta('profile_photo',$profile_id);
    	$um_company_logo = um_user('company_logo');

    and then this

    
    <code>if(empty($company_logo)) { ?></code>
    
    but I cannot work out how to do the same thing on the members-grid.php page...
    
    <div class="um-profile-photo" data-user_id="<?php echo $profile_id; ?>" style="height: 190px;">
    			<img src="https://funeralsuppliers.uk/wp-content/uploads/ultimatemember/<?php echo $profile_id . "/" . $um_company_logo; ?>" class="gravatar avatar avatar-190 um-avatar um-avatar-uploaded" style="vertical-align:middle;" width="190" height="190" alt="<?php echo $company_name; ?>" />
    		</div>
    
    <?php } else { ?>
    		<div class="um-profile-photo" data-user_id="<?php echo $profile_id; ?>">
    			<img src="https://funeralsuppliers.uk/wp-content/uploads/ultimatemember/<?php echo $profile_id . "/" . $company_logo; ?>" class="gravatar avatar avatar-190 um-avatar um-avatar-uploaded" width="190" height="190" alt="<?php echo $company_name; ?>" />
    		</div>
    <?php } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @tridentmarketing

    Please try this filter hook to filter the avatar image url:

    add_filter( 'um_user_avatar_url_filter', function( $url, $user_id, $data ){
        
        // write your codes here
    
    return $url;
        
    },999,3 );
    Plugin Support andrewshu

    (@andrewshu)

    Hi @tridentmarketing

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. 🙂

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘replace user avatar with company logo’ is closed to new replies.