I've just made a facebook module, it's working nicely, the only thing is that it doesn't install into the modules/custom folder. The module installs into the modules folder (the custom folder is located inside this modules folder).

How can I make sure the module installs into modules/custom?

This is my .install file.

 * @file
 * Install, update and uninstall functions for the facebooklikebox module.

 * Implements hook_uninstall().
function facebooklikebox_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE '%facebooklikebox%'");
  cache_clear_all('variables', 'cache');

function facebooklikebox_update_6101() {
  // Get the default settings
  drupal_load('module', 'facebooklikebox');
  $defaults = _facebooklikebox_get_settings(TRUE);

  // Define a settings array based on the variables already set (or their defaults)
  $settings = array(
    'facebooklikebox_pageurl' => variable_get('facebooklikebox_pageurl', 0),
    'facebooklikebox_height' => variable_get('facebooklikebox_height', 0),
    'facebooklikebox_width' => variable_get('facebooklikebox_width', 0),
    'facebooklikebox_bordercolor' => variable_get('facebooklikebox_bordercolor', 0),
    'facebooklikebox_showfaces' => variable_get('facebooklikebox_showfaces', 0),
    'facebooklikebox_showstream' => variable_get('facebooklikebox_showstream', 0),
    'facebooklikebox_showheader' => variable_get('facebooklikebox_showheader', 0),


  // If a setting matches the default value, unset it (we wont need to store it)
  foreach ($settings as $key => $value) {
    // We used to use -1 for disabled, convert this to 0 for the new diabled
    if ($value == -1) {
      $settings[$key] = 0;
    // Now compare the value to the defaults. Only store if an "override".
    if ($value == $defaults[$key]) {

  // Save the settings in a single array rather than individual keys
  if (!empty($settings)) {
    variable_set('facebooklikebox_settings', $settings);

  // Remove all the old settings

As I know Drupal web interface will always install modules to sites/all/modules.
Placing modules in subfolders like sites/all/modules/contrib, sites/all/modules/custom, or sites/all/modules/dev is a task for Drush and Drush Make; you can manually place the module in the right folder.

You can move your module folder with the PHP rename() function, or implement your own Updater instead of core ModuleUpdater. In your case, these solutions look improper.

  • hmm are u certain there is no way to achieve this? Im searching through all sorts of custom modules but can't find it.. – mhmdrupal Jul 13 '12 at 8:40
  • Contrib module can't decide where to be installed. It will be installed in that folder where it was downloaded. – kalabro Jul 13 '12 at 8:43
  • kk tnx for your time mate – mhmdrupal Jul 13 '12 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.