Skip to:
Content
Pages
Categories
Search
Top
Bottom

Avatar across multisite


  • Coach Afrane
    Participant

    @coach-afrane

    I have been yearning for the feature where it is able to use one avatar for users across all sites in multisite.

    Hope that can be done.

    Please help.

    Thanks.

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

  • deadlinkd
    Participant

    @deadlinkd

    hi,

    Been trying to set this up for a few days now, but no success. I’ve setup a multi-site network with sub-directories and buddypress network activated.
    I’ve added define( ‘BP_ENABLE_MULTIBLOG’, true ); to config.php as recommanded for BP multisite install.

    Main site: mydomain.com
    subsite: mydomain.com/subsite

    When users upload their profile picture on main site, unfortunately it doesn’t sync with their profile when they go on the subsite.

    The following codes have worked for some people but not for me. Still trying to find a solution.

    function bpdev_fix_avatar_dir_path( $path ){
    if ( is_multisite() && BP_ENABLE_MULTIBLOG )
    $path = ABSPATH . ‘wp-content/uploads/’;
    return $path;
    }
    add_filter( ‘bp_core_avatar_upload_path’, ‘bpdev_fix_avatar_dir_path’, 1 );
    //fix the upload dir url
    function bpdev_fix_avatar_dir_url( $url ){
    if ( is_multisite() )
    $url = network_home_url(‘/wp-content/uploads’) ;
    return $url;
    }
    add_filter( ‘bp_core_avatar_url’, ‘bpdev_fix_avatar_dir_url’, 1 );


    Peter Hardy-vanDoorn
    Participant

    @petervandoorn

    I know it’s not quite what you’re looking for, but you could always just disable profile uploading in Buddypress’ settings and encourage your users to set up a Gravatar account.


    deadlinkd
    Participant

    @deadlinkd

    Thought about that solution too but i do not want my users to create 2 accounts just to sign up on my site.


    bulld_digital
    Participant

    @eskamediawork

    I have the same issue and wishes. I tried the code you provided above but it did not work.


    deadlinkd
    Participant

    @deadlinkd

    Finally found a solution.
    1) add define( ‘BP_ENABLE_MULTIBLOG’, true ) in wp-content/config.php
    2) network activate buddypress
    3) install rmiweb-multisite-avatar. It is a custom plugin for rmi.one website not available on wordpress repository. Can’t remember from where i grabbed it but i’ve uploaded it on my uptobox account => http://uptobox.com/543ii9u4ozoh
    4) At first it wasn’t working for me on my subsite because the theme (skywarriorthemes.com/arcane/) had an issue with displaying avatar. But i’ve tried it with other 3rd party themes and wordpress default twenty seventeen and it works like a charm. So make sure that your theme is not creating some conflict too like mine did.
    5) If you want to completely disable gravatar: https://wordpress.org/plugins/disable-user-gravatar/
    6) Profit.

    Hope that helps.


    bulld_digital
    Participant

    @eskamediawork

    that worked! Livesaver!


    deadlinkd
    Participant

    @deadlinkd

    Nice. Happy i could help!


    Coach Afrane
    Participant

    @coach-afrane

    Thanks for the responses.

    I have tried your steps @deadlinkd, but unfortunately it didn’t work for me.


    Coach Afrane
    Participant

    @coach-afrane

    I found a simple solution.

    After activating multisite I installed and network activated BuddyPress.
    I also added this line to wp-config.php: define ( ‘BP_ROOT_BLOG’, 2 )

    It works perfect, just the way i wanted it.

    Thanks, you all.


    Michael Stein
    Participant

    @mstein340

    This works for me, althouh it took me a bit before I realized BP_ROOT_BLOG was not defined.
    In my case, when I checked, it was ID 1, so I defined it accordingly.

    ?>
    <?php
    //echo get_current_blog_id();

    //echo ABSPATH . “<BR>”;
    //echo get_site_url() . “<BR>”;
    if ( !defined( ‘BP_ROOT_BLOG’ ))
    define( ‘BP_ROOT_BLOG’, 1);

    // echo “There is no root blog defined “;
    // echo get_blog_option( 3, ‘siteurl’ ) . “wtf”;
    /* This fixes the Multisite avatar problem */
    function nfm_bp_avtar_upload_path_correct($path){
    if ( bp_core_is_multisite() ){
    $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, ‘upload_path’ );
    }
    return $path;
    }
    add_filter(‘bp_core_avatar_upload_path’, ‘nfm_bp_avtar_upload_path_correct’, 1);
    function nfm_bp_avatar_upload_url_correct($url){
    if ( bp_core_is_multisite() ){
    $url = get_blog_option( BP_ROOT_BLOG, ‘siteurl’ ) . “/wp-content/uploads”;

    }

    return $url;
    }
    add_filter(‘bp_core_avatar_url’, ‘nfm_bp_avatar_upload_url_correct’, 1);
    ?>

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Skip to toolbar