Softaculous


Topic : Custom Plugin


Posted By: kepler on February 7, 2020, 6:19 am
Good morning
I'm trying to make an automatic Wordpress installation with Blesta, and I don't have any problems. However, I also am trying to install at the same time a custom plugin (not from the repository). I made a mods.php with a xml file, and in a normal cPanel WP install, the plugin appears as option and everything is fine at the install. But in the Blesta softaculous module no. How do I copy (unzip) the plugin to the correct dir after the WPress installation? What must I add to the code? Any help is apreciated.
Best regards
Kepler

Posted By: Brijesh on February 7, 2020, 8:08 am | Post: 1
Hi,

At the moment it is not possible to pass addtional parameters in Blesta module. We will add it in future versions.

However you can make minor change in your mods.php file in the __post_mod_install() function. Where you must be checking if not empty $__settings then unzip the files e.g. :
if(!empty($__settings['smart-maintenance-mode']))

There you can add a OR condition to check if you get "autoinstall" parameter in GET that will be when you auto install a script via Blesta e.g. :
if(!empty($__settings['smart-maintenance-mode']) || !empty($_GET['autoinstall']))

Let us know if this does not work for you.

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool

Posted By: kepler on February 7, 2020, 8:26 am | Post: 2
Good morning
Thank you very much for the tip - it worked :)
The plugin, was, however, not activated (but at least it was installed). It's a question of activating it manually in the Plugins area.
Can it be pre activated?
Best regards
Kepler

Posted By: Brijesh on February 7, 2020, 9:42 am | Post: 3
Hi,

Glad to know it works.

In order to activate a plugin you need to execute an UPDATE query in the database.

Here is an example of the same :
PHP Code

 $__settings['active_plugins'] = array();
    
// First get the active plugin list
$query "SELECT option_value FROM ".$__settings['dbprefix']."options WHERE option_name = 'active_plugins';";
$result sdb_query($query$__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
    
$__settings['active_plugins'] = _unserialize($result[0]['option_value']);
$__settings['active_plugins'][] = 'smart-maintenance-mode/smart-maintenance-mode.php';
$__settings['active_plugins'] = serialize($__settings['active_plugins']);
$query "UPDATE ".$__settings['dbprefix']."options
            SET option_value = '"
.$__settings['active_plugins']."'
            WHERE option_name = 'active_plugins';"
;
$result sdb_query($query$__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']); 



-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool

Posted By: kepler on February 7, 2020, 10:17 am | Post: 4
Hi again,
Well....perfect. It installs and activates the plugin perfectly, without any error or warning.
Thank you very much for your kindness and help.
Best regards
Kepler

Posted By: Brijesh on February 7, 2020, 10:45 am | Post: 5
Hi,

Glad to know it works !!

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool

Powered By AEF 1.0.8 © 2007-2008 Electron Inc.