How to install plugins in separate accounts?

Asked

Viewed 87 times

4

Have:

  • an FTP server with Cpanel running over WHMCS
  • three Mysql databases linked to different users
  • three Wordpress accounts associated with the above mentioned databases

How to install a plugin separately, and connect to the installation of the same plugin to three Wordpress accounts?

I want to do this because I have a large project ahead of me, and I need to be able to update in a single location the plugin, that I intend to connect with the various accounts, so to facilitate the updating of the

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 is the command to copy the files in a non-destructive way

// 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' );
  • Wouldn’t it be better to assemble all three in a mulsite environment? so a plugin activated on the network becomes available to everyone, and users receive access to the sites you determine. see here how to proceed

  • i know the Multisite. the point is that the goal is to make thousands of threads for different types of website. and it is not intended to be in one installation, for other issues related to system architecture.

  • Anyway, even as a network, I will have to create multiple iterations of my project, so creating a single installation does not solve the problem of plugin updates, which has to be done from a single location. still thank you :)

  • Hi, Tiago, you don’t need to mark your edition in the text, each post has a history that can be checked who edited what. I added comment markers to your code to make it easier to read, usually no one edits code in a question, but since that’s not the problem, I thought it made it easier to read.

2 answers

3

I find two ways to accomplish this. The first is by automating the plugins when updates are available. Configuration is performed via filter, and may even be limited to 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 we have the Codex documentation, which also contains more suggestions.

If it is necessary to have an update control, I recommend using management services (all paid):

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

  • thanks for the answer. does not solve my problem, for the following. I do not intend to have a wordpress manager; the update has to be done in a single installation of the plugin separately, which is made available automatically to all accounts of the service. If I have a million users, I can’t update them all separately, because that will generate a high volume of traffic. what I want is to have a single installation of the plugin, and be able to update it separately, so that it is available from a single location to all accounts

  • Got it. In case the update would not be by the Panel wordpress and yes directly via FTP. In that case really my answer does not help.

  • 2

    the transposition of the proposed algorithm may still be interesting, to automate the update of this plugin, if the update is made from a fourth wordpress account, which will make available the plugin the remaining three, which will then be replicated in thousands of wordpress accounts, from a script

  • @Tiagomoraismorgado makes sense. I will keep the answer because it can help if someone comes to research on the subject. But I’ll look into this model of yours.

  • Thank you so much for putting yourself in the shoes of other users. It’s always nice to see people who are kind and generous, with their kind attitude. capable of rethinking the solution of such a problem while maintaining an interest in safeguarding other users. continuation of a good day. good wishes of an excellent week

  • 1

    Felipe, it looks like you’re suggesting we put that code on wp-config.php...

  • You’re right, in fact it can even cause conflicts. It was to have shown the example in wp-config and through the filter. Edit as soon as possible.

Show 2 more comments

3


A technique is to modify conditionally 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 own 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 search in WPSE is a good place to start investigating the topic.


Another option is to use the Wordpress Multisite. The principle is the same, an installation, several websites, 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, it is only possible to control the themes available for each site, but it is possible to make a plugin to leave exclusive plugins for some of the sub-sites. In this example, the important filter is all_plugins.

Managing a Multisite has its particularities that add another level of difficulty, on this tag wiki has some useful resources.


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

Regardless of the configuration chosen to install multiple Wps, the super managers who quotes Felipe are very good. In practice, I only know Infinitewp and I like it very much, but I know that Managewp is very good.

  • okay. I will try the script they indicate, Play a little with the wordpress API, etc. basically, if I modify the wp-config for what the script tells me will take the folder indicated on the way, as directory of Contents, themes, etc? in the background what I want. attentively, with good wishes for a good autumn.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.