By default, the module contains 3 options to point you to Multiple Accounts. If you want to perform other actions, such as blocking the account, you can program your own actions.

To do this, create a file under the path /modules/addons/detectmultiaccounts/actions/ and create 2 functions in it:

  • detectmultiaccounts_$filename_config
  • detectmultiaccounts_$filename_run

For example, if your file is named blockuser.php, then your functions are named:

  • detectmultiaccounts_blockuser_config
  • detectmultiaccounts_blockuser_run

Function: config

The config function defines the options at the module configuration page, where you can enable or disable the action. Return an array with following informations:

KeyValueNote
namestringYour option name
descriptionstringOption description
typetext/yesno/dropdown/radio/textareaTypes defines how you select the values
optionsOption arrayOnly required for type radio/dropdown
sizeintegerSize of the text field, if type is text
defaultdefault valueConfigures the default value of the option

Example:

function detectmultiaccounts_blockuser_config () {
    return array (  'name' => 'Create Admin Ticket', 
                    'description' => 'Enter a client id via which you want to create the ticket notifications', 
                    'type' => 'text', 
                    'size' => '5'
                 );
}

If you have done everything right, the defined values are included at the module configuration page and you can enable / disable your own actions.

Function: run

The run function is the function, which get executed if you have enabled the action in the module configuration. It takes 2 arrays as argument:

  • $params: All informations about the client
  • $moduleSettings: Module settings, language strings

Use logActivity (json_encode($params)) and logActivity (json_encode($moduleSettings)) to see the exact content of these variables.

Example:

function detectmultiaccounts_blockuser_run ($params, $moduleSettings) {
    // your code which you want to execute
}
  • No labels