You are here

function avatar_selection_install in Avatar Selection 5

Same name and namespace in other branches
  1. 5.2 avatar_selection.install \avatar_selection_install()
  2. 6 avatar_selection.install \avatar_selection_install()
  3. 7 avatar_selection.install \avatar_selection_install()

Implementation of hook_install() just give a message

File

./avatar_selection.install, line 6

Code

function avatar_selection_install() {
  if (!variable_get('user_pictures', 0)) {
    drupal_set_message(t('User Pictures option is disabled.  You will need to enable this option before you can use the Avatar Selection module.  You may configure this setting at the <a href="@url">User settings</a> page.', array(
      '@url' => url('admin/user/settings'),
    )));
  }
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      db_query("CREATE TABLE if not exists {avatar_selection} (\n        avatar varchar(255) NOT NULL UNIQUE,\n        access varchar(255),\n        og_access varchar(255),\n        PRIMARY KEY (avatar)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {avatar_selection} (\n        avatar varchar(255) NOT NULL UNIQUE,\n        access varchar(255),\n        og_access varchar(255),\n        PRIMARY KEY (avatar)\n      )");
      break;
  }
}