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

creating dynamic forms that actually submit

I'm creating a module that adds my own fields to the registration page using hook_user(). I'm trying to make it so that which fields are created depends on whether a $_SESSION variable is set, so I have the following (simplified down) code called from hook_user() when $op = 'register':

function dm_teams_register_teams($edit, $account, $category) {
  if($_SESSION['dm_teams']['tid']) {
    $form['team']['tid'] = array(
      '#type' => 'hidden',
      '#value' => $_SESSION['dm_teams']['tid'],
    );
    unset($_SESSION['dm_teams']['tid']);
  }  elseif($_SESSION['dm_teams']['new_team']) {
    $form['team']['name'] = array(
      '#type' => 'textfield',
      '#title' => t('Team Name'),
      '#size' => 60,
      '#maxlength' => 100,
      '#required' => TRUE,
    );
    unset($_SESSION['dm_teams']['new_team']);
  } else {
    $form['team']['find'] = array(
      '#type' => 'button',
      '#value' => 'Find a Team',
      '#submit' => FALSE,
    );
  }
  return $form;
}

It shows up very nicely the first time, but then if there are errors, no matter what the else statement shows up (because the $_SESSION vars have been unset). Not only that, but I checked the $edit array in my validate function, hook_user($op = 'validate'), and the information that was in $form['team']['tid'] or $form['team']['name'] does not appear. I do not understand that because the form generated fine.

Catalog articles as nodes or simple db records?

I'd like to start extending drupal with a catalog module.

I don't think using nodes for the catalog items (like the ecommerce module does) is the right way to go because:

  • I need to update articles regularly (once a day, maybe deleting all and recreating them)
  • there's a huge number of articles (more than 10K)

Since it's a couple of weeks that I read documentation but didn't find something similar, I don't know which direction to take, i.e. using nodes for the whole catalog or categories, or using taxonomy for categories or ...

Adding classes to event-show links

Hi all,

I think would be useful adding a class to links in event.module (lines 39-43). With a class, you can add for example a background icon like this:

month [icon] | week [icon] | day [icon] | list [icon]

What do you think about?

Input Formats and Acidfree nodes

I've recently installed the latest 4.7.x Acidfree and drupal 4.7.3 (I have several Drupal sites). Is there a reason no input formats are showing when adding or editing Acidfree node text fields? I've never had to specifically apply input formats to content types before. Does that have to be done now?

It's kind of annoying not being able to format descriptions for albums and images in the galleries.

Thanks!

Clean install of CCK on Drupal 4.7.3 generating errors

I have completed a clean install of drupal on a test server at my employment (after successful installs locally on a windows machine) but as soon as I try to install either the ecommerce module or the CCK module, I receive the error below:

CAPTURING %count AS A VARIABLE

Hello:

I'm working on the creation of a module and I'm hoping I can get a quick answer to the following:

ON LINE 102 of statistics.module is the following line of code:

$links[] = format_plural($statistics['totalcount'], '1 read', '%count reads');

I have one very simple request:

How do I capture the "%count" as a variable to hold the number of "reads" as a numerical value and have it update like the above "%count" each time a user views a blog post.

Pages

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