BuddyDev

Search

[Resolved] Fix avatar visibility problem Snippet NOT Working on Group Cover Images

  • Participant
    Level: Initiated
    Posts: 2
    Mwiinga on #7405

    Hello,
    I run into this “https://buddydev.com/snippets/tag/avatar/” code snippet that answered and resolved my days headaches.
    I was actually not the only one with this issue, so I have shared it on WordPress.org support, so as others learn of you as well.

    User Avatars are now visible across the network but, I noticed the ‘Group Covers Images’ are not visible across the network.
    Would you be able to help out?
    Many thanks..

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #7411

    Hi Mwiiga,
    is this problem relevant with current BuddyPress? Are you using BuddyPress in Multiblog mode?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 2
    Mwiinga on #7418

    Thank you for your timely write back, Brajesh.
    & yes I am in ‘Multiblog mode’.
    Profile Images, together with Profile Cover Images are visible on Child Site 1, also on Child Site 2 and also on Child Site 3.

    Group profile Images are visible on Child Site 1, and also on Child Site 2, plus Child Site 3 according to plan.
    But Group Cover Images are only visible on Child Site 1, where the actual group was created.

    When you are logged in as another normal user on Child Site 2, and you try visit a Group that was originally created & setup on Child Site 1, the Group Cover Image will NOT be visible. It’s only the Group profile image and group details that are carried along from Child Site 1..

  • Participant
    Level: Initiated
    Posts: 5
    Dollar on #10516

    I am experiencing the exact same issue as Mwiinga. Is there any progress on this fix?

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #10517

    Hi Dollar,
    Welcome to BuddyDev.

    You do have multiblog mode enabled?

  • Participant
    Level: Initiated
    Posts: 5
    Dollar on #10585

    Hi Brajesh,

    First, thank you for all that you do. I have learned so much from your work and from reading through various posts you have made.

    Yes, I am using buddypress in Multiblog mode (definately not Multi-Network). I have Buddypress installed at the root of my site. Like Mwiinga, your code updates the avatars on subsites and works perfectly so that the avatars for both profiles and groups show on the subsites. The only issue now is that Group cover images are only available on the site where they were created. We need a solution that works just like the avatar snippet at “https://buddydev.com/snippets/tag/avatar/” except we need the cover images to be uploaded to the root site and shared out to the subsites.

    Please let me know if you need any further details.

    -Dollar-

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #10586

    HI Dollor,
    Thank you for the kind words.

    I appreciate the details, Will look into it tomorrow and get back to you.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 5
    Dollar on #10613

    Hi Brajesh,

    I am just following up with you on the above request. I know you are a busy man and I am happy to compensate you for your time and effort to resolve this issue. Please let me know how best to proceed.

    -Dollar-

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #10617

    Hi Dollor,
    Please put this in your bp-custom.php and you should be good to go.

    
    
    /**
     * Fix cover upload for multisite, multiblog mode.
     * @param array $val not important to us.
     *
     * @return array
     */
    function buddydev_cover_upload_dir_fix( $val ) {
    
    	if ( ! is_main_site() && BP_ENABLE_MULTIBLOG ) {
    
    		switch_to_blog( SITE_ID_CURRENT_SITE );
    		$upload = wp_upload_dir();
    		restore_current_blog();
    		buddypress()->upload_dir = $upload;
    	}
    
    	return $val;
    }
    add_filter( 'bp_attachments_pre_cover_image_ajax_upload', 'buddydev_cover_upload_dir_fix' );
    
    

    It will only work for new cover uploads.

    Please do let me know if it works for you or not?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 5
    Dollar on #10634

    Hello Brajesh,

    Thanks for the update. Unfortunately, the group cover image still does not show on the subsite. The code itself seems to be ok because I was able to create a new group and upload both an avatar and group cover photo without an issue, but only the avatar shows up on the subsite thanks to your original code snippet. I tried updating an exiting group cover image as well as creating a brand new group and had the same results.

    All the best,
    -Dollar-

The topic ‘ [Resolved] Fix avatar visibility problem Snippet NOT Working on Group Cover Images’ is closed to new replies.

This topic is: resolved