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

Filemanager Demo Site?

Anybody knows of a drupal web site that has filemanager module working properly? I have installed it together with the attachment module and enabled them but can't see the functionality of it. I was able to successfully upload (attach) a file to my post but how can I specify the permissions/sections, like public and private?

Adding an image upload field to a custom module

This is a 4.7 friendly version of the image upload method here: http://drupal.org/node/30944. 4.7 enables much simpler code, making image.module do most of the work.

My task was to add an image upload field to a custom 'news' node - a variation on the standard story node. The function names here use those from my module (news), but these will of course need to be changed to your module references (i.e. mymodule_insert() or whatever).

STEP 1: Add the file upload field to the node's form
Insert the following line into hook_form()

$form['image'] = array('#type' => 'file', '#title' => t('Image'), '#description' => t('Click "Browse..." to select an image to upload.'));

STEP 2: Handle the submitted form's new image field using the image.module.
Create or edit hook_update() and hook_insert(). These use functions from image.module to upload the image and create the 'preview' and 'thumbnail' versions, then associate the image files with this node.

function news_update(&$node) {
  if(function_exists('image_prepare') && function_exists('image_update')){
    image_prepare($node, 'image');
    image_update($node);
  }
}
function news_insert(&$node) {
  if(function_exists('image_prepare') && function_exists('image_insert')){
    image_prepare($node, 'image');
    image_insert($node);
  }
}

STEP 3: Load the node's associated image data into $node

Passing more than one variable using link

How do I pass more than one variable in a link. Here is what I have:

    $rows[] = array(t($points->name),
              t($points->tot_points),
              t($points->tot_games),
              t($points->avg_points),
              l(t(details), "poker/details_page/".$points->player_id)
);

The l line works and passes the variable $points->player_id to the function, but I can't figure out how to pass a second variable. Can someone tell me how?

Thanks in advance.

Norm

New Queue Ready for CVS

I volunteered a bit ago to maintain the Queue module for 4.7, and am ready to do so. I updated the Queue.module to 4.7 awhile ago, and just now finally figured out how to CVS. However, there's a directory already in place with the 4.6x version of Queue in there. What should I do? I assume that one should stay in there? (Although maybe I can just replace those files, since Queue was part of 4.6x core.) Or do we create new directories somewhere besides contributions/modules for 4.7x modules, when there's an existing 4.6x module?

Thanks,
Aaron

Is module relativity compatible with drupal 4.7.x ?

Hi,

I am using relativity module with flexinode on Drupal 4.6.5 - Now I am testing a 4.7.0b5 release and it looks like relativity is not supported. What happens is that clicking on 'administer >modules' node doesn't load any content into the browser window or (using IE) it generates a 'page cannot be found' error.

I wonder if anyone has been profitable in porting 'relativity' to drupal 4.7.x - beside that, I am looking for a way to express parent/child relationship in Drupal 4.7.x. Does anyone know any good?

Thanks,

Paolo

Easy way to verify email address?

Hi,

What's the best way to verify that an email address "looks" sensible? I'm writing a module that asks for an email address on a form and I'd like the form validation procedure to check that the email address looks like a decent email address. I've considered writing a lumpy bit of code that first checks for the presence of an "@", then explodes the email address around the "@", then checks to make sure the explode resulted in two fragments, then checks for the existance of a "." in the second fragment. Is there an easier and less fragile way?

Thanks,
Jack

Pages

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