WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Using One Connections DB across an entire Multisite

[Resolved] Using One Connections DB across an entire Multisite

  • EPICWebDesign
    Member

    @epicwebdesign

    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author shazahm1
    Participant

    @shazahm1hotmailcom

    @ 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.

    EPICWebDesign
    Member

    @epicwebdesign

    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.

    Plugin Author shazahm1
    Participant

    @shazahm1hotmailcom

    @ 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Using One Connections DB across an entire Multisite’ is closed to new replies.