• Is there any way to have the photos replicate across all of the blogs within a network?

    Basically when a user signs up at any one of the blogs in my WP Multisite network, they are registered across all of them. The problem I’m having is that User Photo uploads images under the blog directory that the user updates his profile in, even though the user only has one. So I need a way to place the image in the other blogs within the network.

    Any ideas?

Viewing 2 replies - 16 through 17 (of 17 total)
  • After reviewing the code again I noticed the switch_to_blog() call takes quite a lot of time to process. Reading in the WPMU Codex there’s a warning not to use this function in front-end. On the regular Codex page there’s no warning though.

    I think this problem needs a different solution to my approach above.

    I had to modify this plugin for Multisite too but I think my needs were a little different. I wanted all the userphotos in the base directory instead of worrying about the author’s primary blog.

    I made two functions to get the base upload directory and the base upload url in a multisite environment –

    function userphoto_get_multisite_upload_dir() {
        return WP_CONTENT_DIR . '/uploads';
    }
    
    function userphoto_get_multisite_upload_url() {
        global $table_prefix, $wpdb;
    
        $base_opt_table = $wpdb->base_prefix . 'options';
        $site_url = $wpdb->get_var("SELECT option_value FROM $base_opt_table WHERE option_name = 'siteurl'");
        $upload_path = $wpdb->get_var("SELECT option_value FROM $base_opt_table WHERE option_name = 'upload_path'"); 
    
        return $site_url . '/' . $upload_path;
    }

    And then plugged that into the appropriate spots in the user-photo.php file.
    Here’s a gist of the modified user-photo.php if anybody needs to do the same thing: https://gist.github.com/1443952

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘[Plugin: User Photo] Replicate photo across multisite blogs’ is closed to new replies.