Skip to:
Content
Pages
Categories
Search
Top
Bottom

problem with avatar in multisite


  • jaimebaron
    Participant

    @jaimebaron

    Hi,

    I have an issue with my multisite (beuptocity.com and beuptocity.com/maps). The themes are lynk and listopia.

    They are two separated sites and when users upload a profile picture in the 1st blog, the second one avatar is not updated (logically as pictures are store in different folders). I have checked this forum and tried several posible solutions but none have worked. I dont want to use gravatar.

    Can you help me and give me some possible solutions? Coding or with a plugin, every idea will help.

    Thank you in advance and regards,
    Jaime

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

  • Prashant Singh
    Participant

    @prashantvatsh


    jaimebaron
    Participant

    @jaimebaron

    Hi,

    I already checked this post but it didn’t work for me. Do you have any other recommendation for me to try?

    Thank you and regards


    Prashant Singh
    Participant

    @prashantvatsh

    Have you enabled multi-blog and also defined root blog?

    One more solution you can try define( 'BP_AVATAR_URL', '/wp-content/uploads/sites/site_id' );

    In place of ‘site_id’ please write your main site id from where you want to fetch the avatar.

    Thanks


    jaimebaron
    Participant

    @jaimebaron

    I just did the define url, and when I do this the main site avatar works fine but the secondary picture link is broken (it seems it doesn’t find a path and it shows nothing…)

    We are getting close, but still nothing.

    Thanks for the help


    Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    If you can once confirm that you have tried everything asked here https://buddypress.org/support/topic/avatar-across-multisite/

    Like you have enabled multiblog using define( 'BP_ENABLE_MULTIBLOG', true ) in wp-config.php then tried this code

    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 );

    Thanks


    jaimebaron
    Participant

    @jaimebaron

    I just tried the code and when i enter into beuptocity.com the result is:

    Fatal error: Uncaught Error: Call to undefined function add_filter() in /home/beuptoci/public_html/wp-config.php:101 Stack trace: #0 /home/beuptoci/public_html/wp-load.php(37): require_once() #1 /home/beuptoci/public_html/wp-blog-header.php(13): require_once(‘/home/beuptoci/…’) #2 /home/beuptoci/public_html/index.php(17): require(‘/home/beuptoci/…’) #3 {main} thrown in /home/beuptoci/public_html/wp-config.php on line 101


    Prashant Singh
    Participant

    @prashantvatsh

    Oh no! you have pasted the code in the wp-config.php file.

    This code needs to be pasted in your child theme’s functions.php otherwise you can create the bp-custom.php file in the plugins folder and then have to paste the code there.

    Else, you can install the plugin https://wordpress.org/plugins/code-snippets/ and can paste the code there.

    Thanks


    jaimebaron
    Participant

    @jaimebaron

    haha oh thanks, I just pasted the code in the functions.php (I tried just pasting in the child theme file and in both the parent and child themes files) but nothing happens…I tested and uploaded again a new picture but is not updated in the second theme.

    I’m missing something…or the code doesn’t work in my site…


    Prashant Singh
    Participant

    @prashantvatsh

    Please write this line define ( 'BP_ROOT_BLOG', 1 ); just after define( 'BP_ENABLE_MULTIBLOG', true ); in wp-config.php file.

    If I am correct, your root blog id is 1.

    Thanks


    jaimebaron
    Participant

    @jaimebaron

    Yes the principal is 1. I already tried that some days ago as it was in the post…the side effect is that my users are redirected to the settings is the theme one and I lost the settings functionalities of theme 2 (see maps favorites, and other specific stuff)…

    Sorry for bothering you so much…but this is tricky

    Thanks again!


    Prashant Singh
    Participant

    @prashantvatsh

    Not a problem 🙂 I am here to help you sir.

    Ok so let’s check it from starting. Please let me know the steps you have performed till this time like whatever changes you have done for avatar fixes mention theme here.

    Thanks


    keshabee
    Participant

    @keshabee

    Hi @prashantvatsh,
    Thanks for the pointing out on ways how to use that code but,
    1) I wanted to ask if there is a way to also do that for the cover image. As mi cover images are not shown on the sub sites when i have the buddy-press multi blog added.

    2)And Is there a way to find the meta keys and code “add filter” to use fix othyer areas of images or media options that are not being displaysed.
    Reason being:
    I noticed that the multi blog uses the fields setting the as global, so if one changes the a field from any of the site. that chanege is done immediately on all.
    But noticed that for uploads, this does not work because of uploads are done my media and seted to various directory .
    So i noticed if i upload the cover image on one site the other sites still does not display that change same as other uploads setting I make use of in the buddypress.

    Question: can you please help me with a code that could be used to fix the area for cover image and if possible how to find meta keys and guides to not when setting it up

    Thank you very much.


    keshabee
    Participant

    @keshabee

    Hi @prashantvatsh,
    I noticed the code only fixes that of the bp-profile reasons being that the avatars found on post,comments are not displaying when i added the multiblog


    Prashant Singh
    Participant

    @prashantvatsh

    Can you please share any screencast explaining the problem?

    Thanks


    keshabee
    Participant

    @keshabee

    Hi @prashantvatsh,
    I noticed when i used the code it fixed the buddypress avatar images only on the bp-profiles of the multisite.
    As the biography in the author biography of the single-post,page and comments on various users are still broken
    Please can you assist me, is there a way this can be fixed.

    Here are screen shots;
    https://postimg.cc/2q4GBg8H
    https://postimg.cc/FkfJ0JV9
    https://postimg.cc/LYPpf9gc
    https://postimg.cc/8s1GsSP0


    Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    These images must be coming from user avatar, can you please check if they are there in the dashboard.

    Thanks


    keshabee
    Participant

    @keshabee

    Hi @prashantvatsh
    Thanks for pointing me to the right direction, I noticed the break in the image was caused by this code I made use of;

    Please can you assist me in a way to debug and fix this code a little
    Reasons being:
    The code helps to disable the gravatar use in buddy-press avatar and cover-image while also removing that gravatar text wordings when editing the avatar and cover image

    
    /*Disable gravatar*/
    add_filter('bp_core_fetch_avatar_no_grav', '__return_true');
    
    /*Disable gravatar extra function*/
    function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {
    
        $default = get_stylesheet_directory_uri() .'/_inc/images/bp_default_avatar.jpg';
    
        if( $image && strpos( $image, "gravatar.com" ) ){ 
    
            return '<img src="' . $default . '" alt="avatar" class="avatar" ' . $html_width . $html_height . ' />';
        } else {
            return $image;
    
        }
    
    }
    add_filter('bp_core_fetch_avatar', 'bp_remove_gravatar', 1, 9 );
    
    function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {
    
        $default = get_stylesheet_directory_uri() .'/_inc/images/bp_default_avatar.jpg';
        return "<img alt='{$alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
    }
    
    add_filter('get_avatar', 'remove_gravatar', 1, 5);
    
    function bp_remove_signup_gravatar ($image) {
    
        $default = get_stylesheet_directory_uri() .'/_inc/images/bp_default_avatar.jpg';
    
        if( $image && strpos( $image, "gravatar.com" ) ){ 
    
            return '<img src="' . $default . '" alt="avatar" class="avatar" width="150" height="150" />';
        } else {
            return $image;
        }
    
    }
    add_filter('bp_get_signup_avatar', 'bp_remove_signup_gravatar', 1, 1 );

    Thanks in advance

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