Hi,
This is possibly a nasty problem. However, it could just be me being incompetent...
I have a table called drulig_node, like this:
mysql> describe druligg_node;
+--------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+-------+
| nid | int(10) unsigned | NO | PRI | 0 | |
| promoted_on | int(11) | NO | | 0 | |
| killed | int(2) | NO | | 0 | |
| url | char(128) | NO | | | |
| title_url | char(128) | NO | UNI | | |
| safe_section | char(128) | NO | | | |
| bury_count | int(11) | NO | | 0 | |
+--------------+------------------+------+-----+---------+-------+
Now, I want to make sure that "killed" entry are never visualised unless the user types their URL directly.
So, I wrote:
function druligg_db_rewrite_sql($query, $primary_table, $primary_field, $args){
if($primary_table='n' && $primary_field == 'nid'){
if( !( arg(0)=='node' && is_numeric(arg(1)) )){
$return['where'] .= " AND !(n.type='druligg' AND dn.killed=1 ) ";