How to install plugins in separate accounts?

4

I have:

  • an FTP server with CPanel running on WHMCS
  • three MySQL databases linked to different users
  • three WordPress accounts associated with the above databases

How to install a plugin separately, and connect the installation of this plugin to the three WordPress accounts?

I want to do this because I'm going to have a large project, and I need to be able to update the plugin

Someone provided me with this solution in Stack Overflow in English. however, I need to know if this moves the original files by deleting them, and if so, what command to copy the files, non-destructively

// Set WP_CONTENT_DIR to the full local path of this directory (no trailing slash), e.g.
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );
// Set WP_CONTENT_URL to the full URI of this directory (no trailing slash), e.g.
define( 'WP_CONTENT_URL', 'http://example/blog/wp-content');
// Set WP_PLUGIN_DIR to the full local path of this directory (no trailing slash), e.g.
define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );
// Set WP_PLUGIN_URL to the full URI of this directory (no trailing slash), e.g.
define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins');
// If you have compability issues with plugins Set PLUGINDIR to the full local path of this directory (no trailing slash), e.g.
define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );
    
asked by anonymous 21.09.2015 / 17:45

2 answers

3

One technique is to conditionally modify constants in wp-config.php . You can have a single WordPress file base with a single wp-config.php and serve multiple domains, each with its separate database.

define( 'DB_USER', 'user' );
define( 'DB_PASSWORD', 'pass' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8' );
define( 'DB_COLLATE', '' );

if ( $_SERVER['HTTP_HOST']=='www.example.com' ) {
    define( 'DB_NAME', 'www_db' );
    define( 'WP_CONTENT_DIR', '/com.example/wp-content/www' );
    define( 'WP_CONTENT_URL', 'http://www.example.com/wp-content/www');
} 
elseif ( $_SERVER['HTTP_HOST']=='sub.example.com' ) {
    define( 'DB_NAME', 'sub_db' );
    define( 'WP_CONTENT_DIR', '/com.example/wp-content/sub' );
    define( 'WP_CONTENT_URL', 'http://example.com/wp-content/sub');
}

define( 'WP_PLUGIN_DIR', '/com.example/wp-content/plugins' );
define( 'WP_PLUGIN_URL', 'http://www.example.com/wp-content/plugins');
define( 'WPMU_PLUGIN_DIR', '/com.example/wp-content/mu-plugins' );
define( 'WPMU_PLUGIN_URL', 'http://www.example.com/wp-content/mu-plugins');

This WPSE search is a good place to start investigate the topic.

Another option is to use the WordPress Multisite . The principle is the same, one installation, several sites, but when converting a normal site into Multisite, a super-admin panel appears and from there it is possible to create sub-sites and control which themes and plugins can use. Natively, you can only control the themes available for each site, but you can make a plugin to let plugins unique to some of the sub-sites . In this example, the important filter is all_plugins .

Managing a Multisite has its features that add another level of difficulty, in this tag wiki has some useful features .

In both options, plugin management should be done very carefully, it is easy to knock down multiple sites at once with a misspelling.

Regardless of the configuration you have chosen to install multiple WPs, super-managers who quotes Felipe are pretty good. In practice, I only know InfiniteWP and I really like it, but I know that ManageWP is pretty good.

    
22.09.2015 / 03:59
3

I find two ways to accomplish this. The first of these is automating the update of plugins when you have updates available. The configuration is done via filter , and can be limited to only a few plugins :

function auto_update_specific_plugins ( $update, $item ) {
    // Array of plugin slugs to always auto-update
    $plugins = array ( 
        'akismet',
        'buddypress',
    );
    if ( in_array( $item->slug, $plugins ) ) {
        return true; // Always update plugins in this array
    } else {
        return $update; // Else, use the normal API response to decide whether to update or not
    }
}
add_filter( 'auto_update_plugin', 'auto_update_specific_plugins', 10, 2 );

Here is the Codex documentation , which contains even more suggestions.

If you need to have an update control, I recommend using management services (all paid for):

Both solutions are very complete, and have features quite interesting.

    
21.09.2015 / 18:16