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

How do I do a "group by" on a date in drupal

I am trying to do something like views by day using the accesslog table. So instead of the full "timestamp" with the time portion I want to just use the "date part" of the field timestamp in a group by ..... this sort of works but I don't think the days are really correct... using my log I get some for tomorrow...

Looking at code in modules I just don't really understand "date math" without using date fields...

adding image upload functionality to your module

A while back I was asking about how to easily incoporporate image.module functionality into a module.

I got it working and thought I would share it here in case anyone else is trying to do this. This solution requires under 50 lines of code and will ignore the image functionality if image.module is not enabled on the site.

Step 1. hook_form

Add this code into your hook_form function.

  // image form code
  if(function_exists('_image_check_settings')){
    _image_check_settings();
    $param['options'] = array("enctype" => "multipart/form-data");
    if (is_array($node->images)) {
      foreach ($node->images as $label => $image) {
        $output .= form_hidden('images]['.$label, $image);
      }
    }
    if ($node->images['thumbnail']) {
      $output.= form_item(t('Thumbnail'), image_display($node, 'thumbnail'));
    }
    $output .= form_file(t('Image'), 'image', 50, t('Click "Browse..." to select an image to upload.'), TRUE);
  }

Step 2. hook_insert

First, you will need to change hook_insert($node) to hook_insert(&$node). This is because image_validate acts on the $node object and if you do not import the reference to the actual $node object via the '&' prefix, these changes will be lost. After this change has been made, add this code:


// image insert code (remember that image.module acts on $node to create $node->images)

on creating new account during product purchase no email sent

Originally on installation of drupal 4.5 and ecommerce, purchasers must create a user account before purchasing a product. Originally, account creation worked including during an eccomerce transaction. Now when they attempt to do buy a product and create an account during that process, you get the error: 'Unable to send mail. Please contact the site admin. ' When I go just to create a new account without a transaction, I get the message like 'your account information has been sent to your email address...' but I check the account and no email is received.

Drupal Installation

http://mystyle.com.ru/code/install.zip

Just place directory 'install' to unpacked drupal. And go to http://yoursite.com/install
Don't forget to delete directory 'install' after installation.
It works only for mySQL now, but I think it's not a problem to add postgres install.

Multiple book.module installations

Hi I want to install book.module multiple times.
Ex.:

editorials.module
lyrics.module
book.module

Spreadsheet module (or Flexinode field?)

http://trimpath.com/project/wiki/TrimSpreadsheet

Javascript based GPLed spreadsheet. Someone should do something with this... Imagine this as part of a flexinode?

Some form of templating? (ie set up formulas ahead of time, lock the spreadsheet, and only allow input in certain cells)

Pages

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