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

mysql-specific modification to archive.module for monthly listings with entry counts

this is a more efficient version of archive_calendar_listing that is mysql-specific. it also displays the total post count for each month:

function archive_calendar_listing_mysql() {
  $cache = cache_get("archive:calendar:listing");
  if (!empty($cache)) {
    return $cache->data;
  }

  $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t
("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 =>
 t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));

  $sql = "
    SELECT SUBSTRING(FROM_UNIXTIME(created), 1, 7) as date, COUNT(*) as count
    FROM   {node}
    WHERE  status = 1
    GROUP  BY date DESC
  ";

  $count = variable_get("archive_months", 0);
  if ($count) {
    $sql .= " LIMIT $count";
  }

  $result = db_query($sql);

  while ($month = db_fetch_object($result)) { 
    list($y, $m) = explode('-', $month->date);
    $mname = $months[intval($m)];
    $items[] = l("$mname $y", "archive/$y/$m") . " (" . $month->count . ")";
  }
  $output = theme("item_list", $items); 

  cache_set("archive:calendar:listing", $output);

  return $output;
}

_insert / _delete / _update hooks not being called?

Hi All! I'm working on a new module intended for my Drupal 4.4.x system. So I thought I would follow the recommendations of using these hooks instead of _nodeapi. However, for some reason they are NOT being called. Any tips on how to diagnose / correct this problem are appreciated!

Radi

How to read / write to database w/ drupal

Our web site is based on drupal 4.3.1. I put regular updates into a set of manually updated static pages that are linked to from the main menu. My goal has always been to write / modify a module that will handle the updates section for me automatically so that i can delegate the task of adding updates to another department. Here is what I envision:

Utilizing the standard node creation method, when the node is created a copy of the node index number would be kept in a seperate "updates" table to identify which nodes are updates.

Multiple Select Forms: Javascript within the module

In the module that I'm developing, I have two select forms side by side. In between these forms are buttons which are used to move items in the second list.

I tried to base this off the admin page for the HTML AREA module (/admin/system/modules/htmlarea), but I was unsuccessful in hacking the code for my module. I then turned to the internet where I found this little example. I think that this example would have worked. But I'm running into syntax errors. The onclick commands don't like the drupal generated names for the select forms. Drupal kicks out form names like:

name="edit[node_list_options][]"

These names don't play nice with onclick javascript actions that are passing the form information. Example:

document.form.edit[node_list_options][].selectedIndex

To get around this, I tried to manipulate the select forms via Javascript by passing the id. Drupal does generate clean id names. I did this with:

document.getElementById("node_list_options").selectedIndex

This didn't seem to work either. Does anyone know of a good way to incorporate javascript into modules? I need to have two select boxes side by side, along with an add, remove, up, down and submit button. The first select box will pull a list of available nodes, the second will pull a list of assigned nodes.

Need opinions for which module to use as product catalog

Hello,
I'm a bit lost searching forums, downloads and CVS for a module that could help me create a catalog of objects that are not to be sold, just info. I only need to have 1 picture, a category, a title and a description.

What i don't want is an ecommerce shopping cart. I've heard about people using a modified image gallery for this but i don't want to show the objects (products) with the rest of the pictures from my existing gallery.

User Registration - Add Fields

I have a site I'm working on that requires admin approval for all new users. Unfortunately just having the username and e-mail fields during registration are not enough. I also need to require the full (real) name.

The Real Name field I'd like to be inputed into the profile data.

Digging through the user.module, I was able to get the text box and everything for the Real Name, but after that I'm not sure what to do.

Any help/code examples would be much appreciated.

Thank You!

Pages

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