You are here

function uc_recurring_subscription_enable in UC Recurring Payments and Subscriptions 6.2

Same name and namespace in other branches
  1. 7.2 modules/uc_recurring_subscription/uc_recurring_subscription.install \uc_recurring_subscription_enable()

Implementation hook_enable().

File

modules/uc_recurring_subscription/uc_recurring_subscription.install, line 95
Installs the Recurring Subscription module.

Code

function uc_recurring_subscription_enable() {
  $pcid = 'uc_recurring_subscription';
  if (db_result(db_query("SELECT count(*) FROM {uc_product_classes} WHERE pcid = '%s'", $pcid)) < 1) {
    db_query("INSERT INTO {uc_product_classes} (pcid, name, description) VALUES ('%s', 'Recurring Subscription', 'A recurring subscription product used by the recurring subscription ui module to manage your subscription products')", $pcid);
    uc_product_node_info(TRUE);
    node_types_rebuild();
    menu_rebuild();
  }
  variable_set('node_options_' . $pcid, variable_get('node_options_product', array(
    'status',
    'promote',
  )));
  variable_set('uc_recurring_subscription_product_class', $pcid);
  $attribute = new stdClass();
  $attribute->name = 'uc_recurring_subscription_payment_options';
  $attribute->label = 'Payment Option';
  $attribute->ordering = 0;
  $attribute->required = 1;
  $attribute->display = 1;
  $attribute->description = 'The subscription payment options';
  uc_attribute_save($attribute);
  uc_attribute_subject_save($attribute, 'class', 'uc_recurring_subscription');
  variable_set('uc_recurring_subscription_attribute', $attribute->aid);
}