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

using profile information in other modules

Hi,

I'm currently working on a module that allows users to create labels ready for printing. It should create labels with the snail-mail address of the community members, so that they can be used for paper mailings.

For now, a label definition contains a user defined sql statement, and a layout definition that uses special markup to be replaced with the properties that are retrieved with the sql statement. e.g.:

query : select name, mail from user
layout:

where is core.php

I have been looking through the Drupal code and have been trying to understand how it ticks. I understand the way that the hooks works, but do not understand where the base definitions are kept. I have been going through each of the files in my Drupal installation and do not see a definition of each of the hooks, except for init and exit. Where is this kept? How is it restricting which hooks are implementable?

Problem with hof.module

I'm using Drupal 4.6 and uploaded hof folder under the modules folder.
But now my site gives "page cannot be displayed" error when I try to open the admin/modules page. All other admin pages are normal.
When I delete the hof module, then admin/module page works properly.

Conference management module?

Hello there, I'm new to all this -- is there a conference management module (some people call it events management) ie conf. program, registrations, financials etc?

Larry

Weighted Tag Clouds (as seen on Flickr and Technocrati) to Drupal!

Either you like them or you don't, but they leave no one untouched. Of course I'm talkin about Weighted Tag Clouds, seen on Flickr, Technorati and del.icio.us among others.

So here it is, Drupal Weighted Tag Clouds Module!

Sidenote 1: Actually this is my first module ever built, and I'm not really a programmer (copy 'n' paste you know...), so please feel free to improve and comment on the code.
Sidenote 2: This doesn't have to be a module, just pull out the php-code and replace the variables and you can include it on any page you wan't.
Sidenote 3: Also feel free to include this in an existing module, I'd be glad.

<?php

/**
 * Implementation of hook_menu().
 */
function term_popular_menu($may_cache) {
  $items = array();

  if ($may_cache) {
    $items[] = array('path' => 'admin/settings/term_popular', 'title' => t('popular terms'),
      'callback' => 'term_popular_admin',
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM);

    $items[] = array('path' => 'term_popular', 'title' => t('popular terms'),
      'callback' => 'term_popular_page',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK);
  }

  return $items;
}


/**
 * Menu callback; present settings.
 */
function term_popular_admin() {
  system_settings_save();

  foreach (taxonomy_get_vocabularies() as $vocabulary) {
    $vocabulary_fields[$vocabulary->vid] = $vocabulary->name;
  }

  $output = form_textfield(t('Maximum number of terms'), 'max_terms', variable_get('max_terms', 200), 4, 5, t('Maximum number of terms to show on the page.'));
  $output .= form_select(t('Vocabularies to include'), 'vocabulary_fields', variable_get('vocabulary_fields', $vocabulary_fields), $vocabulary_fields, t('Select which vocabularies to be included on the page.'), 0, 1);

  print theme('page', system_settings_form($output));
}


/**
 * Return a list of popular terms in HTML.
 */
function term_popular_list() {

  $vocabulary_fields =  variable_get("vocabulary_fields", $vocabulary_fields);
  $max = variable_get('max_terms', 200);

  if ($vocabulary_fields != NULL  && $max != NULL) {
    implode(', ', $vocabulary_fields);

    $result = db_query('SELECT * FROM {term_data} WHERE vid IN (%s)', implode(', ', $vocabulary_fields));

    while ($term = db_fetch_object($result)) {
        $term_names[$term->tid] = $term->name;
        $popularity[$term->tid] = taxonomy_term_count_nodes($term->tid) ;
    }

    arsort($popularity);
    $popularity_temp = $popularity;
    $most_popular = (array_shift($popularity_temp));
    natcasesort($term_names);
    $i = 1;

    while (list($key, $val) = each($term_names) and $i <= $max) {
      if ($popularity[$key] > 0) {
        $output .= '<span style="font-size: '. round(($popularity[$key] / $most_popular * 30) + 8) . 'px">' . l( $val, 'taxonomy/term/'. $key) . '</span>' . "\n";
        $i++;
      }
    }

    return $output;
  }
}

/**
 * Theme Popular Terms page
 */
function term_popular_page($rids = null) {
  $output  = '<div class="term_popular">';
  $output .= term_popular_list();
  $output .= '</div>';
  print theme("page", $output);
}

?>

This line is where the magic happens:

$output .= '<span style="font-size: '. round(($popularity[$key] / $most_popular * 30) + 8) . 'px">' . l( $val, 'taxonomy/term/'. $key) . '</span>' . "\n";

I'm not shure if the "math" used here is the best, go play with it! Yuo could of course also use em instead of px.

problem to open http://drupaldocs.org/api/head/file/contributions/ docs/developer/examples/node_example.module

Sorry for my english.
I can't open http://drupaldocs.org/api/head/file/contributions/docs/developer/example... page, I can only see this page:
Fatal error: Can't open file: 'sessions.MYI'. (errno: 145) query: SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = '8a5893b83cf981526b8ac3f671be4775' AND u.status < 3 LIMIT 0, 1 in /home/www/drupaldocs.org/includes/database.mysql.inc on line 125.
what is the problem?

Pages

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