Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am trying to create a simple module by following the instructions in http://websmiths.co/blog/very-introduction-drupals-hookformalter.

I've created the following two files along with the content in them as below:

mysite_simplenews.info

name = Custom Example
description = Just a simple example module
version = 0.1
core = 7.x
package = Alpha Custom Modules

mysite_simplenews.module

<?php

I've uploaded the module to the server, but it is not being picked up in the list of modules.

Is this because I am running Drupal 7 and the tutorial is for drupal 6? Is it because of the <?php line in my .module file?

share|improve this question
3  
Why would you use a D6 tutorial for D7? I searched for "drupal 7 create module" and this was the first result: drupal.org/node/361112 – Patrick Kenny Feb 13 at 5:54
Thanks @PatrickKenny Thanks for that, but I find anything on drupal.org to not be basic enough for drupal/programming beginners :( I am looking at the theming_example module and cannot make sense of it... – kine456 Feb 13 at 6:01
2  
Although the quality of materials on drupal.org varies widely, you should not dismiss all of drupal.org, as nearly all Drupal documentation can be found there. Drupal.org documentation is also more likely to be up-to-date than tutorials on other sites. – Patrick Kenny Feb 13 at 6:11

3 Answers

Take a look at Creating Drupal 7.x modules

Writing module .info files (Drupal 7.x)

Example The following is a sample .info file:

name = Really Neat Widget
description = Provides a really neat widget for your site's sidebar.
core = 7.x
package = Views
dependencies[] = views
dependencies[] = panels
files[] = example.test
configure = admin/config/content/example
share|improve this answer
Thank you @NickhilM I created a test module under sites/all/modules Called it myname and created myname.info and myname.module. I copied the info above to my .info file and left .module blank. I can see that the files are on the server, but I cannot see the module in the list of available modules on my site. What could be the problem? – kine456 Feb 13 at 6:12
@kine456, please add .module file as well. Please read the docs. It is necessary if you're planning to complete your Drupal project. Consider my comment in a healthy way. – Nikhil M Feb 13 at 6:18
Thank you. So the .module file must not be empty? @NikhilM – kine456 Feb 13 at 22:25

Contributed modules should be installed under [siteroot]/sites/all/modules, under your custom module folder.

Before your module will show up in the Modules listing, make sure you have both a .info file and a .module file (it can be empty for the moment). Call it exactly like your .info file (e.g. mysite_simplenews.module)

Your .info file looks OK, look here for a more detailed description of what should go inside a .info file: http://drupal.org/node/1075072

share|improve this answer

For the info of others - I had this issue and the problem turned out to have been caused by the character encoding of the text editor I'd used to create the custom module. For some reason, my editor (notepad++) was using Macintosh EOL format - something not obvious at all - but this was preventing Drupal from discovering the module.

So my advice to others in this situation, in addition to the responses above, is: check your module's character encoding and EOL format by comparison to another module that works fine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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