Adding settings page and filter on one nodetype

toemaz - April 23, 2007 - 08:11
Project:Recent Changes
Version:5.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

I included a patch for recent changes which adds the following functionality:

  • A settings page so the admin can configure the module
  • Set default filtering on one specific node type, in case the admin would like to hide the filter

When adding the default filter functionality, I encoutered a problem:

<?php
    $where
.= " AND n.type = '" . check_plain($node_type) . "'";
?>

resulted in some cases in a SQL query with a bad WHERE statement: " WHERE AND n.type = 'foo' ... ". The solution is also provided in this patch:
<?php
    $where
.= ($where ? ' AND ' : '') . " n.type = '" . check_plain($node_type) . "'";
?>

AttachmentSize
recent_changes_settings.module.patch3.88 KB

#1

toemaz - April 23, 2007 - 08:23

The previous patch was not good. Here is a fixed one.

AttachmentSize
recent_changes_settings.module_0.patch 3.46 KB
 
 

Drupal is a registered trademark of Dries Buytaert.