function campaignmonitor_admin_settings_general_validate in Campaign Monitor 7
Same name and namespace in other branches
- 8 includes/campaignmonitor.admin.inc \campaignmonitor_admin_settings_general_validate()
Form validation handler. Tests if the given API keys are valid.
1 string reference to 'campaignmonitor_admin_settings_general_validate'
- campaignmonitor_admin_settings_general in includes/
campaignmonitor.admin.inc - Creates the Campaign Monitor settings form.
File
- includes/
campaignmonitor.admin.inc, line 121 - Implementation of the administration interface for the module.
Code
function campaignmonitor_admin_settings_general_validate($form, &$form_state) {
$cm = CampaignMonitor::getConnector($form_state['values']['campaignmonitor_account']['api_key'], $form_state['values']['campaignmonitor_account']['client_id']);
$cm
->getLists();
$error = $cm
->getLatestError();
if ($error['code'] == 401) {
form_set_error('campaignmonitor_account', $error['message']);
}
}