function campaignmonitor_admin_settings_general_validate in Campaign Monitor 8
Same name and namespace in other branches
- 7 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. This is located under the general tab.
File
- includes/
campaignmonitor.admin.inc, line 118 - 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']);
}
}