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

Form validation not working

Hi all!

adminblock.module

This module enables admins to display a block with the comments approval queue and the node moderation queue. Each item will have a edit and delete link.

I made it for my own site and thought maybe someone else also could make use of it.


/**
 * @file
 * adminblock.module 4.5.0v2, Fredrik Jonsson, 2005-02-17
 * Enables admins to display a block with the comments approval queue and
 * the node moderation queue.
 *
 * The block will only show for users with "administer nodes" privilages.
 *
 * If there are no comments to approve and no nodes to moderate 
 * the block will not show.
 */

/**
 * Implementation of hook_help().
 */
function adminblock_help($section = "admin/help#adminblock") {
  switch ($section) {
    case 'admin/modules#description':
      $output = t("Block that display the comments approval queue and the node moderation queue.");
      break;
  }
  return $output;
}

/**
 * Implementation of hook_block().
 *
 * Generates a block with the comments approval queue and
 * the node moderation queue.
 * $nlimit sets the number of comments and nodes to display
 */

function adminblock_block($op = 'list', $delta = 0) {
  if ($op == 'list') {
    $blocks[0]['info'] = t('Admin block');
    return $blocks;
  }
  else if (user_access('administer nodes')) {
    $nlimit = 10;

    $result = db_query_range('SELECT c.timestamp, c.subject, c.cid 
      FROM {comments} c 
      WHERE c.status = 1
      ORDER BY c.timestamp DESC ', 0, $nlimit);
    $items = array();
    while ($comment = db_fetch_object($result)) {
      $items[] = $comment->subject .' - '. format_date($comment->timestamp, 'medium'). ' ['. l(t('edit'),'admin/comment/edit/'. $comment->cid) .']|['.l(t('delete'),'admin/comment/delete/'. $comment->cid) .']';
    }

    $result2 = db_query_range('SELECT n.nid, n.title, n.changed, u.name, u.uid 
      FROM {node} n 
      INNER JOIN {users} u ON n.uid = u.uid 
      WHERE n.status = 0 AND n.moderate = 1 
      ORDER BY n.changed DESC', 0, $nlimit);
    $items2 = array();
    while ($node = db_fetch_object($result2)) {
      $items2[] = $node->title .' - '. format_date($node->changed, 'medium'). ' ['. l(t('edit'),'node/'. $node->nid .'/edit') .']|['.l(t('delete'),'admin/node/delete/'. $node->nid) .']';
    }

    $block['subject'] = t('Admin block');
    if ($items) {
      $block['content'] = theme('item_list', $items, t('Comments queue'));
      $block['content'] .= '<div class="more-link">'. l(t('more'), 'admin/comment/list/approval', array ('title' => t('Administer the approval queue'))). '</div>';
    }
    if ($items2) {
      $block['content'] .= theme('item_list', $items2, t('Content queue'));
      $block['content'] .= '<div class="more-link">'. l(t('more'), 'admin/node', array ('title' => t('Administer content'))). '</div>';
    }
    return $block;
  }
}

Latest headlines block

Hi,
how i can display 5 latest headlines in the block from one taxonomy category?

New headlines module -- your feedback, please!

I've written a module, called headlines.module, which is designed to create newspaper-like "headlines pages" for Drupal websites. It lets admins organize content into "sections" (like the sections of a newspaper. Each section can include multiple "topics." (For example, a sports section might include topics such as baseball, football, tennis.) Topics are derived from taxonomy terms, with a couple of refinements. First, a "topic" encompasses a term and all of that term's child terms. Second, there are a couple of "special" topics called "top stories" and "miscellaneous" that don't correspond to any taxonomy terms. Within each topic, there can be multiple "items," each of which lists the headline and an optional brief summary description for a single Drupal node.

Headlines.module is designed to interoperate with a separate module that I've written, called abstract.module, which manages the brief summary descriptions for each item on a headlines page.

Before adding these module to Drupal contributions, I'd like to get as much feedback as possible. For the time being, therefore, they can be downloaded as tarbells from my website, at the following URLs:

http://www.prwatch.org/headlines.tar.gz
http://www.prwatch.org/abstract.tar.gz

I'd appreciate any comments. I would also like to get feedback specially about abstract.module. Its function is very similar to the existing excerpt.module. The difference is that excerpt.module uses the teaser field in the node table to store its content, while abstract.module maintains a separate table for this purpose, thus leaving teasers unchanged. I'd like to know whether people think it would be best to:

Mod'ing Poll module to allow for multiple votes at the same IP

I am looking at trying to modify the poll module to allow multiple votes from the same IP. I have a website that runs Drupal 4.5.2 that is public to the internet but also mainly accessed via a controlled kiosk at a museum. I want to offer a poll but since the kiosk is always on the same IP you can't ever vote more than the first time.

I don't know whether this modification would be useful to the community at large or not but to even get there I was curious about a couple things:

Problems combining Store with Taxonomy_access?

I'm setting up an site for a client who wants both an ecommerce store and private content through taxonomy_access. But it seems that taxonomy_access has set permissions so that only the admin can view the store, most likely because the store exists outside of available vocabularies. Are these two modules incompatible? Is there some way to move the store into a term inside a normal vocabulary?

Thanks for your time, and forgive my n00bishness.

Pages

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