Topic : Assign Custom fields to Specific Scripts WHMCS Auto Install

Posted By: sitedartweb on August 24, 2019, 3:47 pm

I plan to have multiple scripts for wordpress installs with specific plugins. Each script will need a custom field just for that script. Is that possible?

Script 1: Wordpress with Woocommerce will require a field for business name.
Script 2: Wordpress with Invoicing will have its own custom field for owner name.

So, I assume I need to make adjustments in install.xml first? Is it possible to create a new variable within install.xml, or will adjustments need to be made in install.php as well?

Thank you

Posted By: Brijesh on August 26, 2019, 6:27 am | Post: 1

I would not suggest to make changes in install.xml directly as that file will be overwritten when a new version of that scripts is available. You can refer to the following guide on how to add plugins to WordPress :

You will have to add the fields in XML file but that will just display the field on install form, if you would like to use the value posted by users in that field you will need to make changes in __post_mod_install() function in mods.php

Once this is done you will need to make changes in your WHMCS to ask the fields as per the product chosen.

I assume you will create separate products for each script i.e. separate product for WordPress with WooCommerce, another product for WordPress with Invoicing. So while configuring these products you can make changes to "Custom Fields" and create the fields as per your requirement.

SitePad Website Builder
Follow us on Twitter

Posted By: sitedartweb on August 26, 2019, 3:52 pm | Post: 2
OK...I see where you were going. We are planning to have these items pre-installed as a single package. But, this could be the alternative...

I will review this...

But, is there a list of all the SQL variables we can use? For example things like [[site_name]], [[admin_email]], etc?

Thank you

Posted By: Brijesh on August 27, 2019, 1:17 pm | Post: 3

You can use all the fields that exist in install.xml of a script in [[]], e.g. [[admin_username]], [[admin_email]]

Also there are few other keys that can be used, basically any keys that exist in $__settings array can be used. You can use the post_install filter to log the $__settings array in a log file and check all the keys :

SitePad Website Builder
Follow us on Twitter

Posted By: sitedartweb on August 29, 2019, 8:10 pm | Post: 4
Ok....well, I have further issues with the WHMCS auto installer.

I have worked on setting up my custom fields, but recently the auto installer is not installing anything unless I force it in _extra.php

I have a few images, so they will be uploaded across multiple post (as it seems I can only add 3 images here).

Here is an explanation of what I am doing...

1. I have a script called SMB
2. I want to change the global field name "Script" to "Design Name"
3. I Edit the _extra.php file and add this line
$GLOBALS['softaculous_conf']['fields']['Script'] = 'Design Name';
4. Added new script in _extra
GLOBALS['add_softaculous_scripts'] = array(
            10001 => array('name' => 'SMB',
5. Edited WHMCS custom fields and replaced Script field with Design Name

Debug says "Empty" for the Design Name field

Hard to explain, so why I am including images to show exactly what I have done...

NOTE: At this point, the only way I can get anything to install...specifically SMB... is by adding the line...

$GLOBALS['softaculous_conf']['custom_fields']['Script'] = 'SMB';

And of course, that limits me to the one script.

Anyways...images explain it better what I am doing...

Why is auto installation not working?

Posted By: sitedartweb on August 29, 2019, 8:13 pm | Post: 5

As noted, the script only works if I force it in _extra.php. Debug only states "Softaculous : Script name was not posted"...Which as you can see, it is.

Posted By: Brijesh on August 31, 2019, 12:41 pm | Post: 6

Can you please open a support ticket with access to your WHMCS installation so that we can check this for you :

SitePad Website Builder
Follow us on Twitter

Powered By AEF 1.0.8 © 2007-2008 Electron Inc.