This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Drupal 4.7 module skeleton

Does anyone have a drupal 4.7 module skeleton the most basic module, like just printing "hello" on the screen? I would really appreciate getting a copy to get me started with a working base module.

Thanks

Norm

How do I tell if cron is calling hook_nodeapi?

My question is related to a problem which is described here. I look after the Checkout module which uses the hook_nodeapi in several modes (including "form pre", "validate" and "update") to lock access to a node by other users. Apparently this causes problems with the Aggregator module running under cron such that all the nodes it updates are left "checked out" and so non-modifiable. I'm not sure how to deal with this: one way would be to detect whether the updating process is a cron job or not, but I have no idea how to do this.

Need Help with Tables and 4.7 Forms API

Hi guys, I'm trying to update a site I manage to Drupal 4.7-beta4. I've made a few custom modules, one of which implemented a form mixed into a table. The old code looked like this:

$db_hours_query = db_query('...query...', $node_data->nid);
while ($db_hours = db_fetch_array($db_hours_query)) {
  $user_select[$db_hours['row_num']] = $db_hours['uid'];
  $service_hours[$db_hours['row_num']] = $db_hours['service_hours'];
  $fellowship_hours[$db_hours['row_num']] = $db_hours['fellow_hours'];
  $fundraiser_hours[$db_hours['row_num']] = $db_hours['fund_hours'];
  $ritual_req[$db_hours['row_num']] = $db_hours['ritual'];
}

In here a select field is generated, but I'm switching to a textfield with 4.7's autocomplete feature, so it's not really relevant.
<?php
$header = array(t('#'), t('Member'), t('Service Hrs'), t('Fellowship Hrs'), t('Fundraiser Hrs'), t('Ritual Req.'));
$rows = array();
for($i = 1; $i <= $total_slots; $i++) {
$rows[] = array(
'data' => array(
($error[$i] ? theme('image', 'misc/watchdog-error.png', t('error'), t('error')) : t($i)),
form_select('', 'user_select]['.$i, ($user_select[$i] != 'select' ? $user_select[$i] : 'Select a Member'), $user_options),
form_textfield('', 'service_hours]['.$i, (($service_hours[$i] && $user_select[$i] != 'select') ? $service_hours[$i] : ''), 5, 5),
form_textfield('', 'fellowship_hours]['.$i, (($fellowship_hours[$i] && $user_select[$i] != 'select') ? $fellowship_hours[$i] : ''), 5, 5),

Recommendation

Just wondering if someone can recommend a good image galleries module. I've tried gallery2 and the basic album module, but I find that the gallery2 module is too congested to the average user, and the album module isn't very "gallery-ish" (ie you can't browse several pictures in rows and colums on the page - just in list form, as if they were seperate posts).

I'd love something in which photos could be displayed like in gallery2, but with a simple interface. All i want to do is click on an album and view the pictures inside, with a nice layout.

nodeapi $op = 'prepare'

What is the main use of the 'prepare' op in hook_nodeapi? It's not documented , and i was just wondering what is commonly done during that hook, and when it is fired...

hook_user question

Hi everyone (anyone)

I have done my best to solve this issue of adding my own information into the $user object when it is loaded.
I checked the API for hook_user and implemented
what I thought was the correct solution but it didn't work. To ensure that I had done it correctly I made a clean install
of Drupal and built a whole new module based on block_example so that it was clear what I was doing and nothing else could
affect it.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions