WordPress.org

Ready to get started?Download WordPress

Forums

Connections, WPMU, and Images (3 posts)

  1. finalcut
    Member
    Posted 2 years ago #

    I don't really know the best way to let you know but there is at least one compatibility issue with Connections and WPMU - that is the images aren't saved/loaded from the correct location and thus it doesn't really work as expected.

    We migrated from a single site instance of WP to a WPMU. As you know on a single site instance all content is stored in /wp-content/... So the images from connections are in /wp-content/connection_images

    However, that path system won't work with WPMU because each site within the WPMU install has it's own directory underneath wp-content where it's files are stored. For example:

    /wp-content/blogs.dir/1/files/connection_images

    Where 1 is the id of the site on the WPMU network.

    The problem here is that the code for Connections is setup to define a constant "CN_IMAGE_PATH" and "CN_IMAGE_BASE_URL" that simply use the WP_CONTENT directory like so:

    define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/connection_images/');

    since these are constance we can't really do something like:
    global $blog_id;
    define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . '/files/connection_images/');

    The same will hold true for custom templates for each site I imagine.

    Thus unless someone wants to modify the plugin to be smarter and identify if it is in a multi-user instance or a single site instance I don't think this can work completely with a WPMU install.

    Please correct me if I am wrong.

  2. finalcut
    Member
    Posted 2 years ago #

    Ok I've fixed the problems with images on a multisite install.

    in connections.php you need to change the loadConstants function lines 190-193 to be:

    if(is_multisite()){
    				define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . '/connection_images/');
    				define('CN_IMAGE_BASE_URL', network_site_url('/wp-content/blogs.dir/' . $blog_id . '/connection_images/'));
    			} else {
    				define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/connection_images/');
    				define('CN_IMAGE_BASE_URL', WP_CONTENT_URL . '/connection_images/');
    			}

    This will make sure if multi-site is on that the site is looking in the right place of images.

  3. finalcut
    Member
    Posted 2 years ago #

    also need to update a little further down where the custom template paths are defined as follows:

    if(is_multisite()){
    				define('CN_CUSTOM_TEMPLATE_PATH', WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . '/connections_templates');
    				define('CN_CUSTOM_TEMPLATE_URL', network_site_url('/wp-content/blogs.dir/' . $blog_id . '/connections_templates/'));
    			} else {
    				define('CN_CUSTOM_TEMPLATE_PATH', WP_CONTENT_DIR . '/connections_templates');
    				define('CN_CUSTOM_TEMPLATE_URL', WP_CONTENT_URL . '/connections_templates');
    			}

Topic Closed

This topic has been closed to new replies.

About this Topic