BuddyDev

Search

[Resolved] How To Display User Avatar In List Gallery

  • Participant
    Level: Initiated
    Posts: 1
    artzam on #13826

    Hi @sbrajesh,

    Great plugin..i like it.

    Can u help me, how to show user avatar in list gallery like this
    –> https://4.bp.blogspot.com/-NM2RYN1zBK0/WqiJ0Qm8HxI/AAAAAAAApsU/e4necKtdrGQqNmfAw3VjxaQ64XhH-1gmgCLcBGAs/s1600/user-galerry.jpg

    Sorry, my english not very good. Hope u understand

    Thanks.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #13827

    Hello Artzam,

    Thank you for posting. Try the following code in your ‘bp-custom.php’ file. Please let me know it is works or not

    
    function buddydev_show_user_avatar() {
    
    	$gallery = mpp_get_gallery();
    
    	$user_permalink = bp_core_get_user_domain( $gallery->user_id, true );
    
    	?>
    		<a href="<?php echo $user_permalink; ?>">
    			<?php echo bp_core_fetch_avatar( array(
    					'item_id' => $gallery->user_id,
    					'object'  => 'user',
    					'type'    => 'thumb',
    					'html'    => true,
    					'width'   => 30,
    				) );
    			?>
    		</a>
    
    	<?php
    
    }
    add_action( 'mpp_before_gallery_title', 'buddydev_show_user_avatar' );
    

    Thank you
    Ravi

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #13838

    Hi @artzam ,
    Welcome to BuddyDev.

    The code @ravisharma shared is one way to do it, the other way will be to copy the gallery-loop.php in the child theme and modifying it.

    Please let me know if you want to use the previous approach or need assistance with overriding in theme.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    artzam on #13846

    Thanks @ravisharma for the code. Yeah! it work..

    Thanks for the feedback @sbrajesh sorry but where i could found gallery-loop.php. I only found ‘class-mpp-admin-edit-gallery-panel.php’ and ‘class-mpp-admin-gallery-list-helper.php’..

    TQ
    Artzam

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #13852

    Hi Artzam,
    Glad that @ravisharma ‘s code worked.

    For template based modification, you can get it from plugins/mediapress/templates/default/gallery/loop-gallery.php and copy to

    Yourtheme/mediapress/default/gallery/loop-gallery.php

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved