Drupal and Icontact Integration Issues

by 8 replies
10
I have found that after several attempts at using the Drupal forum...nobody replies.

My issue is that I'm trying to get an icontact email sign up form on my drupal site.

There is an icontact module which I activated. 1. icontact api 2. icontact statistics 3. icontact iu

Once I enabled those I got an error.

"Fatal error: Class 'iContact' not found in /home7/berkeycl/public_html/modules/icontact/icontact.module on line 256"

Not sure what to do. Could I just move to wordpress and be done with it? Yes, but I don't want to right now. I want to figure this out.

Please help me if you can.

Thank you.
#programming #drupal #icontact #integration #issues
  • Hi,

    Can you past all the code from the icontact.module file here.
    • [1] reply
    • Thank you so much for replying. Here is the code. Sorry it's so long. I had to take out any links because I've only posted here a few times. I replaced the links with stars.

      ------------------------------------------------------------------

      <?php
      // $Id: icontact.module,v 1.1.4.4.2.13 2009/08/22 00:04:06 greenskin Exp $

      /**
      * @file
      * Provides an API for the iContact API.
      *
      * This module makes API methods for iContact available for other modules
      * to utilize.
      *
      * @author greenSkin.
      */

      define('ICONTACT_URL', 'https://app.icontact.com/icp');
      define('ICONTACT_TEST_URL', 'https://app.sandbox.icontact.com/icp');
      define('ICONTACT_APP_ID', '4AuXFcTZc6MSKIhekSCFJOAmJrnoYHWT');
      define('ICONTACT_TEST_APP_ID', 'aGhF9JgPtDvQqzCtgGMKfNprUNm5i7Dj');

      /************************************************** *****************************
      * Hook Functions (Drupal)
      ************************************************** ****************************/

      /**
      * Implementation of hook_help().
      */
      function icontact_help($path, $arg) {
      switch ($path) {
      case 'admin/icontact':
      case 'admin/icontact/api':
      $output = '<p id="icontact-live-help">'. t('!link<br />App ID: @app_id', array('!link' => l(t('Enable application on Live iContact account.'), '*****************'), '@app_id' => ICONTACT_APP_ID)) .'</p>';
      $output .= '<p id="icontact-sandbox-help">'. t('!link<br />App ID: @app_id', array('!link' => l(t('Enable application on Sandbox iContact account.'), '******************'), '@app_id' => ICONTACT_TEST_APP_ID)) .'</p>';
      return $output;
      }
      }

      /**
      * Implementation of hook_perm().
      */
      function icontact_perm() {
      return array('administer iContact');
      }

      /**
      * Implementation of hook_menu().
      */
      function icontact_menu() {
      $items = array();
      $items['admin/icontact'] = array(
      'title' => 'iContact',
      'description' => 'API settings for using the iContact api.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('icontact_api_settings'),
      'access callback' => 'icontact_admin_perm',
      'file' => 'icontact.admin.inc'
      );
      $items['admin/icontact/api'] = array(
      'title' => 'API settings',
      'description' => 'API settings for using the iContact api.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('icontact_api_settings'),
      'access callback' => 'icontact_admin_perm',
      'file' => 'icontact.admin.inc',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10
      );
      $items['icontact/flush-cache'] = array(
      'page callback' => 'icontact_flush_cache',
      'access callback' => 'icontact_admin_perm',
      'type' => MENU_CALLBACK,
      'file' => 'icontact.admin.inc'
      );
      return $items;
      }

      /**
      * Implementation of hook_flush_caches().
      */
      function icontact_flush_caches() {
      return array('cache_icontact');
      }

      /************************************************** *****************************
      * Hook Functions (Admin Menu)
      ************************************************** ****************************/

      /**
      * Implementation of hook_admin_menu().
      */
      function icontact_admin_menu(&$deleted) {
      $links = array();
      $links[] = array(
      'title' => 'iContact',
      'path' => 'icontact/flush-cache',
      'query' => 'destination',
      'parent_path' => 'admin_menu/flush-cache'
      );
      return $links;
      }

      /************************************************** *****************************
      * Hook Functions (Autoload)
      ************************************************** ****************************/

      /**
      * Implementation of hook_autoload_info().
      */
      function icontact_autoload_info() {
      $path = drupal_get_path('module', 'icontact') .'/classes';
      return array(
      'iContact' => array(
      'file' => 'iContact.class.inc',
      'file path' => $path
      ),
      'iContactResource' => array(
      'file' => 'iContactResource.class.inc',
      'file path' => $path
      ),
      'iContactAccount' => array(
      'file' => 'iContactAccount.class.inc',
      'file path' => $path
      ),
      'iContactClientFolder' => array(
      'file' => 'iContactClientFolder.class.inc',
      'file path' => $path
      ),
      'iContactContact' => array(
      'file' => 'iContactContact.class.inc',
      'file path' => $path
      ),
      'iContactList' => array(
      'file' => 'iContactList.class.inc',
      'file path' => $path
      ),
      'iContactMessage' => array(
      'file' => 'iContactMessage.class.inc',
      'file path' => $path
      ),
      'iContactSubscription' => array(
      'file' => 'iContactSubscription.class.inc',
      'file path' => $path
      ),
      'iContactUser' => array(
      'file' => 'iContactUser.class.inc',
      'file path' => $path
      )
      );
      }

      /************************************************** *****************************
      * Callback Functions, Forms, and Tables
      ************************************************** ****************************/



      /************************************************** *****************************
      * Module and Helper Functions
      ************************************************** ****************************/

      function icontact_resource_list() {
      return array(
      'accounts' => t('Accounts'),
      'campaigns' => t('Campaigns'),
      'clientFolders' => t('Client folders'),
      'contacts' => t('Contacts'),
      'contactHistory' => t('Contact history'),
      'customFields' => t('Custom fields'),
      'lists' => t('Lists'),
      'messageBounces' => t('Message bounces'),
      'messageClicks' => t('Message clicks'),
      'messageOpens' => t('Message opens'),
      'messages' => t('Messages'),
      'permissions' => t('Permissions'),
      'segments' => t('Segments'),
      'segmentCriteria' => t('Segment criteria'),
      'sends' => t('Sends'),
      'statistics' => t('Statistics'),
      'subscriptions' => t('Subscriptions'),
      'time' => t('Time'),
      'uploads' => t('Uploads'),
      'users' => t('Users')
      );
      }

      function icontact_resource_load($resourceId, $type) {
      static $data = array();

      if (isset($data[$type][$resourceId])) {
      return $data[$type][$resourceId];
      }

      if (!isset($data[$type])) {
      $data[$type] = array();
      }
      $icontact = icontact_load();

      switch ($type) {
      case 'account':
      if (isset($icontact->accounts[$resourceId]) && is_object($icontact->accounts[$resourceId])) {
      $data[$type][$resourceId] = $icontact->accounts[$resourceId];
      }
      break;
      case 'clientFolder':
      foreach ($icontact->accounts as $accountId => $account) {
      if (isset($icontact->accounts[$accountId]->clientFolders[$resourceId]) && is_object($icontact->accounts[$accountId]->clientFolders[$resourceId])) {
      $data[$type][$resourceId] = $icontact->accounts[$accountId]->clientFolders[$resourceId];
      }
      }
      break;
      case 'contact':
      foreach ($icontact->accounts as $accountId => $account) {
      foreach ($account->clientFolders as $clientFolderId => $clientFolder) {
      if (isset($icontact->accounts[$accountId]->clientFolders[$clientFolderId]->contacts[$resourceId]) && is_object($icontact->accounts[$accountId]->clientFolders[$clientFolderId]->contacts[$resourceId])) {
      $data[$type][$resourceId] = $icontact->accounts[$accountId]->clientFolders[$clientFolderId]->contacts[$resourceId];
      }
      }
      }
      break;
      case 'list':
      foreach ($icontact->accounts as $accountId => $account) {
      foreach ($account->clientFolders as $clientFolderId => $clientFolder) {
      if (isset($icontact->accounts[$accountId]->clientFolders[$clientFolderId]->lists[$resourceId]) && is_object($icontact->accounts[$accountId]->clientFolders[$clientFolderId]->lists[$resourceId])) {
      $data[$type][$resourceId] = $icontact->accounts[$accountId]->clientFolders[$clientFolderId]->lists[$resourceId];
      }
      }
      }
      break;
      case 'subscription':
      foreach ($icontact->accounts as $accountId => $account) {
      foreach ($account->clientFolders as $clientFolderId => $clientFolder) {
      if (isset($icontact->accounts[$accountId]->clientFolders[$clientFolderId]->subscriptions[$resourceId]) && is_object($icontact->accounts[$accountId]->clientFolders[$clientFolderId]->subscriptions[$resourceId])) {
      $data[$type][$resourceId] = $icontact->accounts[$accountId]->clientFolders[$clientFolderId]->subscriptions[$resourceId];
      }
      }
      }
      break;
      case 'message':
      foreach ($icontact->accounts as $accountId => $account) {
      foreach ($account->clientFolders as $clientFolderId => $clientFolder) {
      if (isset($icontact->accounts[$accountId]->clientFolders[$clientFolderId]->messages[$resourceId]) && is_object($icontact->accounts[$accountId]->clientFolders[$clientFolderId]->messages[$resourceId])) {
      $data[$type][$resourceId] = $icontact->accounts[$accountId]->clientFolders[$clientFolderId]->messages[$resourceId];
      }
      }
      }
      break;
      }
      return $data[$type][$resourceId];
      }

      function icontact_load($refresh = FALSE) {
      static $icontact = NULL;

      if (is_object($icontact) && $refresh === FALSE) {
      return $icontact;
      }

      $icontact = new iContact($refresh);
      if ($icontact->checkLoggedIn()) {
      return $icontact;
      }
      return FALSE;
      }

      function icontact_admin_perm($perm = NULL) {
      if (user_access('administer iContact')) {
      return TRUE;
      }
      if ($perm != NULL && user_access($perm)) {
      return TRUE;
      }
      return FALSE;
      }
  • From what I see, this line:

    $icontact = new iContact($refresh);

    Is calling a function iContact() which doesn't exist in icontact.module

    this is why you are getting the error.

    Have you removed any code from the script?

    Try re-installing again from the original without modifying anything.
    • [1] reply
    • Thank you for looking at this with me. I haven't removed any code from that script. I will re-install and see what happens.
      • [1] reply
  • Yes,

    The script is not complete. This is why it's not working. You will have to find the complete script.
    • [1] reply
    • Please forgive me for being a little thick headed on this.

      I don't understand where I'm supposed to look for a complete script.

      I've tried to talk to icontact support and they say they only go as far as giving me the drupal page to download the module.
  • But the module where you are downloading from is obviously broken. Ask them to email you an updated working one or at least update their file at the site where it is downloaded from.

Next Topics on Trending Feed