/** * Use MailChimp API key to try to grab corresponding user profile to check validity of key * * @param string * @return bool */ function li_check_invalid_api_key($api_key) { $gr = new LI_GetResponse($api_key); $ping = $gr->ping(); if (!empty($ping)) { $invalid_key = FALSE; } else { $invalid_key = TRUE; } return $invalid_key; }
/** * Adds a subcsriber to a specific list * * @param string * @param string * @param string * @param string * @param string * @return int/bool */ function push_contact_to_list($list_id = '', $email = '', $first_name = '', $last_name = '', $phone = '') { if (isset($this->options['li_gr_api_key']) && $this->options['li_gr_api_key'] && $list_id) { $gr = new LI_GetResponse($this->options['li_gr_api_key']); $contact_synced = $gr->addContact($list_id, $first_name . ' ' . $last_name, $email); return TRUE; } return FALSE; }