WordPress.org

Ready to get started?Download WordPress

Forums

Connections Business Directory
[resolved] Using One Connections DB across an entire Multisite (4 posts)

  1. EPICWebDesign
    Member
    Posted 1 year ago #

    I know it's been asked before, how to use one connections DB across a multisite.

    I found a pretty good, though not ideal, way to do this today.

    On line 254 of connections.php Change

    $prefix = ( is_multisite() && CN_MULTISITE_ENABLED ) ? $wpdb->prefix : $wpdb->base_prefix;

    to

    $prefix = "wp_";

    This assumes two things.

    1. You change the prefix to match your first sites prefix. (wp_ in my case)
    2. You don't update Connections, or if you do, you make the same change.

    Presumably this could be built into connections as a dropdown that lists the prefix for all multisites to choose from. I know there's a blog ID, and name, not sure off hand if it's the same used in the prefixes or not.

    http://wordpress.org/extend/plugins/connections/

  2. shazahm1
    Member
    Plugin Author

    Posted 1 year ago #

    @ EPICWebDesign

    Instead, just add this to your wp-config.php file:

    define('CN_MULTISITE_ENABLED', FALSE);

    Connections will then use the same tables across the network. Essentially, what you're doing by hardcoding the prefix.

  3. EPICWebDesign
    Member
    Posted 1 year ago #

    Oh, that's easy enough.

    Is that documented somewhere? didn't see that when looking, and I thought you had specifically said it didn't work on a forum post.

  4. shazahm1
    Member
    Plugin Author

    Posted 1 year ago #

    @ EPICWebDesign

    This feature made its way in January or so ... so the forum post could have been older. Right now the only doc is in the code about 25 lines up from where you made your change.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic