The OpenCrypt membership software offers a 'Custom Functions' feature which enables you to add your own Perl code to be run by OpenCrypt whenever an account is registered, updated, removed, renewed or expired. This enables you to integrate third-party software with OpenCrypt, or to extend the actions performed by OpenCrypt.
The file used to control this functionality in OpenCrypt is called 'custom_functions.pl', this is located in the /cgi-bin/oc/admin/includes directory.
Their are nine functions included in this file which are outlined below:
This function is run whenever an account is created. It is important to check an account is active if that is relevant to your process since the function isn't just run when an account is finally created.
This function is called with an array called @data containing the account details from the oc_users table. $data would be the username, $data the email address.
This function is called when an account is modified/updated. This function is called with the $username variable so you must check the oc_users and oc_user_data tables for the updated data as you require.
This function is called when an account is removed. This function is called with the $username variable.
This function is called when an account is expired. This function is called with the $username variable.
This function is called when an account is renewed. This function is called with the $username variable.
This function enables us to hide custom form fields. This function is called with the $field_id variable and returns the $hide_field variable. If $hide_field equals '1' then the field is hidden.
&custom_function_form_validation1, &custom_function_form_validation2, &custom_function_form_validation3
This function enables us to add our own custom field validation. When adding a custom form field you may select the 'Field Validation' as 'Custom Validation Function 1', '2' or '3', depending upon which is selected the appropriate function will be run. The function is called with the $field_value variable which contains the data entered into the field. If the function returns '1' the validation has been parsed successfully, if the function returns '0' then the validation has failed and the error message will be displayed.
Please note, we are happy to answer any questions regarding these functions but we cannot offer support for your Perl code.