For example, in the orders table, we might want users to view the orders as of 1/1/2009 only. To do so, we’d write the PHP code for filtering the orders table by date as follows.

In hooks/tablename.php”

/* filter 1 code*/
    /* let's assume the date field is the fourth field in the orders table*/
    addFilter(1, 'and', 4, 'greater-than-or-equal-to', '1/1/2009');

So, the above code limits the orders table list only orders dating 1/1/2009 or newer. Now, where should this code be placed? It should be placed in the generated “hooks/tablename.php” file inside the tablename_init() function, where tablename is the name of the concerned table. For our example, the file would be named “hooks/orders.php” and the function orders_init(). So, the code in the file would look like this:

function orders_init(&$options, $memberInfo, &$args){
    addFilter(1, 'and', 4, 'greater-than-or-equal-to', '1/1/2009');
    return TRUE;

Using multiple filters

Let’s say we want to filter orders to display only the orders of January 2009. In this case, we’ll add another filter to our code to limit orders to the period from 1/1/2009 to 1/31/2009

addFilter(1, 'and', 4, 'greater-than-or-equal-to', '1/1/2009');
addFilter(1, 'and', 4, 'less-than-or-equal-to', '1/31/2009');