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

Menu callback to produce a form - how exactly?

Hi

I am trying to put a menu item up (successful) which when clicked on presents a form. The form will be something for users to select an item off (basically volunteer for an option).

I don't understand exactly how to get this right - could someone just point me in the right direction - here is where I am:

I added a menu item:

function fhsstadmin_menu($may_cache) {
  $items = array();
    $items[] = array('path' => 'assignments', 'title' => t('Assignments'),
      'callback' => 'fhsstadmin_assignments',
      'type' => MENU_CALLBACK,
      'access' => user_access('access nodes'));
}
  return $items;
}

I am not sure exactly what type should be but it shows up and when I click on Assignments it does call my function:

function fhsstadmin_assignments()
{
// return a list of all nodes not assigned to anybody i.e. assigned to nobody
//step 1 - get nobody's uid
$querynobody = "SELECT uid FROM users WHERE name = 'nobody'";
$nobodyobject = db_fetch_object(db_query($querynobody));
$query="SELECT * FROM node WHERE uid = $nobodyobject->uid";
$queryResult=db_query($query);
$options = array();
$string = "";
while ($links = db_fetch_object($queryResult))
{
$options["$links->nid"] = $links->title;
$string .= "$links->nid";
}
$form['fhsstadmin_assignment'] = array(
'#type' => 'radios',
'#title' => t('Choose the section you would like to start with:'),

Software repository extension

Hi,
Do we have a software repository extension for drupal?
or can I customize any other extension to use as such? like a photo gallery? which one do you suggest?.
thanks

Easy link to attachments

I just had a look through all the available modules and couldnt find any that did this easliy(i could have missed it, but i did look through them all)

Was just wondering if there was a module about that let you easily link to the desired attached content.

Moderate Comments like Digg

Hello, instead of having that button you have to press to moderate comments, I'm looking for a solution like Digg.com. It shows the drop down with each comment, and after choosing one of it's choices, the vote is entered without the need for page reload, and remains so it can be changed. My guess is that it is some sort of ajax solution. Thanks for any help!

TinyMCE doesn't work with firerfox 1.5 on os X

Any solutions. When i go into edit I lose all info

node_example.module and image.module

Hi,

I am trying to construct my own modules out of the node_example module. I want to be able to upload a couple of images together with this some other info.
I pasted all what seemed to be the necessary fuctions from the image.module. Everything works fine up to when it comes to showing the actual images. I think my error must be somewhere in the hook_load(). The original node_example loads data and returns it whereas the image.module loads defines in $node an image array. this works fine but when it comes to showing the images in hook_view() the images array is not defined.

Is there a way to return the image array together with the $additions in one object or alternatively what is going wrong that $node->images i undefined?

<?php

function node_example_load($node) {

// pasted from image.module
$result = db_query("SELECT filename, filepath FROM {files} WHERE nid=%d", $node->nid);
$node->images = array();
while ($file = db_fetch_object($result)) {
$node->images[$file->filename] = $file->filepath;
}
// special images
if (empty($node->images['thumbnail'])) {
$node->images['thumbnail'] = $node->images['_original'];
}
if (empty($node->images['preview'])) {
$node->images['preview'] = $node->images['_original'];
}

// node example module way of doing things
$additions = db_fetch_object(db_query('SELECT URLpath, URLpath2, quantity FROM {node_example} WHERE nid = %d', $node->nid));

Pages

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